function fp_load_degree

7.x misc.inc fp_load_degree($degree_id = "", DatabaseHandler $db = NULL, $bool_load_minimal = false, $array_significant_courses = false, $bool_use_draft = false)
6.x misc.inc fp_load_degree($degree_id = "", DatabaseHandler $db = NULL, $bool_load_minimal = false, $array_significant_courses = false, $bool_use_draft = false)
5.x misc.inc fp_load_degree($degree_id = "", DatabaseHandler $db = NULL, $bool_load_minimal = false, $array_significant_courses = false, $bool_use_draft = false)

This function provides a pass-thru to $d = new DegreePlan(args). However, it allows for quick caching look-up, so it should be used when possible instead of $x = new DegreePlan.

File

includes/misc.inc, line 942
This file contains misc functions for FlightPath

Code

function fp_load_degree($degree_id = "", DatabaseHandler $db = NULL, $bool_load_minimal = false, $array_significant_courses = false, $bool_use_draft = false) {

  // Create a "cache key" based on the arguments, so we can look this degree up faster later.
  $cache_key = md5(serialize(func_get_args()));
  //fpm("degree_id: $degree_id . cache key:" . $cache_key . "+++++++++++++");
  if (isset($GLOBALS ['fp_temp_cache']['fp_load_degree'][$cache_key])) {
    $degree = $GLOBALS ['fp_temp_cache']['fp_load_degree'][$cache_key];
    //fpm(" ...  returning cache");
    return $degree;
  }

  $degree = new DegreePlan($degree_id, $db, $bool_load_minimal, $array_significant_courses, $bool_use_draft);

  // Save to our cache
  $GLOBALS ['fp_temp_cache']['fp_load_degree'][$cache_key] = $degree;

  return $degree;

}