SubstitutionList.php

  1. 7.x classes/SubstitutionList.php
  2. 6.x classes/SubstitutionList.php
  3. 4.x custom/classes/SubstitutionList.php
  4. 5.x custom/classes/SubstitutionList.php

File

classes/SubstitutionList.php
View source
  1. <?php
  2. class SubstitutionList extends ObjList
  3. {
  4. // If group_id == -1 or 0 or '' or null, no particular group is required.
  5. function find_requirement($course_requirement, $bool_exclude_has_been_applied = FALSE, $group_id = '', $degree_id = 0, $exclude_ids = array()) {
  6. // Look through the array for a substitution which has this
  7. // course requirement.
  8. $flag = FALSE;
  9. for ($t = 0; $t < count($this->array_list); $t++)
  10. {
  11. $substitution = $this->array_list[$t];
  12. // Skip if this substitution id is in our list to exclude.
  13. if (in_array($substitution->db_substitution_id,$exclude_ids)) continue;
  14. if ($bool_exclude_has_been_applied == true && $substitution->bool_has_been_applied == true)
  15. {
  16. // Skip substitutions which we have already applied.
  17. continue;
  18. }
  19. if ($degree_id != 0 && $substitution->db_required_degree_id != $degree_id) {
  20. // Skip substitutions which are for a different degree_id than the one supplied.
  21. continue;
  22. }
  23. $cr = $substitution->course_requirement;
  24. //adminDebug($cr->course_id . " " . $course_requirement->course_id);
  25. if ($group_id === -1 || $group_id === 0 || $group_id == '' || $group_id == NULL)
  26. { // No particular group_id is required...
  27. if ($cr->course_id == $course_requirement->course_id)
  28. {
  29. return $substitution;
  30. }
  31. } else {
  32. // ONLY check if it's in the supplied group_id...
  33. if ($cr->course_id == $course_requirement->course_id && $cr->get_bool_assigned_to_group_id($group_id))
  34. {
  35. return $substitution;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. function find_group_additions(Group $group)
  42. {
  43. $group_id = $group->group_id;
  44. $rtn_list = new CourseList();
  45. // Find additions for this group_id and return them.
  46. for ($t = 0; $t < count($this->array_list); $t++)
  47. {
  48. $substitution = $this->array_list[$t];
  49. if ($substitution->bool_group_addition == true)
  50. {
  51. $c = $substitution->course_requirement;
  52. if ($c->get_bool_assigned_to_group_id($group_id))
  53. {
  54. $cc = $substitution->course_list_substitutions->get_first();
  55. //adminDebug("~~ $cc->course_id");
  56. $rtn_list->add($cc);
  57. }
  58. }
  59. }
  60. if (!$rtn_list->is_empty)
  61. {
  62. return $rtn_list;
  63. } else {
  64. return false;
  65. }
  66. }
  67. } // class SubstitutionList

Classes

Namesort descending Description
SubstitutionList