_SubstitutionList.php

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

File

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

Classes

Namesort descending Description
_SubstitutionList