Changeset - 39cd0cde34a4
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 15 years ago 2011-03-29 22:42:06
ohnobinki@ohnopublishing.net
Fix instructors not being carried through from the input form to the output.
2 files changed with 8 insertions and 5 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -110,20 +110,23 @@ class Schedule
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Adds a section to this semester after finding the class.
 
   *
 
   * \param $instructor
 
   *   The instructor of this section/section_meeting.
 
   *
 
   * \return
 
   *   NULL on success, a string on error which is a message for the
 
   *   user and a valid XHTML fragment.
 
   */
 
  function addSection($course_name, $letter, $time_start, $time_end, $days, $synonym = NULL, $faculty = NULL, $location = NULL, $type = 'lecture')
 
  function addSection($course_name, $letter, $time_start, $time_end, $days, $synonym = NULL, $instructor = NULL, $location = NULL, $type = 'lecture')
 
  {
 
    if (empty($letter) && (empty($time_start) || !strcmp($time_start, 'none')) && (empty($time_end) || !strcmp($time_end, 'none')) && empty($days)
 
	&& empty($synonym) && empty($faculty) && empty($location) && (empty($type) || !strcmp($type, 'lecture')))
 
	&& empty($synonym) && empty($instructor) && empty($location) && (empty($type) || !strcmp($type, 'lecture')))
 
      return;
 

	
 
    /* reject invalid times */
 
    if (!strcmp($time_start, 'none') || !strcmp($time_end, 'none')
 
	|| $time_start > $time_end)
 
      {
 
@@ -134,16 +137,16 @@ class Schedule
 
    foreach ($this->courses as $course)
 
      if (!strcmp($course_name, $course->getName()))
 
	{
 
	  $section = $course->section_get($letter);
 
	  if (!$section)
 
	    {
 
	      $section = new Section($letter, array(), $synonym, $faculty);
 
	      $section = new Section($letter, array(), $synonym);
 
	      $course->section_add($section);
 
	    }
 
	  $section->meeting_add(new SectionMeeting($days, $time_start, $time_end, $location, $type));
 
	  $section->meeting_add(new SectionMeeting($days, $time_start, $time_end, $location, $type, $instructor));
 

	
 
	  return;
 
	}
 

	
 
    error_log('Could not find class when parsing schedule from postData: ' . $course_name);
 
    echo 'Could not find class: ' . $course_name . "<br />\n";
inc/class.section.php
Show inline comments
 
@@ -283,11 +283,11 @@ class Section
 
	unset($this->start);
 
      }
 
    elseif (!empty($this->prof))
 
      /* Move the instructor (old $this->prof) property to our SectionMeeting children */
 
      foreach ($this->meetings as $meeting)
 
      {
 
	$meeting->instructor_set();
 
	$meeting->instructor_set($this->prof);
 
	unset($this->prof);
 
      }
 
  }
 
}
0 comments (0 inline, 0 general)