diff --git a/auto.php b/auto.php --- a/auto.php +++ b/auto.php @@ -37,26 +37,32 @@ require_once('class.class.php'); Page::session_start(); -if (isset($_REQUEST['txt'])) +if (isset($_REQUEST['txt'])) { header('Content-Type: text/plain; encoding=utf-8'); -else +} +else { header('Content-Type: application/json; encoding=utf-8'); +} -if (!isset($_REQUEST['term'])) +if (!isset($_REQUEST['term'])) { clean_empty_exit(); +} $getsections = FALSE; -if (isset($_REQUEST['getsections'])) +if (isset($_REQUEST['getsections'])) { $getsections = TRUE; +} $term = $_REQUEST['term']; $term_parts = Classes::parse($term); -if (!count($term_parts)) +if (!count($term_parts)) { clean_empty_exit(); +} $school = school_load_guess(); -if (!$school['crawled']) +if (!$school['crawled']) { clean_empty_exit(); +} $cache_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'auto' . DIRECTORY_SEPARATOR . $school['id'] . DIRECTORY_SEPARATOR; @@ -71,13 +77,16 @@ if (!$school['crawled']) if (!$getsections && count($term_parts) == 1 && $term_strlen == strlen($dept)) { $dept_file = $cache_dir . '-depts'; - if (!file_exists($dept_file)) + if (!file_exists($dept_file)) { clean_empty_exit(); + } $departments = unserialize(file_get_contents($dept_file)); $json_depts = array(); - foreach ($departments as $key => $department) - if (!strncmp($department, $dept, $dept_strlen)) + foreach ($departments as $key => $department) { + if (!strncmp($department, $dept, $dept_strlen)) { $json_depts[] = $department; + } + } echo json_encode($json_depts); exit(0); @@ -91,7 +100,7 @@ if ($getsections) readfile($section_file); exit(0); } - /* section not found! */ + /* Section not found! */ header('HTTP/1.1 404: Not found'); header('Content-Type: text/plain; encoding=utf-8'); echo 'Could not find course ' . implode('-', $term_parts) . "\n"; @@ -99,7 +108,7 @@ if ($getsections) } /* - * if a department is fully entered, life gets slightly more + * If a department is fully entered, life gets slightly more * complicated. I suppose I only want to autocomplete the first digit * of the course/class number. I.e., CS-2 for CS-262 for when the * student has entered CS- or 'CS'. But for now we can just dump the entire department at the user ;-). @@ -126,7 +135,7 @@ if (file_exists($classes_file)) } /** - * Nothing caught.. + * Nothing caught */ clean_empty_exit(); diff --git a/class.class.php b/class.class.php --- a/class.class.php +++ b/class.class.php @@ -28,7 +28,7 @@ include_once 'class.section.php'; class Classes { - private $name; // String + private $name; // String private $sections; // Array of sections private $nsections; // int @@ -49,7 +49,7 @@ class Classes public function section_add(Section $section) { $this->sections[$this->nsections] = $section; - $this->nsections ++; + $this->nsections++; } //-------------------------------------------------- @@ -65,14 +65,6 @@ class Classes //-------------------------------------------------- function getSection($i) { - // Checks to make sure the desired section is part of the set. - if(isset($this->sections[$i])) - { - //echo "Object sections[$i] was set
"; - } else { - echo "Object sections[$i] was NOT set
"; - } - $result = $this->sections[$i]; return $result; } @@ -91,10 +83,11 @@ class Classes */ public function section_get($letter) { - foreach ($this->sections as $section) - if ($section->getLetter() == $letter) + foreach ($this->sections as $section) { + if ($section->getLetter() == $letter) { return $section; - + } + } return NULL; } @@ -126,8 +119,9 @@ class Classes public static function parse($course_spec) { $section_parts = Section::parse($course_spec); - if (isset($section_parts['section'])) + if (isset($section_parts['section'])) { unset($section_parts['section']); + } return $section_parts; } diff --git a/class.schedule.php b/class.schedule.php --- a/class.schedule.php +++ b/class.schedule.php @@ -96,7 +96,7 @@ class Schedule { $temp = $this->classStorage[$counter]->getName(); - if((strcmp($temp,$course_name)) == 0) + if(strcmp($temp,$course_name) == 0) { $found = true; } else { @@ -214,7 +214,7 @@ class Schedule $filled = false; $time = array(700,730,800,830,900,930,1000,1030,1100,1130,1200,1230,1300,1330,1400,1430,1500,1530,1600,1630,1700,1730,1800,1830,1900,1930,2000,2030,2100,2130, 2200); - define('SP_PERMUTATIONS_PER_PAGE', 256); + define('SP_PERMUTATIONS_PER_PAGE', 256); /** @TODO: Define this in config.inc */ $npages = ceil($this->nPermutations / SP_PERMUTATIONS_PER_PAGE); $page = 0; @@ -243,7 +243,7 @@ class Schedule - if(isset($_REQUEST['print'])){ + if(isset($_REQUEST['print'])) { echo ''; echo '

« Return to normal view

'; @@ -264,43 +264,41 @@ class Schedule } else { echo ''; /* Close document.ready for jquery */ - echo '

You can share your schedule with the URL below:

'.$outputPage->gen_share_url($this->id_get()).'

'; - echo '

Print :: Share :: Home

Having problems? Let us know.

Keyboard Shortcut: Left and right arrow keys switch between schedules

'; + echo ' jQuery(document).ready( function() {'; + echo ' jQuery("#tabs").tabs();'; + echo ' jQuery("#sharedialog").dialog({ modal: true, width: 550, resizable: false, draggable: false, autoOpen: false });'; + echo ' jQuery("#share").click( function() { + jQuery("#sharedialog").dialog("open"); + });'; + echo ' jQuery(\'#printItems\').click( function() { + window.location = "'.$_SERVER['SCRIPT_NAME'].'?s='.$this->id_get().'&print=" + (jQuery(\'#tabs\').tabs(\'option\',\'selected\') + 1); + }); + jQuery(\'#cancelItems\').click( function() { + jQuery(\'#selectItemsInput\').hide(); + });'; + echo ' }); + '; + + echo '

You can share your schedule with the URL below:

'.$outputPage->gen_share_url($this->id_get()).'

'; + echo '

Print :: Share :: Home

'; + echo '

Having problems? Let us know.

'; + echo '

Keyboard Shortcut: Left and right arrow keys switch between schedules

'; } echo "\n"; if($this->nPermutations > 0) { - echo "
\n" - - - . '
-
- - - - -
-
' - - - - . "
'; echo $this->trackingcode; echo ''; } + /** Takes a number in seconds, and outputs HH:MM:SS */ public function secondsToCompound($seconds) { $ret = ""; $hours = intval(intval($seconds) / 3600); @@ -223,6 +229,7 @@ class page return $ret; } + /** Shows a box with recently processed schedules */ public function showSavedScheds($session) { global $clean_urls; @@ -301,9 +308,9 @@ class page */ public function addressStudent($prefix = '', $postfix = '', $necessary = TRUE) { - if (!$necessary && $this->school['id'] == 'default') + if (!$necessary && $this->school['id'] == 'default') { return; - + } echo $prefix . $this->school['student_address'] . $postfix; } 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 @@ -37,9 +37,7 @@ class SectionMeeting { private $time_start; private $time_end; - private $days; - private $location; /** diff --git a/index.php b/index.php --- a/index.php +++ b/index.php @@ -17,8 +17,9 @@ * You should have received a copy of the GNU Affero General Public License * along with SlatePermutate. If not, see . */ - include_once 'inc/class.page.php'; - $mypage = new page('Welcome'); + + include_once 'inc/class.page.php'; + $welcomepage = new page('Welcome'); ?>

Find the schedule that works for you!

@@ -26,4 +27,4 @@

Get Started

foot(); +$welcomepage->foot(); diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -82,8 +82,8 @@ if (!empty($_REQUEST['selectschool']) ?>

School Selection

- Choose the school you attend from the list below. If you cannot - find your school, you may proceed using + Choose the school you attend from the list below. If you cannot + find your school, you may proceed using the generic settings.

@@ -102,7 +102,7 @@ if (!empty($_REQUEST['selectschool'])

diff --git a/process.php b/process.php --- a/process.php +++ b/process.php @@ -24,7 +24,7 @@ include_once 'class.schedule.php'; include_once 'class.class.php'; include_once 'class.section.php'; -// Converts a 5-element array into a nice string. +// Converts a 5-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 = ''; diff --git a/todo.php b/todo.php --- a/todo.php +++ b/todo.php @@ -19,25 +19,17 @@ */ include_once 'inc/class.page.php'; - $mypage = new page('TODO'); + $todopage = new page('TODO'); ?>

Items to Consider:

    -
  • Add place to put prof name
  • Autoincrement section num/letter/custom labels
  • -
  • Make output and print output formatting look nicer
  • -
  • Make printing work for saved jobs where jobkey != 0
  • -
  • After selecting a start time, set the end time to one hour after the start time
  • Append sections
  • -
  • Move the add class button to somewhere nicer, maybe a gray row at the bottom. Make the submit button more obvious.
  • Form validation to ensure endtime is after starttime, at least one day is checked.
  • -
  • Auto-populate form based on saved schedule?
  • - -
  • Grab data from school sites such as this?
foot(); +$todopage->foot();