function variable_get_for_school

7.x db.inc variable_get_for_school($name, $default_value = "", $school_id = 0, $bool_ignore_override = FALSE)
6.x db.inc variable_get_for_school($name, $default_value = "", $school_id = 0, $bool_ignore_override = FALSE)

Get a value for a particular school. if bool_ignore_override is TRUE, then we won't worry if it's being overwritten or not.

95 calls to variable_get_for_school()
admin_advising_settings_form in modules/admin/admin.module
This is a systems settings form, which lets the user edit advising variabled for FlightPath.
admin_display_degrees_popup_add_group2 in modules/admin/admin.degrees.inc
admin_display_main in modules/admin/admin.module
This is the "main" page for the admin module. It's what the user first sees when the click to go to the Admin page.
admin_edit_degree_form in modules/admin/admin.degrees.inc
Meant to replace the old-fashioned display_edit_degree function...
admin_edit_degree_form_submit in modules/admin/admin.degrees.inc

... See full list

File

includes/db.inc, line 926
This file contains mostly db shortcuts.

Code

function variable_get_for_school($name, $default_value = "", $school_id = 0, $bool_ignore_override = FALSE) {
  $school_id = intval($school_id);

  // If this is the default school, OR, we are using NOT overriding the default vals for this school, then use variable_get normally
  if ($school_id === 0 || ($bool_ignore_override == FALSE && variable_get("school_override__$name~~school_" . $school_id, '') !== 'yes')) {
    return variable_get($name, $default_value); // for default school, just work normally.
  }

  if ($bool_ignore_override == TRUE && !variable_exists("school_override__$name~~school_" . $school_id)) {
    return variable_get($name, $default_value); // Can't find the override anyway, so get the default.
  }


  // If we are here, we need to get using a fieldname suffix with the school id.
  return variable_get($name . "~~school_" . $school_id, $default_value);

}