function fp_get_degree_major_code
Search API
7.x db.inc | fp_get_degree_major_code($degree_id, $bool_reset_cache = FALSE) |
6.x db.inc | fp_get_degree_major_code($degree_id, $bool_reset_cache = FALSE) |
5.x db.inc | fp_get_degree_major_code($degree_id, $bool_reset_cache = FALSE) |
Returns the major code for a given degree_id
3 calls to fp_get_degree_major_code()
- GroupList::sort_degree_advising_weight in classes/
GroupList.php - Sort this list of groups by the advising weights of the degrees they belong to.
- GroupList::z__sort_degree_advising_weight in classes/
GroupList.php - system_flightpath_can_assign_course_to_degree_id in modules/
system/ system.module - Implements hook flightpath_can_assign_course_to_degree_id
File
- includes/
db.inc, line 228 - This file contains mostly db shortcuts.
Code
function fp_get_degree_major_code($degree_id, $bool_reset_cache = FALSE) {
if ($bool_reset_cache) {
unset($GLOBALS ['fp_temp_degree_major_codes']);
}
// We will cache in a GLOBALS variable, to save lookup time.
if (isset($GLOBALS ['fp_temp_degree_major_codes'][$degree_id])) {
return $GLOBALS ['fp_temp_degree_major_codes'][$degree_id];
}
$major_code = '';
$res = db_query("SELECT major_code FROM degrees WHERE degree_id = ?", $degree_id);
$cur = db_fetch_array($res);
if ($cur) {
$major_code = trim($cur ['major_code']);
}
if ($major_code) {
$GLOBALS ['fp_temp_degree_major_codes'][$degree_id] = $major_code;
}
return $major_code;
}