diff --git a/process.php b/process.php new file mode 100644 --- /dev/null +++ b/process.php @@ -0,0 +1,104 @@ + 1){ + for($i=0; $i<=4; $i++) { + if(isset($array[$i]) && $array[$i] == $key){ + $outString .= $days[$i]; + if($pretty) + $outString .= ', '; + } + } + if($pretty){ + $outString = substr($outString,0,strlen($outString) - 2); // Remove last comma and space + $outString = substr($outString,0, strrpos( $outString, ' ')) . ' and' . substr($outString, strrpos( $outString, ' '), strlen($outString)); + } + } + else { + for($i=0; $i<=4; $i++) + if(isset($array[$i])) + $outString = $days[$i]; + } + return $outString; +} + +function prettyTime($time){ + return substr($time,0,strlen($time)-2) . ":" . substr($time,strlen($time)-2, strlen($time)); +} + +$DEBUG = false; +if(isset($_GET['debug'])) + $DEBUG = $_GET['debug']; + +if(!$DEBUG){ + + + $allClasses = new Schedule("Fall 2010"); + + foreach(sortInputs($_POST) as $class) + { + $allClasses->addClass($class['name']); + + foreach($class as $section) + if(is_array($section)) // Skip the name, which isn't a section + { + $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays($section['days'])); + } + } + $allClasses->findPossibilities(); + $allClasses->writeoutTables(); + if(!isset($_SESSION['saved'])) + $_SESSION['saved'] = array(); + array_push ( $_SESSION['saved'], $allClasses ); + $_SESSION['meh'] = "MEH!"; + +} else { + + + echo '
DEBUG OUTPUT:'; + + +} + +?> \ No newline at end of file
'; + foreach(sortInputs($_POST) as $class) { + echo 'Class: ' . $class['name'] . '
'; + foreach($class as $section) + if(is_array($section)) + { + echo '---- Section that starts at ' . prettyTime($section['start']) . ' and ends at ' . prettyTime($section['end']) . '. This class meets on '; + echo arrayToDays($section['days'],'long',true) . '.
'; + } + echo '
'; + } + echo '