# HG changeset patch # User ethanzonca # Date 2010-07-09 00:10:06 # Node ID 8a7d392478a6ad7e4f20a70fe9a7a8aa72c6b92f # Parent b2ac49a7e169998d3939b9b3e13b27cf78c46662 Added saved schedules functionality diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -232,8 +232,8 @@

"; + foreach($_SESSION['saved'] as $key => $schedule) + echo "Saved Schedule $key
"; else echo "No saved schedules!
"; ?> diff --git a/process.php b/process.php --- a/process.php +++ b/process.php @@ -62,25 +62,30 @@ if(isset($_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'])); - } + if(isset($_GET['savedkey'])){ + $savedSched = unserialize($_SESSION['saved'][$_GET['savedkey']]); + $savedSched->findPossibilities(); + $savedSched->writeoutTables(); } - $allClasses->findPossibilities(); - $allClasses->writeoutTables(); - if(!isset($_SESSION['saved'])) - $_SESSION['saved'] = array(); - array_push ( $_SESSION['saved'], $allClasses ); - $_SESSION['meh'] = "MEH!"; + else{ + $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'], serialize($allClasses)); + } } else { @@ -101,4 +106,4 @@ if(!$DEBUG){ } -?> \ No newline at end of file +?>