changeset 11:03c393c347c7

Fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Jan 2011 22:46:37 +0200
parents 6272ca0cacea
children 306028aa2253
files beta.php
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/beta.php	Tue Jan 11 22:30:59 2011 +0200
+++ b/beta.php	Tue Jan 11 22:46:37 2011 +0200
@@ -149,24 +149,28 @@
   $totalGrouped = 0;
   $dayHours = array();
 
-  for ($day = 0; $day < $classInfo["maxdays"]; $day++) 
+  for ($day = 0; $day < $classInfo["maxdays"]; $day++) {
     $dayHours[$day]["total"] = $dayHours[$day]["grouped"] = 0;
 
-  foreach ($classDefs as $id => $data) {
-    $h = $data["hours"];
-  
-    $totalHours += $h;
-    $dayHours[$data["day"]]["total"] += $h;
+    for ($hour = 0; $hour < $classInfo["maxhours"]; $hour++)  {
+      $id = $classHourTable[$hour][$day];
 
-    if (!$data["grouped"]) {
-      $totalGrouped += $h;
-      $dayHours[$data["day"]]["grouped"] += $h;
+      if ($id > 0) {
+        $totalHours++;
+        $dayHours[$day]["total"]++;
+
+        if ($classDefs[$id]["grouped"]) {
+          $totalGrouped++;
+          $dayHours[$day]["grouped"]++;
+        }
+      }
     }
   }
 
   // Create the timetable table
   $out =
   "<p>".join("; ", $classInfo["general"])."</p>\n".
+  "<div>Viikossa yhteensä <b>".$totalHours."</b> tuntia, joista <b>".$totalGrouped."</b> ryhmissä tai vuoroviikoin.</div>\n".
   "<table class=\"timetable\">".
   " <tr>\n  <th></th>\n";
   for ($day = 0; $day < $classInfo["maxdays"]; $day++) {