function student_search_get_school_ids_user_is_allowed_to_search

6.x student_search.module student_search_get_school_ids_user_is_allowed_to_search($account = NULL)
4 calls to student_search_get_school_ids_user_is_allowed_to_search()
student_search_display_my_advisees in modules/student_search/student_search.module
Displays this user's advisees, if there are any assigned.
student_search_get_majors_for_fapi in modules/student_search/student_search.module
Returns an array of majors from the database, suitable for use with our Form API.
student_search_search_form in modules/student_search/student_search.module
system_display_dashboard_page in modules/system/system.module
This is the "dashboard" page for FlightPath, which replaces the "main" page from FP 5.

File

modules/student_search/student_search.module, line 428

Code

function student_search_get_school_ids_user_is_allowed_to_search($account = NULL) {
  global $user;
  if ($account == NULL) {
    $account = $user;
  }

  $rtn = array();
  $rtn [] = intval($account->school_id);

  // Go through permissions for what we are allowed to search
  if (module_enabled("schools")) {
    $defs = schools_get_school_definitions();
    foreach ($defs as $school_id => $name) {
      if (user_has_permission("search_students_$school_id")) {
        if (!in_array(intval($school_id), $rtn)) {
          $rtn [] = intval($school_id);
        }
      }
    }
  }


  if (!in_array(0, $rtn)) {
    $rtn [] = 0;
  }

  return $rtn;
}