Changeset - 60bdc2d2972a
[Not reviewed]
default
0 5 0
Nathan Brink (binki) - 15 years ago 2010-10-16 20:49:32
ohnobinki@ohnopublishing.net
Make the professor attribute of the Section class optionalish.
5 files changed with 10 insertions and 18 deletions:
0 comments (0 inline, 0 general)
class.class.php
Show inline comments
 
@@ -20,21 +20,12 @@ class Classes
 
  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++;
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Adds an already-instantiated section to this class.
 
   */
 
  public function section_add(Section $section)
 
  {
class.schedule.php
Show inline comments
 
@@ -89,14 +89,13 @@ class Schedule
 
      }
 
		
 
    if($counter == $this->nclasses)
 
      {
 
	echo "Could not find class: " . $n . "<br />";
 
      } else {
 
      $p = "unknown prof";
 
      $this->classStorage[$counter]->addSection($l, $p, $s, $e, $d);
 
      $this->classStorage[$counter]->section_add(new Section($l, $s, $e, $d));
 
    }
 
  }
 

	
 
  //--------------------------------------------------
 
  // Finds all of the possible permutations and stores
 
  // the results in the storage array.
class.section.php
Show inline comments
 
@@ -20,14 +20,12 @@ class Section
 
   * \brief
 
   *   Construct a Section.
 
   *
 
   * \param $letter
 
   *   The identifier (often a letter or numeral) of this section. For
 
   *   CS-262-A, this would be 'a'.
 
   * \param $prof
 
   *   The faculty person(s) who teaches this section.
 
   * \param $time_start
 
   *   The time of day when this section meets. Formatted as a string,
 
   *   with the 24-hr representation of the hour taking the first two
 
   *   characters and a two-digit representation of minutes taking the
 
   *   next two characters.
 
   * \param $time_end
 
@@ -36,21 +34,25 @@ class Section
 
   *   A string representing the days that this section meets. The
 
   *   format of this string is an ordered series of numerals less
 
   *   than or equal to 5. Each numeral from 1 through 5 represents
 
   *   one of Monday, Tuesday, Wednesday, Thursday, and Friday. For
 
   *   example, '135' would be for a course which meets on Monday,
 
   *   Wednesday, and Friday.
 
   * \param $prof
 
   *   The faculty person(s) who teaches this section.
 
   */
 
  function __construct ($letter, $prof, $time_start, $time_end, $days)
 
  function __construct ($letter, $time_start, $time_end, $days, $prof = '')
 
  {
 
    $this->letter = $letter;
 
    $this->prof = $prof;
 
    $this->start = $time_start;
 
    $this->tend = $time_end;
 

	
 
    $this->idays = $days;
 
    $this->bdays = $this->setbdays();
 

	
 
    $this->prof = $prof;
 
  }
 

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

	
school.d/calvin.crawl.inc
Show inline comments
 
@@ -317,13 +317,13 @@ function calvin_crawl(Semester $semester
 
	  $meeting_place = $meeting_info_matches[7];
 

	
 
	  if ($verbosity > 5)
 
	    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'], $faculty_name, $time_start, $time_end, $days);
 
	  $section = new Section($section_id['section'], $time_start, $time_end, $days, $faculty_name);
 
	  $semester->section_add($section_id['department'], $section_id['course'], $section);
 
	}
 

	
 
      if (!preg_match(';Page ([0-9]+) of ([0-9]+)\</td\>$;m', $html, $pages))
 
	{
 
	  error_log('Unable to determine the number of pages in this Calvin resultset');
school.d/cedarville.inc
Show inline comments
 
@@ -199,15 +199,15 @@ function cedarville_crawl($semester, $ve
 
	      if ($meeting['type'] == 'LECT')
 
		/**
 
		 * \todo this might not make much sense.		 
 
		 */
 
		$section_letter = 'L' . $section_letter;
 
	      $semester->section_add($section_parts['department'], $section_parts['course'],
 
				     new Section($section_letter, $instructor,
 
				     new Section($section_letter,
 
						 $meeting['time_start'], $meeting['time_end'],
 
						 $meeting['days']));
 
						 $meeting['days'], $instructor));
 
	    }
 
	}
 
    }
 

	
 
  return 0;
 
}
0 comments (0 inline, 0 general)