Mercurial > hg > lukkari
comparison beta.php @ 7:2bb40c5945bc
Remove useless variable.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 11 Jan 2011 22:04:18 +0200 |
parents | 3d6a83eaa2ba |
children | fe5b563eaae5 |
comparison
equal
deleted
inserted
replaced
6:7fca87c41e17 | 7:2bb40c5945bc |
---|---|
7 $mapFile = "kartta.png"; | 7 $mapFile = "kartta.png"; |
8 $roomFile = "luokkatilat.txt"; | 8 $roomFile = "luokkatilat.txt"; |
9 $cacheFile = "coursecache.txt"; | 9 $cacheFile = "coursecache.txt"; |
10 $baseURI = "http://tnsp.org/luk/beta.php"; | 10 $baseURI = "http://tnsp.org/luk/beta.php"; |
11 $infoURI = "http://www.oamk.fi/opiskelijalle/rakenne/opinto-opas/koulutusohjelmat/?sivu=oj&kieli=FI&opas=2010-2011&vuosi=10S11K&koodi1="; | 11 $infoURI = "http://www.oamk.fi/opiskelijalle/rakenne/opinto-opas/koulutusohjelmat/?sivu=oj&kieli=FI&opas=2010-2011&vuosi=10S11K&koodi1="; |
12 | |
13 $showDays = 6; | |
14 $dayNames = array("Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai", "Sunnuntai"); | 12 $dayNames = array("Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai", "Sunnuntai"); |
15 | 13 |
16 // Include framework | 14 // Include framework |
17 require "mcommon.inc.php"; | 15 require "mcommon.inc.php"; |
18 require "merrors.inc.php"; | 16 require "merrors.inc.php"; |
148 | 146 |
149 if ($haveData) { | 147 if ($haveData) { |
150 $totalHours = 0; | 148 $totalHours = 0; |
151 $totalGrouped = 0; | 149 $totalGrouped = 0; |
152 $dayHours = array(); | 150 $dayHours = array(); |
153 for ($day = 0; $day < $showDays; $day++) | 151 |
152 for ($day = 0; $day < $classInfo["maxdays"]; $day++) | |
154 $dayHours[$day]["total"] = $dayHours[$day]["grouped"] = 0; | 153 $dayHours[$day]["total"] = $dayHours[$day]["grouped"] = 0; |
155 | 154 |
156 foreach ($classDefs as $id => $data) { | 155 foreach ($classDefs as $id => $data) { |
157 $h = $data["hours"]; | 156 $h = $data["hours"]; |
158 | 157 |
163 $totalGrouped += $h; | 162 $totalGrouped += $h; |
164 $dayHours[$data["day"]]["grouped"] += $h; | 163 $dayHours[$data["day"]]["grouped"] += $h; |
165 } | 164 } |
166 } | 165 } |
167 | 166 |
168 for ($day = $showDays - 1; $day >= 0; $day--) { | 167 for ($day = $classInfo["maxdays"] - 1; $day >= 0; $day--) { |
169 if ($dayHours[$day]["total"] == 0) | 168 if ($dayHours[$day]["total"] == 0) |
170 $showDays--; | 169 $classInfo["maxdays"]--; |
171 else | 170 else |
172 break; | 171 break; |
173 } | 172 } |
174 | 173 |
175 | 174 |
176 // Create the timetable table | 175 // Create the timetable table |
177 $out = | 176 $out = |
178 "<p>".join("; ", $classInfo["general"])."</p>\n". | 177 "<p>".join("; ", $classInfo["general"])."</p>\n". |
179 "<table class=\"timetable\">". | 178 "<table class=\"timetable\">". |
180 " <tr>\n <th></th>\n"; | 179 " <tr>\n <th></th>\n"; |
181 for ($day = 0; $day < $showDays; $day++) { | 180 for ($day = 0; $day < $classInfo["maxdays"]; $day++) { |
182 $out .= " <th class=\"days\">".$dayNames[$day]."</th>\n"; | 181 $out .= " <th class=\"days\">".$dayNames[$day]."</th>\n"; |
183 } | 182 } |
184 $out .= " </tr>\n"; | 183 $out .= " </tr>\n"; |
185 | 184 |
186 for ($hour = 0; $hour < $classInfo["maxhours"]; $hour++) { | 185 for ($hour = 0; $hour < $classInfo["maxhours"]; $hour++) { |
187 $out .= " <tr>\n". | 186 $out .= " <tr>\n". |
188 " <th class=\"hours\">".getHour($hour)."</th>\n"; | 187 " <th class=\"hours\">".getHour($hour)."</th>\n"; |
189 for ($day = 0; $day < $showDays; $day++) { | 188 for ($day = 0; $day < $classInfo["maxdays"]; $day++) { |
190 if (isset($classHourTable[$hour][$day])) { | 189 if (isset($classHourTable[$hour][$day])) { |
191 $h = $classHourTable[$hour][$day]; | 190 $h = $classHourTable[$hour][$day]; |
192 | 191 |
193 if ($h < 1) { | 192 if ($h < 1) { |
194 if ($h == 0) { | 193 if ($h == 0) { |
232 errorMsg("Internal error, cell $hour / $day does not exist."); | 231 errorMsg("Internal error, cell $hour / $day does not exist."); |
233 } | 232 } |
234 $out .= " </tr>\n"; | 233 $out .= " </tr>\n"; |
235 } | 234 } |
236 | 235 |
237 $out .= printHourInfo($dayHours, $showDays). | 236 $out .= printHourInfo($dayHours, $classInfo["maxdays"]). |
238 "</table>"; | 237 "</table>"; |
239 | 238 |
240 } // haveData | 239 } // haveData |
241 | 240 |
242 | 241 |