_Semester.php

  1. 5.x classes/_Semester.php
  2. 4.x classes/_Semester.php

Classes

NameDescription
_SemesterThe name "Semester" might be a little misleading, as it usually refers to years and the like. But, it might also refer to Summer semesters. Basically, its a collection of courses and groups that are required of a student. For example, the…

File

classes/_Semester.php
View source
  1. <?php
  2. /**
  3. * The name "Semester" might be a little misleading, as it usually refers
  4. * to years and the like. But, it might also refer to Summer semesters.
  5. * Basically, its a collection of courses and groups that are required of
  6. * a student. For example, the "Freshman" semester will contain courses
  7. * and groups to be taken Freshman year.
  8. *
  9. */
  10. class _Semester extends stdClass
  11. {
  12. public $title, $semester_num, $notice, $bool_using_default_title;
  13. public $list_courses, $list_groups, $req_by_degree_id;
  14. /*
  15. * $title Freshman, Sophomore, Summer II, etc.
  16. * $rankNum Numeric "rank" or order of the semester object. 1,2,3, etc.
  17. *
  18. * *** MIGHT SHOULD BE A GROUP INSTEAD? A group can be a list
  19. * of courses, and a list of groups. That sounds like a semester
  20. * to me. But, if not...
  21. * $list_courses This is a list of courses which are required
  22. * $list_groups This is a list of the groups which are required.
  23. */
  24. function __construct($semester_num = "")
  25. {
  26. $this->semester_num = $semester_num;
  27. $this->bool_using_default_title = FALSE;
  28. //$this->list_courses = new ObjList();
  29. $this->list_courses = new CourseList();
  30. $this->list_groups = new GroupList();
  31. $this->assign_title();
  32. }
  33. function equals(Semester $semester)
  34. {
  35. if ($this->semester_num == $semester->semester_num)
  36. {
  37. return true;
  38. }
  39. return false;
  40. }
  41. function assign_title()
  42. {
  43. if ($this->semester_num == 0)
  44. {$this->title = t("Freshman Year");}
  45. if ($this->semester_num == 1)
  46. {$this->title = t("Sophomore Year");}
  47. if ($this->semester_num == 2)
  48. {$this->title = t("Junior Year");}
  49. if ($this->semester_num == 3)
  50. {$this->title = t("Senior Year");}
  51. if ($this->semester_num == 4)
  52. {$this->title = t("Year 5");}
  53. // Still didn't find anything?
  54. if ($this->title == "") {
  55. $this->title = t("Year") . " " . ($this->semester_num + 1);
  56. }
  57. $this->bool_using_default_title = TRUE;
  58. }
  59. function to_string()
  60. {
  61. $rtn = "";
  62. $rtn .= " Semester: $this->semester_num \n";
  63. if (!$this->list_courses->is_empty)
  64. {
  65. $rtn .= $this->list_courses->to_string();
  66. }
  67. if (!$this->list_groups->is_empty)
  68. {
  69. $rtn .= $this->list_groups->to_string();
  70. }
  71. return $rtn;
  72. }
  73. function reset_list_counters()
  74. {
  75. // Goes through all lists in the semester and
  76. // calls function "reset_counter" on them.
  77. // Important to do before we start trying to use and
  78. // work with the semesters.
  79. $this->list_courses->reset_counter();
  80. $this->list_groups->reset_list_counters();
  81. }
  82. } // end class Semester