function FlightPath::z__cache_course_inventory

7.x FlightPath.php FlightPath::z__cache_course_inventory($limit_start = 0, $limit_size = 4000)
6.x FlightPath.php FlightPath::z__cache_course_inventory($limit_start = 0, $limit_size = 4000)

File

classes/FlightPath.php, line 1226

Class

FlightPath

Code

function z__cache_course_inventory($limit_start = 0, $limit_size = 4000) 
 {

  // Load courses from the inventory into the inventory cache...
  // Attempt to load the course inventory cache...
  if ($course_inventory = unserialize(@$_SESSION ["fp_cache_course_inventory"])) 
   {
    $GLOBALS ["fp_course_inventory"] = $course_inventory;
  }

  $result = $this->db->db_query("SELECT DISTINCT course_id FROM courses
              WHERE 
                course_num < ?
                LIMIT $limit_start, $limit_size
              ", variable_get("graduate_level_course_num", 5000)); // just use default?

  while ($cur = $this->db->db_fetch_array($result)) 
   {
    $course_id = $cur ["course_id"];

    $this->db->load_course_descriptive_data(null, $course_id);

  }

  // Should we re-cache the course inventory?  If there have been any changes
  // to it, then we will see that in a GLOBALS variable...
  if ($GLOBALS ["cache_course_inventory"] == true) 
   {
    $_SESSION ["fp_cache_course_inventory"] = serialize($GLOBALS ["fp_course_inventory"]);
  }


}