-
Notifications
You must be signed in to change notification settings - Fork 3
/
college.php
executable file
·190 lines (160 loc) · 7.97 KB
/
college.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
/***************************************************************************\
This file is part of RoomAllocation.
RoomAllocation is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RoomAllocation is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RoomAllocation. If not, see <http://www.gnu.org/licenses/>.
\***************************************************************************/
?>
<?php
require_once 'config.php';
require_once 'utils.php';
require_once 'floorPlan/utils.php';
require_once 'floorPlan/Mercator.php';
require_once 'floorPlan/Krupp.php';
require_once 'floorPlan/College3.php';
require_once 'floorPlan/Nordmetall.php';
require_once 'models/Apartment_Choice_Model.php';
require_once 'models/Allocation_Model.php';
require_once 'models/Person_Model.php';
require_once 'models/College_Choice_Model.php';
$Allocation_Model = new Allocation_Model();
$Apartment_Choice_Model = new Apartment_Choice_Model();
$Person_Model = new Person_Model();
$College_Choice_Model = new College_Choice_Model();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/html5cssReset.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="css/messages.css" />
<link rel="stylesheet" type="text/css" href="css/gh-buttons.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.qtip.css" />
<link rel="stylesheet" type="text/css" href="css/floorPlan.css" />
<link rel="stylesheet" type="text/css" href="css/roomAllocation.css" />
<link rel="stylesheet" id="themestyle" href="css/jquery-tour/theme2/style.css" />
<script src="js/jquery.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jquery.qtip.js"></script>
<script src="js/jTour.min.js"></script>
<script src="js/lib.js"></script>
<script src="js/roomAllocation.js"></script>
</head>
<body>
<div id="main">
<?php require_once 'login.php'; ?>
<div id="wrapper">
<?php
if( LOGGED_IN ){
/** Set some info */
$eid = $_SESSION['info']['eid'];
$group = group_info( $eid );
$roommates = get_roommates( $eid, $group['group_id'] );
$info = $_SESSION['info'];
$points = get_points( array_merge( array($info), $roommates ) );
$allocation = $Allocation_Model->get_allocation($eid);
define( 'HAS_ROOM', $allocation['room'] != null );
if( !HAS_ROOM ){
$rooms_taken = extract_column('room', $Allocation_Model->get_all_rooms_from_college($allocation['college']));
$rooms_locked = array_map( 'trim', explode( ',', C("disabled.${info['college']}") ) );
}
?>
<div style="float:left;width:50%;" class="content">
<div class="wrapper">
<h3>Profile</h3>
<?php
echo getFaceHTML( $info );
?>
<br />
<?php if (C('round.active') && C('round.type') === 'college') { ?>
<h3>College Choice</h3>
<ul id="college_choices_sort">
<?php
function makeCollege ($c, $position) {
return '<li id="choice_'.$c.'" class="ui-state-default college-choice"><span class="number">'.$position.'</span><span class="name">'.$c.'</span></li>';
}
$choice_colleges = $College_Choice_Model->get_choices($_SESSION['info']['eid']);
if (count($choice_colleges) == 0 || !$choice_colleges) {
$remaining_colleges = array("Mercator", "College-III", "Nordmetall", "Krupp");
$info = $Person_Model->get($_SESSION['info']['eid']);
$college = $allocation['college'];
$college = in_array($college, $remaining_colleges, true) ? $college : $remaining_colleges[0];
$pos_college = array_search($college, $remaining_colleges);
array_splice($remaining_colleges, $pos_college, 1);
$initial_choice = array('eid' => $_SESSION['info']['eid']);
echo makeCollege($college, 1);
$initial_choice['choice_0'] = $college;
for ($i=0; $i<count($remaining_colleges); ++$i) {
echo makeCollege($remaining_colleges[$i], $i + 2);
$initial_choice['choice_'.($i+1)] = $remaining_colleges[$i];
}
$initial_choice['exchange'] = 0;
$initial_choice['quiet'] = 0;
$College_Choice_Model->set_choices($initial_choice);
} else {
for ($i=0; $i < 4; ++$i) {
echo makeCollege($choice_colleges['choice_' . $i], $i + 1);
}
}
?>
</ul>
<div id="further_infos_college">
<div id="exchange" class="college-additional-options">
<?php if ($choice_colleges['exchange'] == 1) { ?>
<input id="exchange_checkbox" type="checkbox" name="exchange" checked>
<?php } else { ?>
<input id="exchange_checkbox" type="checkbox" name="exchange">
<?php } ?>
<label for="exchange_checkbox">I won't be on campus next semester.</label>
</div>
<div id="quiet_zone" class="college-additional-options">
<?php if ($choice_colleges['quiet'] == 1) { ?>
<input id="quiet_zone_checkbox" type="checkbox" name="quiet-zone" checked>
<?php } else { ?>
<input id="quiet_zone_checkbox" type="checkbox" name="quiet-zone">
<?php } ?>
<label for="quiet_zone_checkbox">I would consider living on a quiet floor.</label>
</div>
</div>
<?php } ?>
</div>
</div>
<?php if (C('round.active') && C('round.type') === 'college') { ?>
<div style="float:right;width:50%;" class="content">
<div class="wrapper">
<h3>Info</h3>
<p>Welcome to the college-phase in the process of <b>Room Allocation 2013</b>. <br /><br />
We tried to make the approach as straightforward as possible. Simply drag and drop the different college names in the order in which you prefer them as your college next year. Hereby the college on position <b>1.</b> represents your <b>most</b> favorite college for next year and position <b>4.</b> the <b>least</b> favorite choice. <br /><br />
For a step by step guide please click here: </p>
<div id="beginTour" class="gh-button">Start Tour</div>
<br />
</div>
</div>
<?php } else { ?>
<div style="float:right;width:50%;" class="content">
<div class="wrapper">
<h3 style="color: red;">No Round!</h3>
<p style="color: red;">No round is currently active. Please wait until the next round.</p>
<br />
</div>
</div>
<?php } ?>
<div class="clearBoth"></div>
<?php } ?>
</div>
<div id="footer" class="message info">
<span style="float:left">(C) 2013 code4fun.de</span>
Designed and developed by
<a title="contact me if anything..." href="mailto:[email protected]">Stefan Mirea</a>
</div>
</div>
</body>
</html>