function _Group::get_course_id_array
Search API
5.x _Group.php | _Group::get_course_id_array($bool_exclude_assigned_courses = FALSE) |
Returns an array of course_id's in this group, as well as any sub-group (branches). // Key = course_id, val = TRUE.
File
- classes/
_Group.php, line 119
Class
Code
function get_course_id_array($bool_exclude_assigned_courses = FALSE) {
$rtn = array();
$this->list_courses->reset_counter();
while ($this->list_courses->has_more()) {
$c = $this->list_courses->get_next();
if (!$bool_exclude_assigned_courses) {
$rtn [$c->course_id] = TRUE;
}
else {
// Look to see if this course has already been assigned or not. If it has, then we
// should skip it. If it has NOT, then it's OK to add.
if ($c->course_list_fulfilled_by->is_empty == TRUE) {
$rtn [$c->course_id] = TRUE;
}
else {
//$c->load_descriptive_data();
//fpm("Not doing $c->subject_id $c->course_num");
}
}
}
// Also get any sub-group's courses...
$this->list_groups->reset_counter();
while ($this->list_groups->has_more()) {
$g = $this->list_groups->get_next();
// $rtn = array_merge($rtn, $g->get_course_id_array());
// Fix by Logan Buth: https://bytetask.com/node/2456
$rtn = $rtn + $g->get_course_id_array();
}
return $rtn;
}