Changeset - 7c7e7468078f
[Not reviewed]
default
0 2 0
ethanzonca - 15 years ago 2010-07-14 00:34:15

Fixed things up, js works now, still need cleanup
2 files changed with 33 insertions and 52 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -26,18 +26,20 @@ class page {
 
				</script>'; // Google analytics ga.js tracking code
 

	
 
  private $title = ''; // Title of page
 
  private $scripts = ''; // Scripts to include on page
 
  private $scripts = array(); // Scripts to include on page
 

	
 
  public function __construct($ntitle, $nscripts = ''){
 
    $this->title = $ntitle;
 
    $this->scripts .= $nscripts;
 
  public function __construct($ntitle, $nscripts = array() ){
 
    // Scripts and styles available to include
 
    $this->headCode['jQuery'] = '<script src="http://www.google.com/jsapi"></script><script type="text/javascript" charset="utf-8"> google.load("jquery", "1.3.2"); google.load("jqueryui", "1.7.2");</script>';
 
    $this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
 
    $this->headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
 
  
 
   $this->title = $ntitle;
 
    $this->scripts = $nscripts;
 
    if($ntitle != "NOHEAD")
 
      $this->head();
 

	
 
    $headCode['jquery'] = '<script src="http://www.google.com/jsapi"></script><script type="text/javascript" charset="utf-8"> google.load("jquery", "1.3.2"); google.load("jqueryui", "1.7.2");</script>';
 
    $headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
 
    $headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
 
  }
 
 }
 

	
 
  private function top(){
 
    echo '<div id="header">
 
@@ -59,8 +61,9 @@ class page {
 
           <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8">';
 

	
 
    // Write out all passed scripts
 
    foreach ($this->scripts as $script)
 
    	echo $headCode[$script];
 
    foreach ($this->scripts as $i){
 
    	echo $this->headCode["$i"];
 
    }
 

	
 
    echo '</head>
 
	  <body '.$this->bodyargs.' >';
 
@@ -86,6 +89,19 @@ class page {
 
      return $ret;
 
  }
 

	
 
  public function showSavedScheds($session) {
 
       echo '<p>';
 
	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>';
 
	}
 
       echo '</p>';
 
}
 

	
 
}
 

	
 
?>
 
\ No newline at end of file
input.php
Show inline comments
 
<?php 
 

	
 
session_start();
 

	
 
include_once 'errors.php';
 
include_once 'class.schedule.php';
 
include_once 'class.class.php';
 
include_once 'class.section.php';
 
include_once 'inc/class.page.php';
 

	
 
$scripts = array('jquery','jValidate','schedInput');
 
$scripts = array('jQuery','jValidate','schedInput');
 
$inputPage = new page('Scheduler', $scripts);
 
$inputPage->showSavedScheds($_SESSION);
 

	
 
?>
 

	
 
<p>
 

	
 
<?
 
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>
 

	
 
<form method="post" action="process.php" id="scheduleForm">
 

	
 
<table id="jsrows">
 
	<tr>
 
		<td colspan="11" style="padding-bottom:2em;"><input id="scheduleName" class="defText" type="text" class="required" title="Schedule Name" name="postData[name]" />
 
@@ -36,7 +20,7 @@ if(isset($_SESSION['saved']) && count($_
 
		</td>
 
	</tr>
 

	
 
<!-- Header -->
 
	<!-- Header -->
 
	<tr>
 
		<td>Class</td>
 
		<td class="center">Letter</td>
 
@@ -53,36 +37,17 @@ if(isset($_SESSION['saved']) && count($_
 
</table>
 

	
 
<div class="paddingtop" id="classage"><input type="button" value="Add class" /></div>
 

	
 
<div class="paddingtop"><input style="float:left;" type="submit" value="Submit" /></div>
 

	
 
<p>
 
	<br />
 
</p>
 

	
 
<div class="paddingtop" id="reset"><input style="float:left;" type="button" value="Reset" /></div>
 

	
 
</form>
 

	
 
<p>
 
	&nbsp;
 
	<br />
 
</p>
 
<p>&nbsp;<br /></p>
 

	
 
<h3>TODO:</h3>
 

	
 
<ul>
 
	<li>Form validation to ensure endtime is after starttime, at least one day is checked.</li>
 
	<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>Is there some way to automatically populate the fields when a user clicks on a saved schedule?
 
		This would probably be very useful, in the case that the individual would like to edit a saved
 
		schedule. Right now, it is only possible to edit the most previous schedule using the back button
 
		in the browser and this still requires the user to add the classes and schedules (although they
 
		already populated as soon as they are added).</li>
 
	<li>Auto-populate form based on saved schedule?</li>
 
</ul>
 

	
 
<?
 
$inputPage->foot();
 
?>
 
\ No newline at end of file
 
<? $inputPage->foot(); ?>
 
\ No newline at end of file
0 comments (0 inline, 0 general)