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 11 insertions and 6 deletions:
0 comments (0 inline, 0 general)
input.php
Show inline comments
 
@@ -229,14 +229,14 @@
 
</div>
 
<div id="content">
 
<h3>Saved Schedules:</h3>
 
<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 />";
 
?>
 
</p>
 

	
 
<form method="post" action="process.php" id="scheduleForm">
process.php
Show inline comments
 
@@ -59,13 +59,18 @@ function prettyTime($time){
 
$DEBUG = false;
 
if(isset($_GET['debug']))
 
	$DEBUG = $_GET['debug'];
 

	
 
if(!$DEBUG){
 

	
 

	
 
	if(isset($_GET['savedkey'])){
 
		$savedSched = unserialize($_SESSION['saved'][$_GET['savedkey']]);
 
                $savedSched->findPossibilities();
 
		$savedSched->writeoutTables();
 
	}
 
	else{
 
	$allClasses = new Schedule("Fall 2010");
 

	
 
	foreach(sortInputs($_POST) as $class)
 
	{
 
		$allClasses->addClass($class['name']);
 

	
 
@@ -76,14 +81,14 @@ if(!$DEBUG){
 
			}
 
	}
 
	$allClasses->findPossibilities();
 
	$allClasses->writeoutTables();
 
	if(!isset($_SESSION['saved']))
 
		$_SESSION['saved'] = array();
 
	array_push ( $_SESSION['saved'], $allClasses );
 
	$_SESSION['meh'] = "MEH!";
 
		array_push ( $_SESSION['saved'], serialize($allClasses));
 
	}
 

	
 
} else {
 

	
 

	
 
	echo '<pre>DEBUG OUTPUT: <br /><br />';
 
	foreach(sortInputs($_POST) as $class) {
 
@@ -98,7 +103,7 @@ if(!$DEBUG){
 
	}
 
	echo '</pre>';
 

	
 

	
 
}
 

	
 
?>
 
\ No newline at end of file
 
?>
0 comments (0 inline, 0 general)