diff --git a/class.schedule.php b/class.schedule.php --- a/class.schedule.php +++ b/class.schedule.php @@ -22,8 +22,6 @@ class Schedule private $storage; // Integer array of valid schedules private $title; - private $classContinue = array(-1, -1, -1, -1, -1); - /** * \brief * My global identification number. Not defined until the schedule @@ -262,35 +260,44 @@ class Schedule } $table .= "

\n \n" - . "
" - . "
"; + . "
\n" + . "
\n"; for($i = 0; $i < $this->nPermutations; $i++) { - $table .= "
"; + $table .= '
\n"; // Beginning of table - $table .= ""; + $table .= "
\n"; // Header row - $table .= "\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t"; + $table .= " \n" + . ' \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n"; $last_meeting = array(); + $rowspan = array(0, 0, 0, 0, 0); for($r = 0; $r < (count($time)-1); $r++) { - $table .= "\n\t\n\t\t"; + $table .= " \n" + . " \n"; for($dayLoop = 0; $dayLoop < 5; $dayLoop++) { - for($j = 0; $j < $this->nclasses; $j++) + /* Makes sure there is not a class already in progress */ + if($rowspan[$lastDay] <= 0) + { + for($j = 0; $j < $this->nclasses; $j++) { $class = $this->classStorage[$j]; $section_index = $this->storage[$i][$j]; $section = $class->getSection($section_index); - // Makes sure there is not a class already in progress - if($this->getClassCont($dayLoop) == -1) - { /* iterate through all of a class's meeting times */ $meetings = $section->getMeetings(); @@ -308,57 +315,48 @@ class Schedule if ($current_meeting) { - // Checks if the class continues after the given time - if($current_meeting->getEndTime() > $time[$r+1]) - { - $table .= "\n\t\t"; - - $this->setClassCont($dayLoop, $j); - $last_meeting[$dayLoop] = $current_meeting; + /* calculate how many rows this section should span */ + for ($my_r = $r; $current_meeting->getEndTime() > $time[$my_r]; $my_r ++) + ; + $rowspan[$dayLoop] = $my_r - $r; + + $single_multi = 'single'; + if ($rowspan[$dayLoop] > 1) + $single_multi = 'multi'; - $filled = TRUE; - } - else - { - $table .= "\n\n\t"; - $filled = TRUE; - } + $table .= ' \n"; + $filled = TRUE; } - } - else - { - if($j == $this->getClassCont($dayLoop)) - { - if(isset($last_meeting[$dayLoop]) - && $last_meeting[$dayLoop]->getEndTime() > $time[$r+1]) - { - $table .= "\n\t\t"; - $filled = TRUE; - } - else - { - $table .= "\n\t\t"; - $this->setClassCont($dayLoop, -1); - $filled = TRUE; - } - } - } - } + } + } - // If the cell was not filled, fill it with an empty cell. + if ($rowspan[$dayLoop] > 0) + { + $filled = TRUE; + $rowspan[$dayLoop] --; + } + + /* If the cell was not filled, fill it with an empty cell. */ if(!$filled) { - $table .= "\n\t\t"; + $table .= " \n"; } - $filled = false; + $filled = FALSE; } // End of row - $table .= "\n\t"; + $table .= " \n"; } // End of table - $table .= '
" . ($i+1) . "MondayTuesdayWednesdayThursdayFriday
' . ($i + 1) . "MondayTuesdayWednesdayThursdayFriday
" . $this->prettyTime($time[$r]) . "
" . $this->prettyTime($time[$r]) . "" . htmlentities($class->getName()) . " " . htmlentities($section->getLetter()) . "" . htmlentities($class->getName()) . " " . htmlentities($section->getLetter()) . "' + . htmlentities($class->getName(), ENT_QUOTES) . ' ' + . htmlentities($section->getLetter(), ENT_QUOTES) + . "    
\n"; + $table .= " \n" + . '
\n"; } echo $table @@ -437,15 +435,4 @@ class Schedule { return $this->id; } - - - function getClassCont($day) - { - return $this->classContinue[$day]; - } - - function setClassCont($day, $i) - { - $this->classContinue[$day] = $i; - } } diff --git a/styles/output.css b/styles/output.css --- a/styles/output.css +++ b/styles/output.css @@ -1,30 +1,46 @@ /* Output Table Styling */ -.top{ - border-style:solid solid none solid; +.top, +.multi +{ background-color:#dddddd; -moz-border-radius-topright: 5px; border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; border-top-left-radius: 5px; } -.mid{ +.top +{ + border-style:solid solid none solid; +} +.mid +{ border-style:none solid none solid; background-color:#dddddd; } -.end{ - border-style:none solid solid solid; +.end, +.multi +{ background-color:#dddddd; -moz-border-radius-bottomright: 5px; border-bottom-right-radius: 5px; -moz-border-radius-bottomleft: 5px; border-bottom-left-radius: 5px; +} +.end +{ + border-style:none solid solid solid; +} +.multi +{ + border-style: solid; +} -} .none{ border-style:none; border-bottom: 1px solid #DDD; } -.single{ +.single +{ border-style:solid; background-color:#dddddd; }