_Semester.php

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

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
  11. {
  12. public $title, $semester_num, $notice;
  13. public $list_courses, $list_groups;
  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->list_courses = new ObjList();
  28. $this->list_courses = new CourseList();
  29. $this->list_groups = new GroupList();
  30. $this->assign_title();
  31. }
  32. function equals(Semester $semester)
  33. {
  34. if ($this->semester_num == $semester->semester_num)
  35. {
  36. return true;
  37. }
  38. return false;
  39. }
  40. function assign_title()
  41. {
  42. if ($this->semester_num == 0)
  43. {$this->title = t("Freshman Year");}
  44. if ($this->semester_num == 1)
  45. {$this->title = t("Sophomore Year");}
  46. if ($this->semester_num == 2)
  47. {$this->title = t("Junior Year");}
  48. if ($this->semester_num == 3)
  49. {$this->title = t("Senior Year");}
  50. if ($this->semester_num == 4)
  51. {$this->title = t("Year 5");}
  52. // Still didn't find anything?
  53. if ($this->title == "") {
  54. $this->title = t("Year") . " " . ($this->semester_num + 1);
  55. }
  56. }
  57. function to_string()
  58. {
  59. $rtn = "";
  60. $rtn .= " Semester: $this->semester_num \n";
  61. if (!$this->list_courses->is_empty)
  62. {
  63. $rtn .= $this->list_courses->to_string();
  64. }
  65. if (!$this->list_groups->is_empty)
  66. {
  67. $rtn .= $this->list_groups->to_string();
  68. }
  69. return $rtn;
  70. }
  71. function reset_list_counters()
  72. {
  73. // Goes through all lists in the semester and
  74. // calls function "reset_counter" on them.
  75. // Important to do before we start trying to use and
  76. // work with the semesters.
  77. $this->list_courses->reset_counter();
  78. $this->list_groups->reset_list_counters();
  79. }
  80. } // end class Semester

Classes

Namesort descending Description
_Semester The 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…