# HG changeset patch # User Matti Hamalainen # Date 1409146357 -10800 # Node ID 0f451151b9f1e76d0502a9d55e324cff36d90150 # Parent 1e44468dbbd832193a22c572cba9e42b48bdf77b Move code for one function to same group as others. diff -r 1e44468dbbd8 -r 0f451151b9f1 index.php --- 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 = + "". + " \n ". + " \n \n"; + + $startDay = $currDay; + $lastDay = $currDay + 1; + } + else + { + $out = + "

".join("; ", $classInfo["general"]). + //" [".cmQM("viikossa", $classInfo["totalHours"])."]". + "

\n". + "
".lukGetDayName($currDay)."
". + " \n \n"; + + $cellWidth = $classInfo["maxDays"] > 0 ? 100 / $classInfo["maxDays"] : 15; + if ($cellWidth > 25) $cellWidth = 25; + + for ($day = 0; $day < $classInfo["maxDays"]; $day++) + { + $out .= " \n"; + } + $out .= " \n"; + $startDay = 0; + $lastDay = $classInfo["maxDays"]; + } + + + for ($hour = $classInfo["firstHour"]; $hour < $classInfo["lastHour"]; $hour++) + { + $out .= " \n". + " \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 .= " \n"; + } + } + else + { + $out .= " \n"; + } + } + $out .= " \n"; + } + + return $out."
".lukGetDayName($day)."
".lukGetHourStr($hour)."". + lukGetClassInfo($class["grouped"], $class["data"]). + "
".$class["hours"]."h
\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 = - "". - " \n ". - " \n \n"; - - $startDay = $currDay; - $lastDay = $currDay + 1; - } - else - { - $out = - "

".join("; ", $classInfo["general"]). - //" [".cmQM("viikossa", $classInfo["totalHours"])."]". - "

\n". - "
".lukGetDayName($currDay)."
". - " \n \n"; - - $cellWidth = $classInfo["maxDays"] > 0 ? 100 / $classInfo["maxDays"] : 15; - if ($cellWidth > 25) $cellWidth = 25; - - for ($day = 0; $day < $classInfo["maxDays"]; $day++) - { - $out .= " \n"; - } - $out .= " \n"; - $startDay = 0; - $lastDay = $classInfo["maxDays"]; - } - - - for ($hour = $classInfo["firstHour"]; $hour < $classInfo["lastHour"]; $hour++) - { - $out .= " \n". - " \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 .= " \n"; - } - } - else - { - $out .= " \n"; - } - } - $out .= " \n"; - } - - return $out."
".lukGetDayName($day)."
".lukGetHourStr($hour)."". - lukGetClassInfo($class["grouped"], $class["data"]). - "
".$class["hours"]."h
\n"; -} - - - // // Main code starts //