_Course::get_bool_assigned_to_group_id

5.x _Course.php _Course::get_bool_assigned_to_group_id($group_id)

Return TRUE or FALSE if this this course was ever assigned to the supplied group_id. if $group_id == -1, then return TRUE if it was assigned to ANY group.

File

classes/_Course.php, line 2060

Class

_Course

Code

function get_bool_assigned_to_group_id($group_id) {

  $bool_yes_specific_group = FALSE;
  $bool_yes_any_group = FALSE;

  foreach ($this->assigned_to_group_ids_array as $k => $v) {
    if (intval($v) > 0) {
      $bool_yes_any_group = TRUE;
    }
    if ($group_id == $v) {
      $bool_yes_specific_group = TRUE;
    }
  }


  if ($group_id == -1) {
    return $bool_yes_any_group;
  }

  // Else...
  return $bool_yes_specific_group;

}