Changeset - 8a7d392478a6
[Not reviewed]
default
0 2 0
ethanzonca - 15 years ago 2010-07-09 00:10:06

Added saved schedules functionality
2 files changed with 26 insertions and 21 deletions:
0 comments (0 inline, 0 general)
input.php
Show inline comments
 
@@ -232,8 +232,8 @@
 
<p>
 
<?php
 
if(isset($_SESSION['saved']))
 
	foreach($_SESSION['saved'] as $schedule)
 
		echo "Saved Schedule<br />";
 
	foreach($_SESSION['saved'] as $key => $schedule)
 
		echo "<a href=\"process.php?savedkey=$key\">Saved Schedule $key</a><br />";
 
else
 
	echo "No saved schedules!<br />";
 
?>
process.php
Show inline comments
 
@@ -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
 
?>
0 comments (0 inline, 0 general)