diff --git a/inc/class.schedule.php b/inc/class.schedule.php --- a/inc/class.schedule.php +++ b/inc/class.schedule.php @@ -297,6 +297,25 @@ class Schedule if($this->nPermutations > 0) { + /* + * Figure out if we have to deal with Saturday and then deal + * with it. + */ + $max_day_plusone = 5; + $have_saturday = FALSE; + foreach ($this->courses as $course) + { + for ($si = 0; $si < $course->getnsections(); $si ++) + foreach ($course->getSection($si)->getMeetings() as $meeting) + if ($meeting->getDay(5)) + { + $max_day_plusone = 6; + $have_saturday = TRUE; + break; + } + if ($have_saturday) + break; + } echo '

Enter these codes into your school\'s online course registration system to register for classes:

'; echo '
' . "\n" . @@ -348,18 +367,21 @@ class Schedule . " Tuesday\n" . " Wednesday\n" . " Thursday\n" - . " Friday\n" - . " \n"; + . " Friday\n"; + if ($have_saturday) + echo " Saturday\n"; + echo " \n"; $last_meeting = array(); - $rowspan = array(0, 0, 0, 0, 0); + $rowspan = array(0, 0, 0, 0, 0, 0); for($r = 0; $r < (count($time)-1); $r++) { echo " \n" . " " . $this->prettyTime($time[$r]) . "\n"; - for($dayLoop = 0; $dayLoop < 5; $dayLoop++) + /* currently, 0-5 = monday-saturday */ + for($dayLoop = 0; $dayLoop < $max_day_plusone; $dayLoop++) { /* Makes sure there is not a class already in progress */ if($rowspan[$dayLoop] <= 0) diff --git a/inc/class.section.php b/inc/class.section.php --- a/inc/class.section.php +++ b/inc/class.section.php @@ -188,10 +188,10 @@ class Section $ret['course'] = strtoupper($course_matches[1]); /* - * we accept _either_ alphabetic section _or_ numeric section (the - * latter is for cedarville, particulaly) + * we accept fully alphanumeric section identifiers. ccbcmd uses + * these amazingly. */ - if (!preg_match(';([0-9]+|[a-zA-Z]+);', $section_spec, $section_matches)) + if (!preg_match(';([a-zA-Z0-9]+);', $section_spec, $section_matches)) return $ret; $ret['section'] = strtoupper($section_matches[1]); diff --git a/inc/class.section_meeting.inc b/inc/class.section_meeting.inc --- a/inc/class.section_meeting.inc +++ b/inc/class.section_meeting.inc @@ -81,7 +81,7 @@ class SectionMeeting */ private function days_set($days_str) { - $this->days = array(0 => FALSE, 1 => FALSE, 2 => FALSE, 3 => FALSE, 4 => FALSE); + $this->days = array(0 => FALSE, 1 => FALSE, 2 => FALSE, 3 => FALSE, 4 => FALSE, 5 => FALSE); $days_str_strlen = strlen($days_str); for ($i = 0; $i < $days_str_strlen; $i ++) @@ -96,9 +96,9 @@ class SectionMeeting */ private static function day_atoi($day_c) { - static $day_atoi = array('m' => 0, 't' => 1, 'w' => 2, 'h' => 3, 'f' => 4, - 'M' => 0, 'T' => 1, 'W' => 2, 'H' => 3, 'F' => 4, - 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4); + static $day_atoi = array('m' => 0, 't' => 1, 'w' => 2, 'h' => 3, 'f' => 4, 's' => 5, + 'M' => 0, 'T' => 1, 'W' => 2, 'H' => 3, 'F' => 4, 'S' => 5, + 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5); return $day_atoi[$day_c]; } @@ -187,7 +187,7 @@ class SectionMeeting * times. But if they don't both meet on the same day at least * once, they don't conflict. */ - for ($day = 0; $day < 5; $day ++) + for ($day = 0; $day < 6; $day ++) { if ($this->getDay($day) && $that->getDay($day)) return TRUE; @@ -211,7 +211,7 @@ class SectionMeeting */ public function to_json_array() { - static $daymap = array(0 => 'm', 1 => 't', 2 => 'w', 3 => 'h', 4 => 'f'); + static $daymap = array(0 => 'm', 1 => 't', 2 => 'w', 3 => 'h', 4 => 'f', 5 => 's'); $json_array = array( 'time_start' => $this->time_start, @@ -221,7 +221,7 @@ class SectionMeeting 'type' => $this->type, ); - for ($day = 0; $day < 5; $day ++) + for ($day = 0; $day < 6; $day ++) $json_array['days'][$daymap[$day]] = $this->getDay($day); return $json_array; diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -114,6 +114,7 @@ if (!empty($_REQUEST['selectschool']) To get started, enter a course number and add some sections to it. Then specify each section's letter/number and what times it meets, add more courses, and click “Find a Schedule”. +

@@ -126,6 +127,22 @@ if (!empty($_REQUEST['selectschool']) + + + + + + + + + + + + + + + + @@ -138,6 +155,7 @@ if (!empty($_REQUEST['selectschool']) + @@ -178,7 +196,8 @@ function input_class_js(Course $class, $ . htmlentities($section->getSynonym(), ENT_QUOTES) . '\', \'' . $meeting->getStartTime() . '\', \'' . $meeting->getEndTime() . '\', ' - . json_encode(array('m' => $meeting->getDay(0), 't' => $meeting->getDay(1), 'w' => $meeting->getDay(2), 'h' => $meeting->getDay(3), 'f' => $meeting->getDay(4))) . ', \'' + . json_encode(array('m' => $meeting->getDay(0), 't' => $meeting->getDay(1), 'w' => $meeting->getDay(2), 'h' => $meeting->getDay(3), 'f' => $meeting->getDay(4), + 's' => $meeting->getDay(5))) . ', \'' . htmlentities($section->getProf(), ENT_QUOTES) . '\', \'' . htmlentities($meeting->getLocation(), ENT_QUOTES) . '\',\'' . htmlentities($meeting->type_get(), ENT_QUOTES) . "');\n"; diff --git a/process.php b/process.php --- a/process.php +++ b/process.php @@ -24,30 +24,31 @@ include_once 'inc/class.schedule.php'; include_once('inc/class.course.inc'); include_once 'inc/class.section.php'; -// Converts a 5-element day array into a string. +// Converts a 6-element day array into a string. // Supports multiple modes, prettiness, and searching for different indicators function arrayToDays($array, $mode = 'num', $pretty = false, $key = 1) { $outString = ''; switch($mode) { case 'short': - $days = array('Mon','Tue','Wed','Thur','Fri'); + $days = array('Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat'); break; case 'long': - $days = array('Monday','Tuesday','Wednesday','Thursday','Friday'); + $days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); break; case 'num': $days = array('1','2','3','4','5'); break; case 'alpha': - $days = array('m', 't', 'w', 'h', 'f'); + $days = array('m', 't', 'w', 'h', 'f', 's'); break; default: $outString = 'Invalid mode passed to arrayToDays()!'; return $outString; } if(count($array) > 1){ - for($i=0; $i<=4; $i++) { + for($i = 0; $i < 6; $i ++) + { if(isset($array[$i]) && $array[$i] == $key){ $outString .= $days[$i]; if($pretty) @@ -60,7 +61,7 @@ function arrayToDays($array, $mode = 'nu } } else { - for($i=0; $i<=4; $i++) + for($i=0; $i < 6; $i++) if(isset($array[$i])) $outString = $days[$i]; } @@ -138,8 +139,9 @@ if(!$DEBUG) foreach($class as $section) /* Skip the section name, which isn't a section */ if(is_array($section)) - { + {error_log(print_r($section['days'], TRUE)); $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays($section['days'], 'alpha'), $section['synonym'], $section['professor'], $section['location'], $section['type']); + error_log(arrayToDays($section['days'], 'alpha')); } } } diff --git a/scripts/scheduleInput.js b/scripts/scheduleInput.js --- a/scripts/scheduleInput.js +++ b/scripts/scheduleInput.js @@ -192,11 +192,12 @@ function genSectionHtml_n(cnum, name, sy } result = result + '\ - \ + \ \ \ \ - '; + \ + '; result = result + ''); + jQuery('#jsrows').append(''); var class_elem = jQuery('.className' + classNum); class_elem.autocomplete({ source: "auto.php" }); diff --git a/styles/general.css b/styles/general.css --- a/styles/general.css +++ b/styles/general.css @@ -200,6 +200,12 @@ td.center { background: #68a64a!important; } +/* For now, hide Saturday on the input page even though it works perfectly fine */ +.saturday +{ + /* http://www.w3.org/TR/CSS/tables.html#columns */ + visibility: collapse; +} /* General Classes */
Class IDW Th FS
' + '' + '' @@ -253,7 +254,7 @@ function add_section_n(cnum, name, synon } function add_section(cnum) { - return add_section_n(cnum, '', '', '', '', {'m':false, 't':false, 'w':false, 'h':false, 'f':false}, '', '', ''); + return add_section_n(cnum, '', '', '', '', {m: false, t: false, w: false, h: false, f: false, s: false}, '', '', ''); } /** @@ -282,7 +283,7 @@ function add_sections(cnum, data) function add_class_n(name) { sectionsOfClass[classNum] = 0; // Initialize at 0 - jQuery('#jsrows').append('