Changeset - 0f237d0addac
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 14 years ago 2011-10-27 00:14:04
ohnobinki@ohnopublishing.net
Cleaner English concerning the number of possible and realized permutations.
1 file changed with 12 insertions and 2 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -764,98 +764,108 @@ class Schedule
 
					  $singleton_course = new Course($course->getName(), $course->title_get());
 
					  $singleton_course->section_add($section, $course_slot->id_get());
 
					  $permutation_courses[$j] = $singleton_course->to_json_array();
 
					}
 

	
 
				      $filled = TRUE;
 
				    }
 
			    } /* $course_slot */
 
			}
 
		    }
 

	
 
		  if ($rowspan[$dayLoop] > 0)
 
		    {
 
		      $filled = TRUE;
 
		      $rowspan[$dayLoop] --;
 
		    }
 

	
 
		  /* If the cell was not filled, fill it with an empty cell. */
 
			if(!$filled)
 
			{
 
				echo "            <td class=\"none\">&nbsp;</td>\n";
 
			}
 
			$filled = FALSE;
 
		}
 
		
 
		// End of row
 
		echo "          </tr>\n";
 
	      }
 

	
 
	    // End of table
 
	    echo "        </table>\n";
 

	
 
            if ($have_credit_hours)
 
              echo '        <p>Credit Hours: ' . sum($credit_hours) . '</p>' . PHP_EOL;
 

	
 
            echo ''
 
              . '        <span class="course-data">'.  htmlentities(json_encode($permutation_courses)) . "</span>\n"
 
	      . '      </div> <!-- id="section' . ($i + 1) . "\" -->\n";
 
	  }
 

	
 
          echo "    </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 <a href="input.php?s='.$this->id.'">try again</a>.</p></body></html>';
 
    }
 

	
 
    echo '<p id="possiblestats">' . PHP_EOL
 
      . '  There were a total of ' . $this->possiblePermutations . ' possible permutations. Only ' . $this->nPermutations . ' permutations had no class conflicts.' . PHP_EOL
 
    echo '<p id="possiblestats">' . PHP_EOL;
 
    if ($this->possiblePermutations == 1)
 
      echo 'There was one possible permutation.';
 
    else
 
      echo 'There were a total of ' . $this->possiblePermutations . ' possible permutations.';
 
    if ($this->possiblePermutations == $this->nPermutations)
 
      echo ' No permutations had';
 
    elseif (!$this->nPermutations)
 
      echo ' All permutations had';
 
    else
 
      echo ' Only ' . $this->nPermutations . ' permutation' . ($this->nPermutations == 1 ? '' : 's') . ' had no';
 
    echo ' scheduling conflicts.' . PHP_EOL
 
      . '</p>' . PHP_EOL;
 
    if ($this->created)
 
      echo ''
 
	. '<p id="created-time">' . PHP_EOL
 
	. '  Created <span class="cute-time">' . gmdate('c', $this->created) . '</span>.' . PHP_EOL
 
	. '</p>' . PHP_EOL;
 

	
 
    $outputPage->foot();
 
  }
 

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

	
 
  //--------------------------------------------------
 
  // Make the time "pretty"
 
  //--------------------------------------------------
 
  function prettyTime($t){
 
    if($t >= 1200)
 
      {
 
	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
 
   *   fetch the number of classes
 
   */
 
  function nclasses_get()
 
  {
 
    return count($this->courses);
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Fetch a specified class by its key.
 
   *
 
   * Use Schedule::courses_get() instead of this function if the code
 
   * you're writing understand CourseSlot objects.
 
   *
0 comments (0 inline, 0 general)