Changeset - 6b2333baf9c2
[Not reviewed]
Merge default
0 3 0
ethanzonca - 15 years ago 2010-10-01 21:53:37

Merge
3 files changed with 697 insertions and 698 deletions:
0 comments (0 inline, 0 general)
class.class.php
Show inline comments
 
@@ -11,79 +11,78 @@ include_once 'class.section.php';
 

	
 
class Classes
 
{
 
	private $name;		// String
 
    private $sections;	// Array of sections
 
    private $nsections;	// int
 
  private $name;		// String
 
  private $sections;	// Array of sections
 
  private $nsections;	// int
 
    
 
	//--------------------------------------------------
 
	// Creates a class with the given name.
 
	//--------------------------------------------------
 
    function __construct($n)
 
    {
 
		$this->name = $n;
 
        $this->nsections = 0;
 
    }
 
	
 
	//--------------------------------------------------
 
	// Adds a new section to the class.
 
	//--------------------------------------------------
 
    function addSection($l, $p, $s, $e, $d)
 
    {
 
        $this->sections[$this->nsections] = new Section($l, $p, $s, $e, $d);
 
        $this->nsections++;
 
    }
 
  //--------------------------------------------------
 
  // Creates a class with the given name.
 
  //--------------------------------------------------
 
  function __construct($n)
 
  {
 
    $this->name = $n;
 
    $this->nsections = 0;
 
  }
 
	
 
	//--------------------------------------------------
 
    // Returns the number of sections in the class.
 
	//--------------------------------------------------
 
    function getnsections()
 
    {
 
        return $this->nsections;
 
    }
 
  //--------------------------------------------------
 
  // Adds a new section to the class.
 
  //--------------------------------------------------
 
  function addSection($l, $p, $s, $e, $d)
 
  {
 
    $this->sections[$this->nsections] = new Section($l, $p, $s, $e, $d);
 
    $this->nsections++;
 
  }
 
	
 
	//--------------------------------------------------
 
	// Returns the desired section for analysis.
 
	//--------------------------------------------------
 
    function getSection($i)
 
    {
 
		// Checks to make sure the desired section is part of the set.
 
        if(isset($this->sections[$i]))
 
		{
 
			//echo "Object sections[$i] was set<br />";
 
        } else {
 
            echo "Object sections[$i] was NOT set <br />";
 
		}
 

	
 
        $result = $this->sections[$i];
 
        return $result;
 
    }
 
    
 
	//--------------------------------------------------
 
	// Returns the name of the class.
 
	//--------------------------------------------------
 
    function getName()
 
    {
 
        return $this->name;
 
  //--------------------------------------------------
 
  // Returns the number of sections in the class.
 
  //--------------------------------------------------
 
  function getnsections()
 
  {
 
    return $this->nsections;
 
  }
 
	
 
  //--------------------------------------------------
 
  // Returns the desired section for analysis.
 
  //--------------------------------------------------
 
  function getSection($i)
 
  {
 
    // Checks to make sure the desired section is part of the set.
 
    if(isset($this->sections[$i]))
 
      {
 
	//echo "Object sections[$i] was set<br />";
 
      } else {
 
      echo "Object sections[$i] was NOT set <br />";
 
    }
 

	
 
    /**
 
     * \brief
 
     *   Renders this Classes into something suitable for input.php.
 
     */
 
    function input_form_render($class_key)
 
    {
 
      $n = "\n";
 
      $out = '<tr title="' . $class_key . '" class="class class' . $class_key . '">' . $n
 
	. '  <td><input type="text" class="required defText" title="Class Name" name="postData[' . $class_key . '][name]" value="' . str_replace('"', '&quot;', $this->getName()) . '"/></td>' . $n
 
	. '  <td colspan="8"></td>' . $n
 
	. '  <td class="tdInput"><div class="addSection"><input type="button" value="Add section" /></div></td>' . $n
 
	. '  <td class="tdInput"><div class="deleteClass"><input type="button" value="Remove" /></div></td>' . $n
 
	. "</tr>\n";
 
    $result = $this->sections[$i];
 
    return $result;
 
  }
 
    
 
  //--------------------------------------------------
 
  // Returns the name of the class.
 
  //--------------------------------------------------
 
  function getName()
 
  {
 
    return $this->name;
 
  }
 

	
 
      foreach ($this->sections as $key => $section)
 
	$out .= $section->input_form_render($class_key, $key);
 
  /**
 
   * \brief
 
   *   Renders this Classes into something suitable for input.php.
 
   */
 
  function input_form_render($class_key)
 
  {
 
    $n = "\n";
 
    $out = '<tr title="' . $class_key . '" class="class class' . $class_key . '">' . $n
 
      . '  <td><input type="text" class="required defText" title="Class Name" name="postData[' . $class_key . '][name]" value="' . str_replace('"', '&quot;', $this->getName()) . '"/></td>' . $n
 
      . '  <td colspan="8"></td>' . $n
 
      . '  <td class="tdInput"><div class="addSection"><input type="button" value="Add section" /></div></td>' . $n
 
      . '  <td class="tdInput"><div class="deleteClass"><input type="button" value="Remove" /></div></td>' . $n
 
      . "</tr>\n";
 

	
 
      return $out;
 
    }
 
    foreach ($this->sections as $key => $section)
 
      $out .= $section->input_form_render($class_key, $key);
 

	
 
    return $out;
 
  }
 
}
class.schedule.php
Show inline comments
 
@@ -15,624 +15,623 @@ 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
 
    private $possiblePermutations;	// Integer number of possible permutations
 
    private $scheduleName;			// String name of schedule
 
    private $storage;				// Integer array of valid schedules
 
    private $title;
 
    /**
 
     * The input format of the sections. Only used for the UI. Valid
 
     * values are 'numerous' for custom, 'numbered' for numeric, and 'lettered' for
 
     * alphabetical.
 
     */
 
    public $section_format;
 
  private $classStorage;			// Classes array of classes
 
  private $nclasses;				// Integer number of classes
 
  private $nPermutations = 0;		// Integer number of real permutations
 
  private $possiblePermutations;	// Integer number of possible permutations
 
  private $scheduleName;			// String name of schedule
 
  private $storage;				// Integer array of valid schedules
 
  private $title;
 
  /**
 
   * The input format of the sections. Only used for the UI. Valid
 
   * values are 'numerous' for custom, 'numbered' for numeric, and 'lettered' for
 
   * alphabetical.
 
   */
 
  public $section_format;
 

	
 
    /**
 
     * \brief
 
     *   Create a schedule with the given name.
 
     */
 
    function __construct($name)
 
    {
 
      $this->classStorage = array();
 
      $this->nclasses = 0;
 
      $this->scheduleName = $name;
 
      $this->storage = array();
 
      $this->title = "SlatePermutate - Scheduler";
 
      $this->section_format = 'numerous';
 
    }
 
  /**
 
   * \brief
 
   *   Create a schedule with the given name.
 
   */
 
  function __construct($name)
 
  {
 
    $this->classStorage = array();
 
    $this->nclasses = 0;
 
    $this->scheduleName = $name;
 
    $this->storage = array();
 
    $this->title = "SlatePermutate - Scheduler";
 
    $this->section_format = 'numerous';
 
  }
 

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

	
 
	//--------------------------------------------------
 
	// Adds a new class to the schedule.
 
	//--------------------------------------------------
 
	function addClass($n)
 
    {
 
        $this->classStorage[$this->nclasses] = new Classes($n);
 
        $this->nclasses++;
 
    }
 
  //--------------------------------------------------
 
  // Adds a new class to the schedule.
 
  //--------------------------------------------------
 
  function addClass($n)
 
  {
 
    $this->classStorage[$this->nclasses] = new Classes($n);
 
    $this->nclasses++;
 
  }
 

	
 
	//--------------------------------------------------
 
	// Adds a section to the desired class.
 
	//--------------------------------------------------
 
    function addSection($n, $l, $s, $e, $d)
 
    {
 
        $found = false;
 
        $counter = 0;
 
  //--------------------------------------------------
 
  // Adds a section to the desired class.
 
  //--------------------------------------------------
 
  function addSection($n, $l, $s, $e, $d)
 
  {
 
    $found = false;
 
    $counter = 0;
 
      
 
        while(!$found && ($counter < $this->nclasses))
 
        {
 
			$temp = $this->classStorage[$counter]->getName();
 
    while(!$found && ($counter < $this->nclasses))
 
      {
 
	$temp = $this->classStorage[$counter]->getName();
 
			
 
			if((strcmp($temp,$n)) == 0)
 
            {
 
				$found = true;
 
            } else {
 
				$counter++;
 
			}
 
		}
 
	if((strcmp($temp,$n)) == 0)
 
	  {
 
	    $found = true;
 
	  } else {
 
	  $counter++;
 
	}
 
      }
 
		
 
		if($counter == $this->nclasses)
 
		{
 
			echo "Could not find class: " . $n . "<br />";
 
        } else {
 
			$p = "unknown prof";
 
            $this->classStorage[$counter]->addSection($l, $p, $s, $e, $d);
 
        }
 
    if($counter == $this->nclasses)
 
      {
 
	echo "Could not find class: " . $n . "<br />";
 
      } else {
 
      $p = "unknown prof";
 
      $this->classStorage[$counter]->addSection($l, $p, $s, $e, $d);
 
    }
 
  }
 

	
 
	//--------------------------------------------------
 
	// Finds all of the possible permutations and stores
 
	// the results in the storage array.
 
	//--------------------------------------------------
 
	function findPossibilities()
 
	{
 
	  $this->possiblePermutations = 1;
 
	  /* special case: there is nothing entered into the schedule and thus there is one, NULL permutation */
 
	  if (!$this->nclasses)
 
	    {
 
	      /* have an empty schedule */
 
	      $this->classStorage[0] = array();
 
	      $this->nPermutations = 1;
 
	      return;
 
	    }
 
  //--------------------------------------------------
 
  // Finds all of the possible permutations and stores
 
  // the results in the storage array.
 
  //--------------------------------------------------
 
  function findPossibilities()
 
  {
 
    $this->possiblePermutations = 1;
 
    /* special case: there is nothing entered into the schedule and thus there is one, NULL permutation */
 
    if (!$this->nclasses)
 
      {
 
	/* have an empty schedule */
 
	$this->classStorage[0] = array();
 
	$this->nPermutations = 1;
 
	return;
 
      }
 

	
 
		$position = 0;
 
		$counter = 0;
 
    $position = 0;
 
    $counter = 0;
 

	
 
        for($i = 0; $i < $this->nclasses; $i++)
 
        {
 
			$this->possiblePermutations = $this->possiblePermutations * $this->classStorage[$i]->getnsections();
 
			$cs[$i] = 0;	// Sets the counter array to all zeroes.
 
        }
 
    for($i = 0; $i < $this->nclasses; $i++)
 
      {
 
	$this->possiblePermutations = $this->possiblePermutations * $this->classStorage[$i]->getnsections();
 
	$cs[$i] = 0;	// Sets the counter array to all zeroes.
 
      }
 
        
 
		// Checks for conflicts in given classes, stores if none found
 
        do
 
        {
 
			$conflict = false;
 
			$upCounter = 0;
 
    // Checks for conflicts in given classes, stores if none found
 
    do
 
      {
 
	$conflict = false;
 
	$upCounter = 0;
 
         
 
			// Get first class to compare
 
			while($upCounter < $this->nclasses)
 
			{
 
				$downCounter = $this->nclasses-1;
 
				while($downCounter > $upCounter)
 
				{
 
					$start1 = $this->classStorage[$upCounter]->getSection($cs[$upCounter])->getStartTime();
 
					$end1 = $this->classStorage[$upCounter]->getSection($cs[$upCounter])->getEndTime();
 
					$start2 = $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getStartTime();
 
					$end2 = $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getEndTime();
 
	// Get first class to compare
 
	while($upCounter < $this->nclasses)
 
	  {
 
	    $downCounter = $this->nclasses-1;
 
	    while($downCounter > $upCounter)
 
	      {
 
		$start1 = $this->classStorage[$upCounter]->getSection($cs[$upCounter])->getStartTime();
 
		$end1 = $this->classStorage[$upCounter]->getSection($cs[$upCounter])->getEndTime();
 
		$start2 = $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getStartTime();
 
		$end2 = $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getEndTime();
 
					
 
					// If the two times overlap, then check if days overlap.
 
					if(!$conflict && ((($start1 >= $start2) && ($start1 <= $end2)) || (($start2 >= $start1) && ($start2 <= $end1))))
 
					{
 
						// Monday
 
						if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getM() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getM()))
 
						{
 
							$conflict = true;
 
						}
 
		// If the two times overlap, then check if days overlap.
 
		if(!$conflict && ((($start1 >= $start2) && ($start1 <= $end2)) || (($start2 >= $start1) && ($start2 <= $end1))))
 
		  {
 
		    // Monday
 
		    if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getM() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getM()))
 
		      {
 
			$conflict = true;
 
		      }
 
						
 
						// Tuesday
 
						if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getTu() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getTu()))
 
						{
 
							$conflict = true;
 
						}
 
		    // Tuesday
 
		    if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getTu() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getTu()))
 
		      {
 
			$conflict = true;
 
		      }
 
						
 
						// Wednesday
 
						if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getW() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getW()))
 
						{
 
							$conflict = true;
 
						}
 
		    // Wednesday
 
		    if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getW() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getW()))
 
		      {
 
			$conflict = true;
 
		      }
 
						
 
						// Thursday
 
						if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getTh() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getTh()))
 
						{
 
							$conflict = true;
 
						}
 
		    // Thursday
 
		    if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getTh() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getTh()))
 
		      {
 
			$conflict = true;
 
		      }
 
						
 
						// Friday
 
						if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getF() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getF()))
 
						{
 
							$conflict = true;
 
						}
 
					}
 
		    // Friday
 
		    if(!$conflict && ($this->classStorage[$upCounter]->getSection($cs[$upCounter])->getF() == $this->classStorage[$downCounter]->getSection($cs[$downCounter])->getF()))
 
		      {
 
			$conflict = true;
 
		      }
 
		  }
 
               
 
					$downCounter--;
 
				}
 
		$downCounter--;
 
	      }
 
				
 
				$upCounter++;
 
            }
 
	    $upCounter++;
 
	  }
 
            
 
			// Store to storage if no conflict is found.
 
			if(!$conflict)
 
			{
 
				for($i = 0; $i < $this->nclasses; $i++)
 
				{
 
					$this->storage[$this->nPermutations][$i] = $cs[$i];
 
				}
 
				$this->nPermutations++;
 
			}
 
	// Store to storage if no conflict is found.
 
	if(!$conflict)
 
	  {
 
	    for($i = 0; $i < $this->nclasses; $i++)
 
	      {
 
		$this->storage[$this->nPermutations][$i] = $cs[$i];
 
	      }
 
	    $this->nPermutations++;
 
	  }
 
			
 
			// Increase the counter by one to get the next combination of class sections.
 
			$cs[$position] = $cs[$position] + 1;
 
	// Increase the counter by one to get the next combination of class sections.
 
	$cs[$position] = $cs[$position] + 1;
 
			
 
			// Check to make sure the counter is still valid.
 
			$valid = false;
 
			while(!$valid)
 
			{
 
				if($cs[$position] == $this->classStorage[$position]->getnsections())
 
				{
 
					$cs[$position] = 0;
 
	// Check to make sure the counter is still valid.
 
	$valid = false;
 
	while(!$valid)
 
	  {
 
	    if($cs[$position] == $this->classStorage[$position]->getnsections())
 
	      {
 
		$cs[$position] = 0;
 

	
 
					$position++;
 
		$position++;
 
					
 
					// This is for the very last permutation. Even 
 
					// though the combination is not actually true
 
					// the larger while loop will end before any 
 
					// new combinations are performed.
 
					if($position == $this->nclasses)
 
					{
 
						$valid = true;
 
					} else {
 
						$cs[$position]++;
 
					}
 
				} else {
 
					$valid = true;
 
					$position = 0;
 
				}
 
            }
 
		// This is for the very last permutation. Even 
 
		// though the combination is not actually true
 
		// the larger while loop will end before any 
 
		// new combinations are performed.
 
		if($position == $this->nclasses)
 
		  {
 
		    $valid = true;
 
		  } else {
 
		  $cs[$position]++;
 
		}
 
	      } else {
 
	      $valid = true;
 
	      $position = 0;
 
	    }
 
	  }
 
            
 
			$counter++;
 
		} while($counter < $this->possiblePermutations);
 
	}
 
	$counter++;
 
      } while($counter < $this->possiblePermutations);
 
  }
 
    
 
	//--------------------------------------------------
 
	// Prints out the possible permutations in tables.
 
	//--------------------------------------------------
 
	function writeoutTables()
 
	{
 
		$table = "";
 
		$header = "";
 
		$footer = "";
 
		$M = -1;
 
		$Tu = -1;
 
		$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);
 
  //--------------------------------------------------
 
  // Prints out the possible permutations in tables.
 
  //--------------------------------------------------
 
  function writeoutTables()
 
  {
 
    $table = "";
 
    $header = "";
 
    $footer = "";
 
    $M = -1;
 
    $Tu = -1;
 
    $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\">".
 
				"\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}".
 
				"\n.time{\n\tborder-style:none none solid none;\n}".
 
				"\n.day{\n\tborder-style:none none solid solid;\n}".
 
    // Reminder:
 
    // border-style:top right bottom left
 
    /* $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}".
 
       "\n.time{\n\tborder-style:none none solid none;\n}".
 
       "\n.day{\n\tborder-style:none none solid solid;\n}".
 
				
 
			"\n</style>".
 
       "\n</style>".
 

	
 
			"\n<script src=\"http://www.google.com/jsapi\"></script>".
 
			"\n<script type=\"text/javascript\" charset=\"utf-8\">".
 
			"\n\tgoogle.load(\"jquery\", \"1.3.2\");".
 
			"\n\tgoogle.load(\"jqueryui\", \"1.7.2\");".
 
			"\n</script>".
 
       "\n<script src=\"http://www.google.com/jsapi\"></script>".
 
       "\n<script type=\"text/javascript\" charset=\"utf-8\">".
 
       "\n\tgoogle.load(\"jquery\", \"1.3.2\");".
 
       "\n\tgoogle.load(\"jqueryui\", \"1.7.2\");".
 
       "\n</script>".
 

	
 
			"\n<link rel=\"stylesheet\" href=\"styles/general.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\">".
 
       "\n<link rel=\"stylesheet\" href=\"styles/general.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\">".
 

	
 
			"\n<link rel=\"stylesheet\" href=\"styles/glider.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\">".
 
			"\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<link rel=\"stylesheet\" href=\"styles/glider.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\">".
 
       "\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>".
 
       "\n</head><body>".
 

	
 
			
 

	
 
			"\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\">".
 

	
 
			*/
 
		$footcloser = '';
 
    */
 
    $footcloser = '';
 

	
 
                if(isset($_REQUEST['print']) && $_REQUEST['print'] != ''){
 
			$headcode = array('jQuery', 'outputStyle', 'outputPrintStyle');
 
		}
 
		else {
 
			$footcloser .="<script type=\"text/javascript\" charset=\"utf-8\">". 
 
				"\n\tvar my_glider = new Glider('my-glider', {duration:0});".
 
				"\n</script>";
 
			$headcode = array('outputStyle', 'gliderHeadcode');
 
		}
 
		$outputPage = new page($this->getName(), $headcode);
 
    if(isset($_REQUEST['print']) && $_REQUEST['print'] != ''){
 
      $headcode = array('jQuery', 'outputStyle', 'outputPrintStyle');
 
    }
 
    else {
 
      $footcloser .="<script type=\"text/javascript\" charset=\"utf-8\">". 
 
	"\n\tvar my_glider = new Glider('my-glider', {duration:0});".
 
	"\n</script>";
 
      $headcode = array('outputStyle', 'gliderHeadcode');
 
    }
 
    $outputPage = new page($this->getName(), $headcode);
 

	
 
		if(isset($_REQUEST['print'])){
 
			echo '<script type="text/javascript">';
 
			echo 'jQuery(document).ready( function() {';
 
    if(isset($_REQUEST['print'])){
 
      echo '<script type="text/javascript">';
 
      echo 'jQuery(document).ready( function() {';
 

	
 
			/* If user entered items to print */
 
			if($_REQUEST['print'] != 'all'){
 
			      echo 'jQuery(\'.section\').hide();';
 
			      $items = explode(',', $_REQUEST['print']);
 
			      foreach($items as $item){
 
				echo 'jQuery(\'#section'.$item.'\').show();';
 
			      }
 
			}
 
      /* If user entered items to print */
 
      if($_REQUEST['print'] != 'all'){
 
	echo 'jQuery(\'.section\').hide();';
 
	$items = explode(',', $_REQUEST['print']);
 
	foreach($items as $item){
 
	  echo 'jQuery(\'#section'.$item.'\').show();';
 
	}
 
      }
 

	
 
			echo 'jQuery(\'#selectItemsInput\').hide();
 
      echo 'jQuery(\'#selectItemsInput\').hide();
 
			      jQuery(\'#selectItems\').click( function() {
 
				jQuery(\'#selectItemsInput\').show();
 
			      });
 
			      jQuery(\'#cancelItems\').click( function() {
 
				jQuery(\'#selectItemsInput\').hide();
 
			      });';
 
			echo '});'; /* Close document.ready */
 
			echo 'window.print();
 
      echo '});'; /* Close document.ready */
 
      echo 'window.print();
 
			      </script>';
 
			echo '<p><span id="selectItems"><a href="#">Select Schedules to Print</a></span> :: <a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0">Return to normal view</a> :: <a href="input.php">Home</a></p>';
 
			echo '<div  id="selectItemsInput"><p><form action="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0"><label><strong>Schedules to Print</strong> <em>(seperate with commas, "all" for all)</em></label><br /><input type="text" name="print" value="'.$_REQUEST['print'].'" /><input type="submit" value="submit" /><span id="cancelItems"><input type="button" value="cancel" /></span></form></p></div>';
 
		}
 
		else {
 
			echo '<p><a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0&amp;print=all">Print</a> :: <a href="input.php">Home</a></p>';
 
		}
 
      echo '<p><span id="selectItems"><a href="#">Select Schedules to Print</a></span> :: <a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0">Return to normal view</a> :: <a href="input.php">Home</a></p>';
 
      echo '<div  id="selectItemsInput"><p><form action="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0"><label><strong>Schedules to Print</strong> <em>(seperate with commas, "all" for all)</em></label><br /><input type="text" name="print" value="'.$_REQUEST['print'].'" /><input type="submit" value="submit" /><span id="cancelItems"><input type="button" value="cancel" /></span></form></p></div>';
 
    }
 
    else {
 
      echo '<p><a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0&amp;print=all">Print</a> :: <a href="input.php">Home</a></p>';
 
    }		
 

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

	
 
		if($this->nPermutations > 0)
 
		{
 
			$table .= "<div id=\"my-glider\">\n"
 
			  . "  <div class=\"controls\">\n";
 
    if($this->nPermutations > 0)
 
      {
 
	$table .= "<div id=\"my-glider\">\n"
 
	  . "  <div class=\"controls\">\n";
 
			
 
			for($nn = 1; $nn <= $this->nPermutations; $nn++)
 
			{
 
			$table .= "<a href=\"#section" . $nn . "\">&nbsp;" . $nn . "&nbsp;</a>";
 
			}
 
	for($nn = 1; $nn <= $this->nPermutations; $nn++)
 
	  {
 
	    $table .= "<a href=\"#section" . $nn . "\">&nbsp;" . $nn . "&nbsp;</a>";
 
	  }
 
			
 
			$table .= "  </div> <!-- class=\"controls\" -->\n"
 
			  . "  <div class=\"scroller\">"
 
			  . "    <div class=\"scontent\">";
 
	$table .= "  </div> <!-- class=\"controls\" -->\n"
 
	  . "  <div class=\"scroller\">"
 
	  . "    <div class=\"scontent\">";
 
		
 
			for($i = 0; $i < $this->nPermutations; $i++)
 
			{
 
				$table .= "<div class=\"section\" id=\"section" . ($i+1) . "\">";
 
	for($i = 0; $i < $this->nPermutations; $i++)
 
	  {
 
	    $table .= "<div class=\"section\" id=\"section" . ($i+1) . "\">";
 
  
 
				// Beginning of table
 
				$table .= "<table style=\"empty-cells:show;\" border=\"1\" cellspacing=\"0\">";
 
	    // Beginning of table
 
	    $table .= "<table style=\"empty-cells:show;\" border=\"1\" cellspacing=\"0\">";
 
				
 
				// Header row
 
				$table .= "\n\t<tr>\n\t\t<td class=\"none\">" . ($i+1) . "</td>\n\t\t<td class=\"day\">Monday</td>\n\t\t<td class=\"day\">Tuesday</td>\n\t\t<td class=\"day\">Wednesday</td>\n\t\t<td class=\"day\">Thursday</td>\n\t\t<td class=\"day\">Friday</td>\n\t</tr>";
 
	    // Header row
 
	    $table .= "\n\t<tr>\n\t\t<td class=\"none\">" . ($i+1) . "</td>\n\t\t<td class=\"day\">Monday</td>\n\t\t<td class=\"day\">Tuesday</td>\n\t\t<td class=\"day\">Wednesday</td>\n\t\t<td class=\"day\">Thursday</td>\n\t\t<td class=\"day\">Friday</td>\n\t</tr>";
 

	
 
				for($r = 0; $r < (count($time)-1); $r++)
 
				{
 
					// Beginning of new row
 
					$temp = $time[$r];
 
					if($temp > 1259)
 
					{
 
						$temp = $temp-1200;
 
					}
 
	    for($r = 0; $r < (count($time)-1); $r++)
 
	      {
 
		// Beginning of new row
 
		$temp = $time[$r];
 
		if($temp > 1259)
 
		  {
 
		    $temp = $temp-1200;
 
		  }
 

	
 
					$table .= "\n\t<tr>\n\t\t<td class=\"time\">" . $this->prettyTime($time[$r]) . "</td>";
 
		$table .= "\n\t<tr>\n\t\t<td class=\"time\">" . $this->prettyTime($time[$r]) . "</td>";
 

	
 
					//---------------MONDAY---------------
 
					for($j = 0; $j < $this->nclasses; $j++)
 
					{
 
						if($M == -1)
 
						{
 
							if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getM())
 
							{
 
								if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
								{
 
									if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
									{
 
										$table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$M = $j;
 
										$filled = true;
 
									} else {
 
										$table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$filled = true;
 
									}
 
								}
 
							}
 
						} else {
 
							if($j == $M)
 
							{
 
								if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
								{
 
									$table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
									$filled = true;
 
								} else {
 
									$table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
									$M = -1;
 
									$filled = true;
 
								}
 
							}
 
						}
 
					}
 
		//---------------MONDAY---------------
 
		for($j = 0; $j < $this->nclasses; $j++)
 
		  {
 
		    if($M == -1)
 
		      {
 
			if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getM())
 
			  {
 
			    if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
			      {
 
				if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
				  {
 
				    $table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				    $M = $j;
 
				    $filled = true;
 
				  } else {
 
				  $table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				  $filled = true;
 
				}
 
			      }
 
			  }
 
		      } else {
 
		      if($j == $M)
 
			{
 
			  if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
			    {
 
			      $table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
			      $filled = true;
 
			    } else {
 
			    $table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
			    $M = -1;
 
			    $filled = true;
 
			  }
 
			}
 
		    }
 
		  }
 
					
 
					// If the cell was not filled, fill it with an empty cell.
 
					if(!$filled)
 
					{
 
						$table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
					}
 
					$filled = false;
 
		// If the cell was not filled, fill it with an empty cell.
 
		if(!$filled)
 
		  {
 
		    $table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
		  }
 
		$filled = false;
 
               	                     
 
					//---------------TUESDAY---------------
 
					for($j = 0; $j < $this->nclasses; $j++)
 
					{
 
						if($Tu == -1)
 
						{
 
							if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getTu())
 
							{
 
								if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
								{
 
									if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
									{
 
										$table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$Tu = $j;
 
										$filled = true;
 
									} else {
 
										$table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$filled = true;
 
									}
 
								}
 
							}
 
						} else {
 
							if($j == $Tu)
 
							{
 
								if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
								{
 
									$table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
									$filled = true;
 
								} else {
 
									$table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
									$Tu = -1;
 
									$filled = true;
 
								}
 
							}
 
						}
 
					}
 
		//---------------TUESDAY---------------
 
		for($j = 0; $j < $this->nclasses; $j++)
 
		  {
 
		    if($Tu == -1)
 
		      {
 
			if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getTu())
 
			  {
 
			    if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
			      {
 
				if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
				  {
 
				    $table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				    $Tu = $j;
 
				    $filled = true;
 
				  } else {
 
				  $table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				  $filled = true;
 
				}
 
			      }
 
			  }
 
		      } else {
 
		      if($j == $Tu)
 
			{
 
			  if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
			    {
 
			      $table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
			      $filled = true;
 
			    } else {
 
			    $table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
			    $Tu = -1;
 
			    $filled = true;
 
			  }
 
			}
 
		    }
 
		  }
 
					
 
					// If the cell was not filled, fill it with an empty cell.
 
					if(!$filled)
 
					{
 
						$table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
					}
 
					$filled = false;
 
		// If the cell was not filled, fill it with an empty cell.
 
		if(!$filled)
 
		  {
 
		    $table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
		  }
 
		$filled = false;
 
	
 
					//---------------WEDNESDAY---------------
 
					for($j = 0; $j < $this->nclasses; $j++)
 
					{
 
						if($W == -1)
 
						{
 
							if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getW())
 
							{
 
								if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
								{
 
									if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
									{
 
										$table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$W = $j;
 
										$filled = true;
 
									} else {
 
										$table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$filled = true;
 
									}
 
								}
 
							}
 
						} else {
 
							if($j == $W)
 
							{
 
								if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
								{
 
									$table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
									$filled = true;
 
								} else {
 
									$table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
									$W = -1;
 
									$filled = true;
 
								}
 
							}
 
						}
 
					}
 
		//---------------WEDNESDAY---------------
 
		for($j = 0; $j < $this->nclasses; $j++)
 
		  {
 
		    if($W == -1)
 
		      {
 
			if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getW())
 
			  {
 
			    if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
			      {
 
				if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
				  {
 
				    $table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				    $W = $j;
 
				    $filled = true;
 
				  } else {
 
				  $table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				  $filled = true;
 
				}
 
			      }
 
			  }
 
		      } else {
 
		      if($j == $W)
 
			{
 
			  if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
			    {
 
			      $table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
			      $filled = true;
 
			    } else {
 
			    $table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
			    $W = -1;
 
			    $filled = true;
 
			  }
 
			}
 
		    }
 
		  }
 
					
 
					// If the cell was not filled, fill it with an empty cell.
 
					if(!$filled)
 
					{
 
						$table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
					}
 
					$filled = false;
 
		// If the cell was not filled, fill it with an empty cell.
 
		if(!$filled)
 
		  {
 
		    $table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
		  }
 
		$filled = false;
 

	
 
					//---------------THURSDAY---------------
 
					for($j = 0; $j < $this->nclasses; $j++)
 
					{
 
						if($Th == -1)
 
						{
 
							if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getTh())
 
							{
 
								if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
								{
 
									if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
									{
 
										$table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$Th = $j;
 
										$filled = true;
 
									} else {
 
										$table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$filled = true;
 
									}
 
								}
 
							}
 
						} else {
 
							if($j == $Th)
 
							{
 
								if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
								{
 
									$table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
									$filled = true;
 
								} else {
 
									$table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
									$Th = -1;
 
									$filled = true;
 
								}
 
							}
 
						}
 
					}
 
		//---------------THURSDAY---------------
 
		for($j = 0; $j < $this->nclasses; $j++)
 
		  {
 
		    if($Th == -1)
 
		      {
 
			if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getTh())
 
			  {
 
			    if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
			      {
 
				if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
				  {
 
				    $table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				    $Th = $j;
 
				    $filled = true;
 
				  } else {
 
				  $table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				  $filled = true;
 
				}
 
			      }
 
			  }
 
		      } else {
 
		      if($j == $Th)
 
			{
 
			  if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
			    {
 
			      $table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
			      $filled = true;
 
			    } else {
 
			    $table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
			    $Th = -1;
 
			    $filled = true;
 
			  }
 
			}
 
		    }
 
		  }
 
					
 
					// If the cell was not filled, fill it with an empty cell.
 
					if(!$filled)
 
					{
 
						$table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
					}
 
					$filled = false;
 
		// If the cell was not filled, fill it with an empty cell.
 
		if(!$filled)
 
		  {
 
		    $table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
		  }
 
		$filled = false;
 

	
 
					//---------------FRIDAY---------------
 
					for($j = 0; $j < $this->nclasses; $j++)
 
					{
 
						if($F == -1)
 
						{
 
							if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getF())
 
							{
 
								if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
								{
 
									if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
									{
 
										$table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$F = $j;
 
										$filled = true;
 
									} else {
 
										$table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
										$filled = true;
 
									}
 
								}
 
							}
 
						} else {
 
							if($j == $F)
 
							{
 
								if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
								{
 
									$table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
									$filled = true;
 
								} else {
 
									$table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
									$F = -1;
 
									$filled = true;
 
								}
 
							}
 
						}
 
					}
 
		//---------------FRIDAY---------------
 
		for($j = 0; $j < $this->nclasses; $j++)
 
		  {
 
		    if($F == -1)
 
		      {
 
			if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getF())
 
			  {
 
			    if(($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() >= $time[$r]) && ($this->classStorage[$j]->getSection($this->storage[$i][$j])->getStartTime() < $time[$r+1]))
 
			      {
 
				if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
				  {
 
				    $table .= "\n\t\t<td class=\"top\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				    $F = $j;
 
				    $filled = true;
 
				  } else {
 
				  $table .= "\n\t\t<td class=\"single\">" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . "</td>";
 
				  $filled = true;
 
				}
 
			      }
 
			  }
 
		      } else {
 
		      if($j == $F)
 
			{
 
			  if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1])
 
			    {
 
			      $table .= "\n\t\t<td class=\"mid\">&nbsp;</td>";
 
			      $filled = true;
 
			    } else {
 
			    $table .= "\n\t\t<td class=\"end\">&nbsp;</td>";
 
			    $F = -1;
 
			    $filled = true;
 
			  }
 
			}
 
		    }
 
		  }
 
					
 
					// If the cell was not filled, fill it with an empty cell.
 
					if(!$filled)
 
					{
 
						$table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
					}
 
					$filled = false;
 
		// If the cell was not filled, fill it with an empty cell.
 
		if(!$filled)
 
		  {
 
		    $table .= "\n\t\t<td class=\"none\">&nbsp;</td>";
 
		  }
 
		$filled = false;
 

	
 
					// End of row
 
					$table .= "\n\t</tr>";
 
				}
 
		// End of row
 
		$table .= "\n\t</tr>";
 
	      }
 

	
 
				// End of table
 
				$table .= '</table></div> <!-- id="section' . ($i + 1) . "\" -->\n";
 
			}
 
	    // End of table
 
	    $table .= '</table></div> <!-- id="section' . ($i + 1) . "\" -->\n";
 
	  }
 

	
 
			echo $table
 
			  . "    </div> <!-- class=\"scontent\" -->\n"
 
			  . "  </div> <!-- class=\"scroller\" -->\n"
 
			  . "</div> <!-- id=\"my-glider\" -->\n"
 
			  . $footcloser; // Closes off the content div
 
		} else {
 
			echo '<html><body><p>There are no possible schedules. Please try again.</p></body></html>';
 
		}
 
	echo $table
 
	  . "    </div> <!-- class=\"scontent\" -->\n"
 
	  . "  </div> <!-- class=\"scroller\" -->\n"
 
	  . "</div> <!-- id=\"my-glider\" -->\n"
 
	  . $footcloser; // Closes off the content div
 
      } else {
 
      echo '<html><body><p>There are no possible schedules. Please try again.</p></body></html>';
 
    }
 

	
 
		/* edit button */
 
		if (!isset($savedkey))
 
		  {
 
		    if (isset($_REQUEST['savedkey']))
 
		      $savedkey = (int)$_REQUEST['savedkey'];
 
		    else
 
		      /*
 
		       * if this is a new saved schedule, it'll be the
 
		       * next item added to $_SESSION['saved']
 
		       */
 
		      $savedkey = max(array_keys($_SESSION['saved'])) + 1;
 
		  }
 
		echo '<form method="get" action="input.php"><p><input type="hidden" name="savedkey" value="' . $savedkey . '" /><input type="submit" value="edit" /></p></form>';
 
    /* edit button */
 
    if (!isset($savedkey))
 
      {
 
	if (isset($_REQUEST['savedkey']))
 
	  $savedkey = (int)$_REQUEST['savedkey'];
 
	else
 
	  /*
 
	   * if this is a new saved schedule, it'll be the
 
	   * next item added to $_SESSION['saved']
 
	   */
 
	  $savedkey = max(array_keys($_SESSION['saved'])) + 1;
 
      }
 
    echo '<form method="get" action="input.php"><p><input type="hidden" name="savedkey" value="' . $savedkey . '" /><input type="submit" value="edit" /></p></form>';
 

	
 
		$outputPage->foot();
 
	}
 
    echo "<p>There were a total of " . $this->possiblePermutations . " possible permutations. Only " . $this->nPermutations . " permutations had no class conflicts.</p>";
 

	
 
    $outputPage->foot();
 
  }
 

	
 
	/**
 
	 * \brief
 
	 *   Render the input table form for editing a saved schedule in input.php.
 
	 *
 
	 * This function's output must be synchronized with the
 
	 * associated javascript in scripts/scheduleInput.js.
 
	 */
 
	function input_form_render()
 
	{
 
	  $out = '';
 
	  static $n = "\n";
 
  /**
 
   * \brief
 
   *   Render the input table form for editing a saved schedule in input.php.
 
   *
 
   * This function's output must be synchronized with the
 
   * associated javascript in scripts/scheduleInput.js.
 
   */
 
  function input_form_render()
 
  {
 
    $out = '';
 
    static $n = "\n";
 

	
 
	  foreach ($this->classStorage as $class_key => $class)
 
	    $out .= $class->input_form_render($class_key);
 
    foreach ($this->classStorage as $class_key => $class)
 
      $out .= $class->input_form_render($class_key);
 

	
 
	  return $out;
 
	}
 
    return $out;
 
  }
 

	
 
	//--------------------------------------------------
 
	// Changes the title of the page.
 
	//--------------------------------------------------
 
	function changeTitle($t)
 
	{
 
		$this->title = $t;
 
	}
 
  //--------------------------------------------------
 
  // Changes the title of the page.
 
  //--------------------------------------------------
 
  function changeTitle($t)
 
  {
 
    $this->title = $t;
 
  }
 

	
 
	//--------------------------------------------------
 
	// Make the time "pretty."
 
	//--------------------------------------------------
 
	function prettyTime($t){
 
		if($t > 1259)
 
		{
 
			$t = ($t-1200);
 
			return substr($t, 0, strlen($t)-2) . ":" . substr($t, strlen($t)-2, strlen($t)) . " PM";
 
		} else {
 
			return substr($t, 0, strlen($t)-2) . ":" . substr($t, strlen($t)-2, strlen($t)) . " AM";
 
		}
 
	}
 
  //--------------------------------------------------
 
  // Make the time "pretty."
 
  //--------------------------------------------------
 
  function prettyTime($t){
 
    if($t > 1259)
 
      {
 
	$t = ($t-1200);
 
	return substr($t, 0, strlen($t)-2) . ":" . substr($t, strlen($t)-2, strlen($t)) . " PM";
 
      } else {
 
      return substr($t, 0, strlen($t)-2) . ":" . substr($t, strlen($t)-2, strlen($t)) . " AM";
 
    }
 
  }
 

	
 
  /**
 
   * \brief
class.section.php
Show inline comments
 
@@ -8,143 +8,144 @@ include_once 'errors.php';
 
// Represents a section of a class.
 
//--------------------------------------------------
 
   
 
class Section {
 

	
 
   private $letter;	// Section letter
 
   private $prof;	// Professor
 
   private $start;	// Start time
 
   private $tend;	// End time
 
   private $idays;	// Integer version of meeting days
 
   private $bdays;	// Boolean array of meeting days
 

	
 
function __construct ($l, $p, $s, $e, $d)
 
class Section
 
{
 
   $this->letter = $l;
 
   $this->prof = $p;
 
   $this->start = $s;
 
   $this->tend = $e;
 
   $this->idays = $d;
 
   $this->bdays = $this->setbdays();
 
}
 

	
 
  private $letter;	// Section letter
 
  private $prof;	// Professor
 
  private $start;	// Start time
 
  private $tend;	// End time
 
  private $idays;	// Integer version of meeting days
 
  private $bdays;	// Boolean array of meeting days
 

	
 
function setbdays()
 
{
 
   $result;
 
  function __construct ($l, $p, $s, $e, $d)
 
  {
 
    $this->letter = $l;
 
    $this->prof = $p;
 
    $this->start = $s;
 
    $this->tend = $e;
 
    $this->idays = $d;
 
    $this->bdays = $this->setbdays();
 
  }
 

	
 
   if($this->idays == 12345)
 
  function setbdays()
 
  {
 
    $result;
 

	
 
    if($this->idays == 12345)
 
      {$result[0] = true; $result[1] = true; $result[2] = true; $result[3] = true; $result[4] = true;}
 

	
 
   if($this->idays == 1234)
 
    if($this->idays == 1234)
 
      {$result[0] = true; $result[1] = true; $result[2] = true; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 1235)
 
    if($this->idays == 1235)
 
      {$result[0] = true; $result[1] = true; $result[2] = true; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 1245)
 
    if($this->idays == 1245)
 
      {$result[0] = true; $result[1] = true; $result[2] = false; $result[3] = true; $result[4] = true;}
 
   if($this->idays == 1345)
 
    if($this->idays == 1345)
 
      {$result[0] = true; $result[1] = false; $result[2] = true; $result[3] = true; $result[4] = true;}
 
   if($this->idays == 2345)
 
    if($this->idays == 2345)
 
      {$result[0] = false; $result[1] = true; $result[2] = true; $result[3] = true; $result[4] = true;}
 

	
 
   if($this->idays == 123)
 
    if($this->idays == 123)
 
      {$result[0] = true; $result[1] = true; $result[2] = true; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 124)
 
    if($this->idays == 124)
 
      {$result[0] = true; $result[1] = true; $result[2] = false; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 125)
 
    if($this->idays == 125)
 
      {$result[0] = true; $result[1] = true; $result[2] = false; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 134)
 
    if($this->idays == 134)
 
      {$result[0] = true; $result[1] = false; $result[2] = true; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 135)
 
    if($this->idays == 135)
 
      {$result[0] = true; $result[1] = false; $result[2] = true; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 145)
 
    if($this->idays == 145)
 
      {$result[0] = true; $result[1] = false; $result[2] = false; $result[3] = true; $result[4] = true;}
 
   if($this->idays == 234)
 
    if($this->idays == 234)
 
      {$result[0] = false; $result[1] = true; $result[2] = true; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 235)
 
    if($this->idays == 235)
 
      {$result[0] = false; $result[1] = true; $result[2] = true; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 245)
 
    if($this->idays == 245)
 
      {$result[0] = false; $result[1] = true; $result[2] = false; $result[3] = true; $result[4] = true;}
 
   if($this->idays == 345)
 
    if($this->idays == 345)
 
      {$result[0] = false; $result[1] = false; $result[2] = true; $result[3] = true; $result[4] = true;}
 

	
 
   if($this->idays == 12)
 
    if($this->idays == 12)
 
      {$result[0] = true; $result[1] = true; $result[2] = false; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 13)
 
    if($this->idays == 13)
 
      {$result[0] = true; $result[1] = false; $result[2] = true; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 14)
 
    if($this->idays == 14)
 
      {$result[0] = true; $result[1] = false; $result[2] = false; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 15)
 
    if($this->idays == 15)
 
      {$result[0] = true; $result[1] = false; $result[2] = false; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 23)
 
    if($this->idays == 23)
 
      {$result[0] = false; $result[1] = true; $result[2] = true; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 24)
 
    if($this->idays == 24)
 
      {$result[0] = false; $result[1] = true; $result[2] = false; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 25)
 
    if($this->idays == 25)
 
      {$result[0] = false; $result[1] = true; $result[2] = false; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 34)
 
    if($this->idays == 34)
 
      {$result[0] = false; $result[1] = false; $result[2] = true; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 35)
 
    if($this->idays == 35)
 
      {$result[0] = false; $result[1] = false; $result[2] = true; $result[3] = false; $result[4] = true;}
 
   if($this->idays == 45)
 
    if($this->idays == 45)
 
      {$result[0] = false; $result[1] = false; $result[2] = false; $result[3] = true; $result[4] = true;}
 
      
 
   if($this->idays == 1)
 
    if($this->idays == 1)
 
      {$result[0] = true; $result[1] = false; $result[2] = false; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 2)
 
    if($this->idays == 2)
 
      {$result[0] = false; $result[1] = true; $result[2] = false; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 3)
 
    if($this->idays == 3)
 
      {$result[0] = false; $result[1] = false; $result[2] = true; $result[3] = false; $result[4] = false;}
 
   if($this->idays == 4)
 
    if($this->idays == 4)
 
      {$result[0] = false; $result[1] = false; $result[2] = false; $result[3] = true; $result[4] = false;}
 
   if($this->idays == 5)
 
    if($this->idays == 5)
 
      {$result[0] = false; $result[1] = false; $result[2] = false; $result[3] = false; $result[4] = true;}
 
         
 
   return $result;
 
}
 
    return $result;
 
  }
 

	
 
function getLetter()
 
{
 
   return $this->letter;
 
}
 
  function getLetter()
 
  {
 
    return $this->letter;
 
  }
 

	
 
function getProf()
 
{
 
   return $this->prof;
 
}
 
  function getProf()
 
  {
 
    return $this->prof;
 
  }
 

	
 
function getStartTime()
 
{
 
   return $this->start;
 
}
 
  function getStartTime()
 
  {
 
    return $this->start;
 
  }
 

	
 
function getEndTime()
 
{
 
   return $this->tend;
 
}
 
  function getEndTime()
 
  {
 
    return $this->tend;
 
  }
 

	
 
function getM()
 
{
 
   return $this->bdays[0];
 
}
 
  function getM()
 
  {
 
    return $this->bdays[0];
 
  }
 

	
 
function getTu()
 
{
 
   return $this->bdays[1];
 
}
 
  function getTu()
 
  {
 
    return $this->bdays[1];
 
  }
 

	
 
function getW()
 
{
 
   return $this->bdays[2];
 
}
 
  function getW()
 
  {
 
    return $this->bdays[2];
 
  }
 

	
 
function getTh()
 
{
 
   return $this->bdays[3];
 
}
 
  function getTh()
 
  {
 
    return $this->bdays[3];
 
  }
 

	
 
function getF()
 
{
 
   return $this->bdays[4];
 
}
 
  function getF()
 
  {
 
    return $this->bdays[4];
 
  }
 

	
 
  /**
 
   * \brief
 
@@ -175,7 +176,7 @@ function getF()
 
	. '           name="postData[' . $class_key . '][' . $section_key . '][letter]"' . $n
 
	. '           value="' . $this->letter . '" />' . $n
 
	. "  </td>\n";
 
	break;
 
      break;
 
      }
 

	
 
    $out .= "  <td>\n"
0 comments (0 inline, 0 general)