changeset 128:0f451151b9f1

Move code for one function to same group as others.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 27 Aug 2014 16:32:37 +0300
parents 1e44468dbbd8
children b9ebc24f27fd
files index.php
diffstat 1 files changed, 88 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Wed Aug 27 15:43:25 2014 +0300
+++ b/index.php	Wed Aug 27 16:32:37 2014 +0300
@@ -271,6 +271,94 @@
 }
 
 
+function lukPrintTimeTable($mini)
+{
+  global $classInfo, $classHourDefs, $classHourTimes;
+  
+//  $currStamp = time() + ((3 * 60) + 45) * 60;
+  $currStamp = time();
+  $currTime = $currStamp - mktime(0, 0, 0);
+  $currDay = lukGetWeekdayFromTimestamp($currStamp);
+
+  $nextStamp = $currStamp + 30 * 60;
+  $nextTime = $nextStamp - mktime(0, 0, 0);
+  
+  // Create the timetable table
+  if ($mini)
+  {
+    $out =
+    "<table class=\"timetable\">".
+    " <tr>\n  <th></th>".
+    "  <th class=\"days\">".lukGetDayName($currDay)."</th>\n </tr>\n";
+
+    $startDay = $currDay;
+    $lastDay = $currDay + 1;
+  }
+  else
+  {
+    $out =
+    "<p>".join("; ", $classInfo["general"]).
+    //" [".cmQM("viikossa", $classInfo["totalHours"])."]".
+    "</p>\n".
+    "<table class=\"timetable\">".
+    " <tr>\n  <th></th>\n";
+    
+    $cellWidth = $classInfo["maxDays"] > 0 ? 100 / $classInfo["maxDays"] : 15;
+    if ($cellWidth > 25) $cellWidth = 25;
+
+    for ($day = 0; $day < $classInfo["maxDays"]; $day++)
+    {
+      $out .=  "  <th style=\"width: ".$cellWidth."%;\" class=\"days\">".lukGetDayName($day)."</th>\n";
+    }
+    $out .= " </tr>\n";
+    $startDay = 0;
+    $lastDay = $classInfo["maxDays"];
+  }
+
+
+  for ($hour = $classInfo["firstHour"]; $hour < $classInfo["lastHour"]; $hour++)
+  {
+    $out .= " <tr>\n".
+    "  <th class=\"hours\">".lukGetHourStr($hour)."</th>\n";
+    for ($day = $startDay; $day < $lastDay; $day++)
+    {
+      $id = lukFindClass($day, $hour);
+      if ($id > 0)
+      {
+        $class = &$classHourDefs[$id];
+        if (!isset($class["set"]))
+        {
+          $class["set"] = TRUE;
+
+          $nextActive = $day == $currDay && 
+                      $nextTime >= $classHourTimes[$class["start"]]["start"] &&
+                      $nextTime <  $classHourTimes[$class["start"] + $class["hours"] - 1]["end"];
+
+          $isActive = $day == $currDay && 
+                      $currTime >= $classHourTimes[$class["start"]]["start"] &&
+                      $currTime <  $classHourTimes[$class["start"] + $class["hours"] - 1]["end"];
+
+          $out .= "  <td rowspan=\"".$class["hours"]."\" class=\"".
+          ($isActive ? "clactive " : "").
+          (!$isActive && $nextActive ? "clnext " : "").
+          ($class["grouped"] ? "clgrouped" : "clnormal")."\">".
+          lukGetClassInfo($class["grouped"], $class["data"]).
+          "<div class=\"nhours\"><span>".$class["hours"]."h</span></div></td>\n";
+        }
+      }
+      else
+      {
+        $out .= "  <td class=\"clnothing\"></td>\n";
+      }
+    }
+    $out .= " </tr>\n";
+  }
+
+  return $out."</table>\n";
+}
+
+
+
 // Check given parameters
 // Language must be the first setting to be validated,
 // so that the translation support works properly.
@@ -369,94 +457,6 @@
 }
 
 
-function lukPrintTimeTable($mini)
-{
-  global $classInfo, $classHourDefs, $classHourTimes;
-  
-//  $currStamp = time() + ((3 * 60) + 45) * 60;
-  $currStamp = time();
-  $currTime = $currStamp - mktime(0, 0, 0);
-  $currDay = lukGetWeekdayFromTimestamp($currStamp);
-
-  $nextStamp = $currStamp + 30 * 60;
-  $nextTime = $nextStamp - mktime(0, 0, 0);
-  
-  // Create the timetable table
-  if ($mini)
-  {
-    $out =
-    "<table class=\"timetable\">".
-    " <tr>\n  <th></th>".
-    "  <th class=\"days\">".lukGetDayName($currDay)."</th>\n </tr>\n";
-
-    $startDay = $currDay;
-    $lastDay = $currDay + 1;
-  }
-  else
-  {
-    $out =
-    "<p>".join("; ", $classInfo["general"]).
-    //" [".cmQM("viikossa", $classInfo["totalHours"])."]".
-    "</p>\n".
-    "<table class=\"timetable\">".
-    " <tr>\n  <th></th>\n";
-    
-    $cellWidth = $classInfo["maxDays"] > 0 ? 100 / $classInfo["maxDays"] : 15;
-    if ($cellWidth > 25) $cellWidth = 25;
-
-    for ($day = 0; $day < $classInfo["maxDays"]; $day++)
-    {
-      $out .=  "  <th style=\"width: ".$cellWidth."%;\" class=\"days\">".lukGetDayName($day)."</th>\n";
-    }
-    $out .= " </tr>\n";
-    $startDay = 0;
-    $lastDay = $classInfo["maxDays"];
-  }
-
-
-  for ($hour = $classInfo["firstHour"]; $hour < $classInfo["lastHour"]; $hour++)
-  {
-    $out .= " <tr>\n".
-    "  <th class=\"hours\">".lukGetHourStr($hour)."</th>\n";
-    for ($day = $startDay; $day < $lastDay; $day++)
-    {
-      $id = lukFindClass($day, $hour);
-      if ($id > 0)
-      {
-        $class = &$classHourDefs[$id];
-        if (!isset($class["set"]))
-        {
-          $class["set"] = TRUE;
-
-          $nextActive = $day == $currDay && 
-                      $nextTime >= $classHourTimes[$class["start"]]["start"] &&
-                      $nextTime <  $classHourTimes[$class["start"] + $class["hours"] - 1]["end"];
-
-          $isActive = $day == $currDay && 
-                      $currTime >= $classHourTimes[$class["start"]]["start"] &&
-                      $currTime <  $classHourTimes[$class["start"] + $class["hours"] - 1]["end"];
-
-          $out .= "  <td rowspan=\"".$class["hours"]."\" class=\"".
-          ($isActive ? "clactive " : "").
-          (!$isActive && $nextActive ? "clnext " : "").
-          ($class["grouped"] ? "clgrouped" : "clnormal")."\">".
-          lukGetClassInfo($class["grouped"], $class["data"]).
-          "<div class=\"nhours\"><span>".$class["hours"]."h</span></div></td>\n";
-        }
-      }
-      else
-      {
-        $out .= "  <td class=\"clnothing\"></td>\n";
-      }
-    }
-    $out .= " </tr>\n";
-  }
-
-  return $out."</table>\n";
-}
-
-
-
 //
 // Main code starts
 //