Mercurial > hg > lukkari
diff index.php @ 79:7dd647a01fb6
Implement indicator for "next" class.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 24 Oct 2012 08:25:12 +0300 |
parents | 2f9c78c68a2c |
children | c553ad61e9c2 |
line wrap: on
line diff
--- a/index.php Wed Oct 24 07:52:03 2012 +0300 +++ b/index.php Wed Oct 24 08:25:12 2012 +0300 @@ -351,6 +351,10 @@ $currStamp = time(); $currTime = $currStamp - mktime(0, 0, 0); $currDay = lukGetWeekdayFromTimestamp($currStamp); + + $nextStamp = $currStamp + 30 * 60; + $nextTime = $nextStamp - mktime(0, 0, 0); + $nextDay = lukGetWeekdayFromTimestamp($nextStamp); // Create the timetable table $out = @@ -380,12 +384,18 @@ { $class["set"] = TRUE; - $isActive = $day == $currDay && + $nextActive = $day == $nextDay && + $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 " : "").($class["grouped"] ? "clgrouped" : "clnormal")."\">". + $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"; }