# HG changeset patch # User Nathan Phillip Brink # Date 2010-10-19 17:00:43 # Node ID 4f632d1a0627af3038e8d7ae1f4feb533f09f8a1 # Parent 741b915a23fe16e28163a04942a04a5ce72b3ac4 Make sure that if a class lasts longer than an hour, the rendered table reflects this. diff --git a/class.schedule.php b/class.schedule.php --- a/class.schedule.php +++ b/class.schedule.php @@ -275,6 +275,7 @@ class Schedule // Header row $table .= "\n\t\n\t\t" . ($i+1) . "\n\t\tMonday\n\t\tTuesday\n\t\tWednesday\n\t\tThursday\n\t\tFriday\n\t"; + $last_meeting = array(); for($r = 0; $r < (count($time)-1); $r++) { @@ -282,7 +283,6 @@ class Schedule for($dayLoop = 0; $dayLoop < 5; $dayLoop++) { - $last_meeting = NULL; for($j = 0; $j < $this->nclasses; $j++) { $class = $this->classStorage[$j]; @@ -303,8 +303,6 @@ class Schedule && $meeting->getStartTime() < $time[$r+1]) { $current_meeting = $meeting; - /* $last_meeting has meaning for a longer time than $current_meeting does. */ - $last_meeting = $meeting; } } @@ -314,7 +312,10 @@ class Schedule if($current_meeting->getEndTime() > $time[$r+1]) { $table .= "\n\t\t" . htmlentities($class->getName()) . " " . htmlentities($section->getLetter()) . ""; + $this->setClassCont($dayLoop, $j); + $last_meeting[$dayLoop] = $current_meeting; + $filled = TRUE; } else @@ -324,13 +325,12 @@ class Schedule } } } - else { if($j == $this->getClassCont($dayLoop)) { - if($last_meeting - && $last_meeting->getEndTime() > $time[$r+1]) + if(isset($last_meeting[$dayLoop]) + && $last_meeting[$dayLoop]->getEndTime() > $time[$r+1]) { $table .= "\n\t\t "; $filled = TRUE;