function schools_get_schools_for_fapi
Search API
| 7.x schools.module | schools_get_schools_for_fapi($bool_include_default = TRUE, $bool_check_perm = FALSE, $check_perm_type = "degree", $bool_include_school_code = FALSE) | 
| 6.x schools.module | schools_get_schools_for_fapi($bool_include_default = TRUE, $bool_check_perm = FALSE, $check_perm_type = "degree", $bool_include_school_code = FALSE) | 
Return a list of schools in an array, for use in the "options" of a select list in the Form API.
If $bool_check_perm is true, then we will check permissions before adding it to the array.
10 calls to schools_get_schools_for_fapi()
- admin_courses_list_filter_form in modules/admin/ admin.courses.inc 
- admin_degrees_list_filter_form in modules/admin/ admin.degrees.inc 
- admin_groups_list_filter_form in modules/admin/ admin.groups.inc 
- blank_degrees_select_school_form in modules/blank_degrees/ blank_degrees.module 
- course_search_select_school_form in modules/course_search/ course_search.module 
File
- modules/schools/ schools.module, line 540 
- Schools module.
Code
function schools_get_schools_for_fapi($bool_include_default = TRUE, $bool_check_perm = FALSE, $check_perm_type = "degree", $bool_include_school_code = FALSE) {
  $rtn = array();
  $defs = schools_get_school_definitions(TRUE);
  if ($bool_include_default) {
    $rtn [0] = t(' - Default -');
  }
  foreach ($defs as $school_id => $val) {
    $title = $val ['name'];
    if ($bool_include_school_code) {
      $title = $val ['school_code'] . ' - ' . $val ['name'];
    }
    if ($bool_check_perm) {
      if (user_has_permission('administer_' . $school_id . '_' . $check_perm_type . '_data') || user_has_permission('manage_' . $school_id . '_' . $check_perm_type . '_data')) {
        $rtn [$school_id] = $title;
      }
    }
    else {
      $rtn [$school_id] = $title;
    }
  }
  return $rtn;
}
