function fp_get_degree_advising_weight

6.x db.inc fp_get_degree_advising_weight($degree_id, $bool_reset_cache = FALSE)
5.x db.inc fp_get_degree_advising_weight($degree_id, $bool_reset_cache = FALSE)
2 calls to fp_get_degree_advising_weight()
_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

File

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

Code

function fp_get_degree_advising_weight($degree_id, $bool_reset_cache = FALSE) {

  if ($bool_reset_cache) {
    unset($GLOBALS ['fp_temp_degree_advising_weights']);
  }

  // We will cache in a GLOBALS variable, to save lookup time.  
  if (isset($GLOBALS ['fp_temp_degree_advising_weights'][$degree_id])) {
    return $GLOBALS ['fp_temp_degree_advising_weights'][$degree_id];
  }

  $res = db_query("SELECT advising_weight FROM degrees WHERE degree_id = ?", $degree_id);
  $cur = db_fetch_array($res);
  $advising_weight = intval(trim($cur ['advising_weight']));

  if ($advising_weight) {
    $GLOBALS ['fp_temp_degree_advising_weights'][$degree_id] = $advising_weight;
  }

  return $advising_weight;

}