Changeset - 1a11bfb5181e
[Not reviewed]
default
0 4 0
ethanzonca - 15 years ago 2010-09-23 21:17:08

Made output use the page class
4 files changed with 38 insertions and 14 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -8,12 +8,13 @@
 
// all the possible permutations.
 
//**************************************************
 

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

	
 
class Schedule
 
{
 
    private $classStorage;			// Classes array of classes
 
    private $nclasses;				// Integer number of classes
 
    private $nPermutations = 0;		// Integer number of real permutations
 
@@ -206,15 +207,16 @@ class Schedule
 
		$W = -1;
 
		$Th = -1;
 
		$F = -1;
 
		$filled = false;
 
		$time = array(700,730,800,830,900,930,1000,1030,1100,1130,1200,1230,1300,1330,1400,1430,1500,1530,1600,1630,1700,1730,1800,1830,1900,1930,2000,2030,2100,2130, 2200);
 

	
 

	
 
		// Reminder:
 
		// border-style:top right bottom left
 
		$header .= "<html><head><title>" . $this->getName() . " :: " . $this->title . "</title>\n\n<style type=\"text/css\">".
 
		/* $header .= "<html><head><title>" . $this->getName() . " :: " . $this->title . "</title>\n\n<style type=\"text/css\">".
 
				"\n.top{\n\tborder-style:solid solid none solid;\nbackground-color:#dddddd;\n}".
 
				"\n.mid{\n\tborder-style:none solid none solid;\nbackground-color:#dddddd;\n}".
 
				"\n.end{\n\tborder-style:none solid solid solid;\nbackground-color:#dddddd;\n}".
 
				"\n.none{\n\tborder-style:none;\n}".
 
				"\n.single{\n\tborder-style:solid;\n\tbackground-color:#dddddd;\n}".
 
				"\ntd{\n\ttext-align:center;\nwidth:7em;\n}".
 
@@ -235,22 +237,39 @@ class Schedule
 
			"\n<script src=\"scripts/prototype.js\" type=\"text/javascript\" charset=\"utf-8\"></script>". 
 
			"\n<script src=\"scripts/effects.js\" type=\"text/javascript\" charset=\"utf-8\"></script>".
 
			"\n<script src=\"scripts/glider.js\" type=\"text/javascript\" charset=\"utf-8\"></script>".
 
			
 
			"\n</head><body>".
 

	
 
			"<p>There were a total of " . $this->possiblePermutations . " possible permutations. Only " . $this->nPermutations . " permutations had no class conflicts.</p>".
 
			
 

	
 
			"\n\n<div id=\"header\">\n<h1><em>SlatePermutate</em> - Scheduler</h1><h3>Schedule name: " . $this->getName() . "</h3>\n</div><div id=\"content\">".
 

	
 
			"\n\n<div id=\"header\">\n<h1><em>SlatePermutate</em> - Scheduler</h1><h3>Schedule name: " . $this->getName() . "</h3>\n</div><div id=\"content\">";
 
			*/
 
		$headcode = array('outputStyle', 'gliderHeadcode');
 
		$outputPage = new page($this->getName(), $headcode);
 

	
 

	
 

	
 

	
 

	
 

	
 
			
 
		$footer .="</div></div><script type=\"text/javascript\" charset=\"utf-8\">". 
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 
		echo "<p>There were a total of " . $this->possiblePermutations . " possible permutations. Only " . $this->nPermutations . " permutations had no class conflicts.</p>";
 
			
 
		$footcloser .="</div></div><script type=\"text/javascript\" charset=\"utf-8\">". 
 
			"\n\tvar my_glider = new Glider('my-glider', {duration:0});".
 
			"\n</script>\n\n</div><div id=\"footer\">\n<h5>&copy; " . Date("Y") . " <a href=\"http://protofusion.org/~nathang/\">Nathan Gelderloos</a><br />".
 
			"\nwith special thanks to <a href=\"http://ethanzonca.com\">Ethan Zonca</a></h5>\n</div>";
 
			"\n</script>";
 

	
 
		$footer .="\n\n</body></html>";
 

	
 
		if($this->nPermutations > 0)
 
		{
 
			$table .= "<div id=\"my-glider\"><div class=\"controls\">";
 
			
 
			for($nn = 1; $nn <= $this->nPermutations; $nn++)
 
@@ -501,16 +520,17 @@ class Schedule
 
				}
 

	
 
				// End of table
 
				$table .= "</table></div>";
 
			}
 

	
 
			echo $header . $table . $footer;   
 
			echo $table . $footcloser;   
 
		} else {
 
			echo '<html><body><p>There are no possible schedules. Please try again.</p></body></html>';
 
		}
 
		$outputPage->foot();
 
	}
 

	
 
	//--------------------------------------------------
 
	// Changes the title of the page.
 
	//--------------------------------------------------
 
	function changeTitle($t)
 
@@ -530,7 +550,7 @@ class Schedule
 
			return substr($t, 0, strlen($t)-2) . ":" . substr($t, strlen($t)-2, strlen($t)) . " AM";
 
		}
 
	}
 

	
 
}
 

	
 
?>
 
\ No newline at end of file
 
?>
inc/class.page.php
Show inline comments
 
@@ -22,31 +22,33 @@ class page {
 
				    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
 
				    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
 
				    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
 
				  })();
 
				</script>'; // Google analytics ga.js tracking code
 

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

	
 
  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->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8">'; 
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8"><script src="scripts/prototype.js" type="text/javascript" charset="utf-8"></script><script src="scripts/effects.js" type="text/javascript" charset="utf-8"></script><script src="scripts/glider.js" type="text/javascript" charset="utf-8"></script>'; 
 
  
 
   $this->title = $ntitle;
 
   $this->pagetitle = $ntitle;
 
    $this->scripts = $nscripts;
 
    if($ntitle != "NOHEAD")
 
      $this->head();
 

	
 
 }
 

	
 
  private function top(){
 
    echo '<div id="header">
 
          <h1><em>SlatePermutate</em> -  Scheduler</h1>
 
          <h1><em>SlatePermutate</em> - '.$this->pagetitle.'</h1>
 
          </div>
 
          <div id="content">';
 
  }
 

	
 
// Public functions/vars
 

	
 
@@ -54,13 +56,13 @@ class page {
 
    session_start();
 
    $this->pageGenTime = round(microtime(), 3);
 

	
 
    echo '<!DOCTYPE ' . $this->doctype . '>
 
	  <html ' . $this->htmlargs . '>
 
	  <head>
 
	    <title>' . $this->title . ' :: ' . $this->base_title . '</title>
 
	    <title>' . $this->pagetitle . ' :: ' . $this->base_title . '</title>
 
           <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8">';
 

	
 
    // Write out all passed scripts
 
    foreach ($this->scripts as $i){
 
    	echo $this->headCode["$i"];
 
    }
 
@@ -101,7 +103,7 @@ class page {
 
	}
 
       echo '</p>';
 
}
 

	
 
}
 

	
 
?>
 
\ No newline at end of file
 
?>
input.php
Show inline comments
 
@@ -47,10 +47,11 @@ include_once 'inc/class.page.php';
 

	
 
<h3>TODO:</h3>
 

	
 
<ul>
 
	<li>Form validation to ensure endtime is after starttime, at least one day is checked.</li>
 
	<li>Auto-populate form based on saved schedule?</li>
 
        <li>Grab data from school sites such as <a href="http://www.cedarville.edu/courses/schedule/2010fa_be_bebl.htm" target="_blank">this?</a></li>
 
</ul>
 

	
 
<?php
 
$inputPage->foot();
styles/general.css
Show inline comments
 
@@ -51,6 +51,7 @@
 
		float:left;
 
	}
 
	.paddingtop {
 
		padding: .5em;
 
		padding-top: .8em;
 
	}
 

	
0 comments (0 inline, 0 general)