Changeset - 886ce57dfcfe
[Not reviewed]
default
0 4 0
Nathan Brink (binki) - 15 years ago 2010-10-16 22:23:50
ohnobinki@ohnopublishing.net
Support storing and crawling for section synonyms and room information. Fix up some missing ``public'' keywords as well.
4 files changed with 47 insertions and 17 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -71,7 +71,7 @@ class Schedule
 
  //--------------------------------------------------
 
  // Adds a section to the desired class.
 
  //--------------------------------------------------
 
  function addSection($n, $l, $s, $e, $d)
 
  function addSection($n, $l, $s, $e, $d, $synonym = NULL, $faculty = NULL, $room = NULL)
 
  {
 
    $found = false;
 
    $counter = 0;
 
@@ -92,7 +92,7 @@ class Schedule
 
      {
 
	echo "Could not find class: " . $n . "<br />";
 
      } else {
 
      $this->classStorage[$counter]->section_add(new Section($l, $s, $e, $d));
 
      $this->classStorage[$counter]->section_add(new Section($l, $s, $e, $d, $synonym, $faculty, $room));
 
    }
 
  }
 

	
class.section.php
Show inline comments
 
@@ -39,8 +39,11 @@ class Section
 
   *   Wednesday, and Friday.
 
   * \param $prof
 
   *   The faculty person(s) who teaches this section.
 
   * \param $room
 
   *   An identifier of the room within which the section is taught.
 
   */
 
  function __construct ($letter, $time_start, $time_end, $days, $prof = '')
 
  function __construct ($letter, $time_start, $time_end, $days,
 
			$synonym = NULL, $prof = NULL, $room = NULL)
 
  {
 
    $this->letter = $letter;
 
    $this->start = $time_start;
 
@@ -49,10 +52,12 @@ class Section
 
    $this->idays = $days;
 
    $this->bdays = $this->setbdays();
 

	
 
    $this->synonym = $synonym;
 
    $this->prof = $prof;
 
    $this->room = $room;
 
  }
 

	
 
  function setbdays()
 
  private function setbdays()
 
  {
 
    $result = array(FALSE, FALSE, FALSE, FALSE, FALSE);
 

	
 
@@ -126,52 +131,71 @@ class Section
 
    return $result;
 
  }
 

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

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

	
 
  function getStartTime()
 
  /**
 
   * \return
 
   *   This Section's room or NULL if none is defined.
 
   */
 
  public function getRoom()
 
  {
 
    return $this->room;
 
  }
 

	
 
  /**
 
   * \return
 
   *   This section's synonym -- a unique numeric identifier for this
 
   *   course. NULL if undefined.
 
   */
 
  public function getSynonym()
 
  {
 
    return $this->synonym;
 
  }
 

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

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

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

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

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

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

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

	
 
  function getDay($i)
 
  public function getDay($i)
 
  {
 
    return $this->bdays[$i];
 
  }
 
@@ -190,7 +214,7 @@ class Section
 
   *   The type of input method used for this section. Valid values
 
   *   are 'numerous', 'numbered', and 'lettered'
 
   */
 
  function input_form_render($class_key, $section_key, $section_format = 'numerous')
 
  public function input_form_render($class_key, $section_key, $section_format = 'numerous')
 
  {
 
    static $n = "\n";
 
    $out = '<tr class="section class' . $class_key . '">' . $n
 
@@ -352,6 +376,8 @@ class Section
 
			'time_start' => $this->start,
 
			'time_end' => $this->tend,
 
			'days' => array(),
 
			'synonym' => $this->synonym,
 
			'room' => $this->room,
 
			);
 
    for ($day = 0; $day < 5; $day ++)
 
      $json_array['days'][$daymap[$day]] = $this->getDay($day);
school.d/calvin.crawl.inc
Show inline comments
 
@@ -259,6 +259,9 @@ function calvin_crawl(Semester $semester
 

	
 
	  /* parse */
 
	  $section_id = Section::parse($sec_short_title);
 
	  $synonym = NULL;
 
	  if (preg_match(';\(([0-9]+)\);', $sec_short_title, $matches))
 
	    $synonym = $matches[1];
 

	
 
	  if ($verbosity > 6)
 
	    {
 
@@ -320,7 +323,7 @@ function calvin_crawl(Semester $semester
 
	    foreach (array('date_start', 'date_end', 'meeting_type', 'days', 'time_start', 'time_end', 'meeting_place') as $var)
 
	      echo $var . ':' . ${$var} . "\n";
 

	
 
	  $section = new Section($section_id['section'], $time_start, $time_end, $days, $faculty_name);
 
	  $section = new Section($section_id['section'], $time_start, $time_end, $days, $synonym, $faculty_name, $meeting_place);
 
	  $semester->section_add($section_id['department'], $section_id['course'], $section);
 
	}
 

	
school.d/cedarville.inc
Show inline comments
 
@@ -204,7 +204,8 @@ function cedarville_crawl($semester, $ve
 
	      $semester->section_add($section_parts['department'], $section_parts['course'],
 
				     new Section($section_letter,
 
						 $meeting['time_start'], $meeting['time_end'],
 
						 $meeting['days'], $instructor));
 
						 $meeting['days'], $synonym, $instructor,
 
						 $meeting['room']));
 
	    }
 
	}
 
    }
0 comments (0 inline, 0 general)