Changeset - b44699357016
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 14 years ago 2012-02-07 20:20:00
ohnobinki@ohnopublishing.net
Extraneous whitespace.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
inc/class.course.inc
Show inline comments
 
@@ -30,97 +30,97 @@ require_once 'class.course_slot.inc';
 
 * take. Courses are not associated with professors or meeting times,
 
 * those are in the realm of the Section and SectionMeeting.
 
 *
 
 * Iterating over this object will return CourseSlot objects, which
 
 * act exactly like most universities' idea of a course. However, some
 
 * universities have one Course and require students to take one
 
 * section from each of different categories of sections within in a
 
 * course. For example, at umich for any course which has a listing of
 
 * Sections of the type 'discussion' the student _must_ take one of
 
 * these 'discussion' sections in addition to, for example, a
 
 * 'lecture' Section.
 
 */
 
class Course implements IteratorAggregate
 
{
 
  private $name;	// String
 
  private $title;       // String
 
  private $sections;	// Array of sections, for __wakeup() to convert to CourseSlots.
 
  private $nsections;	// int, for __wakeup() to convert to CourseSlots.
 
  /**
 
   * \brief
 
   *   Other courses that this course depends on.
 
   *
 
   * Example: Many calvin courses depend on lab courses.
 
   */
 
  private $dependencies;
 

	
 
  /**
 
   * \brief
 
   *    Creates a class with the given name.
 
   *
 
   * When updating this function, update the call to ``new Course()''
 
   * in Schedule::findPossibilities(), Schedule::writeoutTables(), and
 
   * Schedule::courses_get().
 
   *
 
   * \param $course_id
 
   *    The identifier of the class. Ex., MATH-101 in
 
   *    MATH-101-A. Retrieved with Course::getName().
 
   * \param $title
 
   *    The human-friendly course title, such as 'Introduction to
 
   *    Algebra', or NULL.
 
   */
 
  public function __construct($course_id, $title = NULL)
 
  {
 
    $this->slots = array();
 
    $this->name = $course_id;
 
    $this->title = $title;
 
    $this->dependencies = array();
 
  }
 
	
 

	
 
  /**
 
   * \brief
 
   *   Adds an already-instantiated Section to this class.
 
   *
 
   * \param $section
 
   *   The Section to append to this Course.
 
   * \param $course_slot_id
 
   *   The string identifer of the CourseSlot to place the given
 
   *   Section into. Most schools will not specify this.
 
   */
 
  public function section_add(Section $section, $course_slot_id = 'default')
 
  {
 
    if (empty($this->slots[$course_slot_id]))
 
      $this->slots[$course_slot_id] = new CourseSlot($course_slot_id);
 
    $this->slots[$course_slot_id]->section_add($section);
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Append a CourseSlot to this Course.
 
   *
 
   * If this course already contains a CourseSlot with the same
 
   * CourseSlot identifier as $course_slot, then the new CourseSlot
 
   * will replace the old one.
 
   *
 
   * \param $course_slot
 
   *   The CourseSlot to append.
 
   */
 
  public function course_slot_add(CourseSlot $course_slot)
 
  {
 
    $this->slots[$course_slot->id_get()] = $course_slot;
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Required function to implement the IteratorAggregate interface.
 
   */
 
  public function getIterator()
 
  {
 
    return new ArrayIterator($this->slots);
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Retrieve a section of this Course based on its letter.
 
   *
 
   * This function will automatically search CourseSlots for this
 
   * Section. Why? Because even though we support multiple
0 comments (0 inline, 0 general)