Mercurial > hg > lukkari
comparison beta.php @ 11:03c393c347c7
Fixes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 11 Jan 2011 22:46:37 +0200 |
parents | 6272ca0cacea |
children | 306028aa2253 |
comparison
equal
deleted
inserted
replaced
10:6272ca0cacea | 11:03c393c347c7 |
---|---|
147 if ($haveData) { | 147 if ($haveData) { |
148 $totalHours = 0; | 148 $totalHours = 0; |
149 $totalGrouped = 0; | 149 $totalGrouped = 0; |
150 $dayHours = array(); | 150 $dayHours = array(); |
151 | 151 |
152 for ($day = 0; $day < $classInfo["maxdays"]; $day++) | 152 for ($day = 0; $day < $classInfo["maxdays"]; $day++) { |
153 $dayHours[$day]["total"] = $dayHours[$day]["grouped"] = 0; | 153 $dayHours[$day]["total"] = $dayHours[$day]["grouped"] = 0; |
154 | 154 |
155 foreach ($classDefs as $id => $data) { | 155 for ($hour = 0; $hour < $classInfo["maxhours"]; $hour++) { |
156 $h = $data["hours"]; | 156 $id = $classHourTable[$hour][$day]; |
157 | 157 |
158 $totalHours += $h; | 158 if ($id > 0) { |
159 $dayHours[$data["day"]]["total"] += $h; | 159 $totalHours++; |
160 | 160 $dayHours[$day]["total"]++; |
161 if (!$data["grouped"]) { | 161 |
162 $totalGrouped += $h; | 162 if ($classDefs[$id]["grouped"]) { |
163 $dayHours[$data["day"]]["grouped"] += $h; | 163 $totalGrouped++; |
164 $dayHours[$day]["grouped"]++; | |
165 } | |
166 } | |
164 } | 167 } |
165 } | 168 } |
166 | 169 |
167 // Create the timetable table | 170 // Create the timetable table |
168 $out = | 171 $out = |
169 "<p>".join("; ", $classInfo["general"])."</p>\n". | 172 "<p>".join("; ", $classInfo["general"])."</p>\n". |
173 "<div>Viikossa yhteensä <b>".$totalHours."</b> tuntia, joista <b>".$totalGrouped."</b> ryhmissä tai vuoroviikoin.</div>\n". | |
170 "<table class=\"timetable\">". | 174 "<table class=\"timetable\">". |
171 " <tr>\n <th></th>\n"; | 175 " <tr>\n <th></th>\n"; |
172 for ($day = 0; $day < $classInfo["maxdays"]; $day++) { | 176 for ($day = 0; $day < $classInfo["maxdays"]; $day++) { |
173 $out .= " <th class=\"days\">".$dayNames[$day]."</th>\n"; | 177 $out .= " <th class=\"days\">".$dayNames[$day]."</th>\n"; |
174 } | 178 } |