Changeset - f13987338fbf
[Not reviewed]
default
0 3 1
ethanzonca - 15 years ago 2010-07-10 01:07:39

Added getName() to schedule, made friendly saved schedule listing. Todo: Icon needs to be smaller, layout needs to be nicer.
4 files changed with 48 insertions and 16 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -30,7 +30,15 @@ class Schedule
 
        $this->nclasses = 0;
 
        $this->scheduleName = $n; 
 
    }
 
    
 

	
 
	//--------------------------------------------------
 
	// Mutators and Accessors
 
	//--------------------------------------------------
 
	public function getName()
 
	{
 
		return $this->scheduleName;
 
	}    
 

	
 
	//--------------------------------------------------
 
	// Adds a new class to the schedule.
 
	//--------------------------------------------------
images/close.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
input.php
Show inline comments
 
<?php session_start() ?>
 
<?php 
 

	
 
session_start();
 

	
 
include_once 'errors.php';
 
include_once 'class.schedule.php';
 
include_once 'class.class.php';
 
include_once 'class.section.php';
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html>
 
<head>
 
@@ -9,6 +17,14 @@
 
		margin:auto;
 
		font-family: sans-serif;
 
	}
 
	#savedBox {
 
		width: 15em;
 
		padding: 1em;
 
		border: 1px solid #000;
 
		float:right;
 
		background: #DDD;
 
		font-size: .8em;
 
	}
 
	#header {
 
		text-align: left;
 
		background: rgb(220,220,220); /* IE fallback */
 
@@ -218,6 +234,10 @@
 
		jQuery('#scheduleForm').resetForm();
 
    });
 

	
 
	jQuery('#scheduleName').hover(function() {
 
		jQuery(this).val('');
 
	});
 

	
 
});
 

	
 
</script>
 
@@ -235,17 +255,17 @@
 
</div>
 

	
 
<div id="content">
 
	<h3>
 
		Saved Schedules:
 
	</h3>
 
	<p>
 

	
 
<?php
 
if(isset($_SESSION['saved']))
 
	foreach($_SESSION['saved'] as $key => $schedule)
 
		echo "<a href=\"process.php?savedkey=$key\">Saved Schedule $key</a><br />";
 
else
 
	echo "No saved schedules!<br />";
 
<?
 
if(isset($_SESSION['saved']) && count($_SESSION['saved']) > 0){
 
	echo '<div id="savedBox" ><h3>Saved Schedules:</h3>';
 
	foreach($_SESSION['saved'] as $key => $schedule){
 
		$sch = unserialize($schedule);
 
		echo "<a href=\"process.php?savedkey=$key\">#" . ($key + 1) . " - " . $sch->getName() . "</a> <em><a href=\"process.php?delsaved=$key\"><img src=\"images/close.png\" style=\"border:0;\" /></a></em><br />";
 
	}
 
	echo '</div>';
 
}
 
?>
 

	
 
	</p>
 
@@ -253,10 +273,9 @@ else
 
<form method="post" action="process.php" id="scheduleForm">
 

	
 
<table id="jsrows">
 
	<tr id="namecol">
 
		<td colspan="11">Name this schedule:
 
			<input type="text" class="required" name="postData[name]" />
 
			(For example: Fall <?php echo Date("Y"); ?>)
 
	<tr>
 
		<td colspan="11" style="padding-bottom:2em;"><input id="scheduleName" type="text" class="required" value="Schedule Name" name="postData[name]" />
 
			<em>(For example: Fall <?php echo Date("Y"); ?>)</em>
 
		</td>
 
	</tr>
 

	
 
@@ -300,7 +319,6 @@ else
 
	<li>Check the saved schedule function. After input my default schedule, the output was the same
 
		as that of the demo. However, when I went back and clicked the "Saved Schedule 0" link, there 
 
		were then 48 possible schedules. It seems that the classes were added twice for some reason.</li>
 
	<li>Attempted to add schedule name field but was unsure of where to send the variable.</li>
 
</ul>
 

	
 
</div>
process.php
Show inline comments
 
@@ -67,6 +67,12 @@ if(!$DEBUG){
 
                $savedSched->findPossibilities();
 
		$savedSched->writeoutTables();
 
	}
 
	else if(isset($_GET['delsaved'])){
 
		$_SESSION['saved'][$_GET['delsaved']] = '';
 
		$_SESSION['saved'] = array_filter($_SESSION['saved']); // Remove null entries
 
              header( 'Location: input.php' ) ;
 

	
 
	}
 
	else{
 
		$allClasses = new Schedule($_POST['postData']['name']);
 
	
0 comments (0 inline, 0 general)