_SubstitutionList::find_group_additions

5.x _SubstitutionList.php _SubstitutionList::find_group_additions(Group $group)
4.x _SubstitutionList.php _SubstitutionList::find_group_additions(Group $group)

File

classes/_SubstitutionList.php, line 54

Class

_SubstitutionList

Code

function find_group_additions(Group $group) {
  $group_id = $group->group_id;
  $rtn_list = new CourseList();
  // Find additions for this group_id and return them.
  for ($t = 0; $t < count($this->array_list); $t++) {
    $substitution = $this->array_list[$t];
    if ($substitution->bool_group_addition == true) {
      $c = $substitution->course_requirement;
      if ($c->get_bool_assigned_to_group_id($group_id)) {
        $cc = $substitution->course_list_substitutions->get_first();
        //adminDebug("~~ $cc->course_id");
        $rtn_list->add($cc);
      }
    }

  }

  if (!$rtn_list->is_empty) {
    return $rtn_list;
  }
  else {
    return false;
  }

}