function Course::get_bool_assigned_to_group_id

7.x Course.php Course::get_bool_assigned_to_group_id($group_id)
6.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 2049

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;

}