function _DegreePlan::load_descriptive_data
Search API
4.x _DegreePlan.php | _DegreePlan::load_descriptive_data() |
5.x _DegreePlan.php | _DegreePlan::load_descriptive_data() |
3 calls to _DegreePlan::load_descriptive_data()
- _DegreePlan::get_title2 in classes/
_DegreePlan.php - _DegreePlan::get_track_title in classes/
_DegreePlan.php - _DegreePlan::__construct in classes/
_DegreePlan.php
File
- classes/
_DegreePlan.php, line 882
Class
Code
function load_descriptive_data()
{
$this->bool_loaded_descriptive_data = TRUE;
// If we already have this in our cache, then look there...
$cache_name = 'degreeplan_cache';
if ($this->bool_use_draft) {
$cache_name = 'degreeplan_cache_draft';
}
if (isset($GLOBALS [$cache_name][$this->degree_id])) {
$this->array_semester_titles = $GLOBALS [$cache_name][$this->degree_id]['array_semester_titles'];
$this->bool_has_tracks = $GLOBALS [$cache_name][$this->degree_id]['bool_has_tracks'];
$this->catalog_year = $GLOBALS [$cache_name][$this->degree_id]['catalog_year'];
$this->db_advising_weight = $GLOBALS [$cache_name][$this->degree_id]['db_advising_weight'];
$this->db_allow_dynamic = $GLOBALS [$cache_name][$this->degree_id]['db_allow_dynamic'];
$this->db_exclude = $GLOBALS [$cache_name][$this->degree_id]['db_exclude'];
$this->db_override_degree_hours = $GLOBALS [$cache_name][$this->degree_id]['db_override_degree_hours'];
$this->degree_class = $GLOBALS [$cache_name][$this->degree_id]['degree_class'];
$this->degree_level = $GLOBALS [$cache_name][$this->degree_id]['degree_level'];
if ($this->degree_level == "") {
$this->degree_level = "UG"; // undergrad by default
}
$this->degree_type = $GLOBALS [$cache_name][$this->degree_id]['degree_type'];
$this->major_code = $GLOBALS [$cache_name][$this->degree_id]['major_code'];
$this->public_notes_array = $GLOBALS [$cache_name][$this->degree_id]['public_notes_array'];
$this->title = $GLOBALS [$cache_name][$this->degree_id]['title'];
$this->track_code = $GLOBALS [$cache_name][$this->degree_id]['track_code'];
$this->track_description = $GLOBALS [$cache_name][$this->degree_id]['track_description'];
$this->track_title = $GLOBALS [$cache_name][$this->degree_id]['track_title'];
return;
}
$table_name = "degrees";
if ($this->bool_use_draft) {
$table_name = "draft_$table_name";
}
$res = $this->db->db_query("SELECT * FROM $table_name
WHERE degree_id = ? ", $this->degree_id);
if ($this->db->db_num_rows($res) > 0)
{
$cur = $this->db->db_fetch_array($res);
$this->major_code = $cur ["major_code"];
$this->degree_level = strtoupper(trim($cur ["degree_level"]));
if ($this->degree_level == "") {
$this->degree_level = "UG"; // undergrad by default
}
$this->degree_class = $cur ["degree_class"];
$this->db_override_degree_hours = $cur ["override_degree_hours"];
$this->title = $cur ["title"];
$this->public_notes_array [$this->degree_id] = $cur ["public_note"];
$this->catalog_year = $cur ["catalog_year"];
$this->degree_type = trim($cur ["degree_type"]);
$this->db_exclude = trim($cur ["exclude"]);
$this->db_allow_dynamic = trim($cur ["allow_dynamic"]);
$this->db_advising_weight = intval($cur ["advising_weight"]);
// Get the semester titles.
$temp = trim($cur ["semester_titles_csv"]);
$this->array_semester_titles = explode(",", $temp);
$just_major_code = $this->major_code;
if (strstr($this->major_code, "_"))
{
// This means that there is a track. Get all the information
// you can about it.
$temp = explode("_", $this->major_code);
$this->track_code = trim($temp [1]);
$just_major_code = trim($temp [0]); // Don't change major_code value-- causes a bug in FP5
// The major_code might now have a | at the very end. If so,
// get rid of it.
$just_major_code = rtrim($just_major_code, "|");
// Now, look up information on the track.
$table_name = "degree_tracks";
if ($this->bool_use_draft) {
$table_name = "draft_$table_name";
}
static $degree_track_cache = array();
$cur = null;
if (isset($degree_track_cache [$table_name][$this->major_code][$this->track_code][$this->catalog_year])) {
$cur = $degree_track_cache [$table_name][$this->major_code][$this->track_code][$this->catalog_year];
}
else {
$res = $this->db->db_query("SELECT track_title, track_description FROM $table_name
WHERE major_code = ?
AND track_code = ?
AND catalog_year = ? ", $just_major_code, $this->track_code, $this->catalog_year);
$cur = $this->db->db_fetch_array($res);
$degree_track_cache [$table_name][$just_major_code][$this->track_code][$this->catalog_year] = $cur;
}
$this->track_title = $cur ["track_title"];
$this->track_description = $cur ["track_description"];
}
// Does this major have any tracks at all? If so, set a bool.
if ($this->db->get_degree_tracks($just_major_code, $this->catalog_year))
{
$this->bool_has_tracks = true;
}
}
// Add to our GLOBALS cache for this degree's descriptive data.
$GLOBALS [$cache_name][$this->degree_id] = array(
'array_semester_titles' => $this->array_semester_titles,
'bool_has_tracks' => $this->bool_has_tracks,
'catalog_year' => $this->catalog_year,
'db_advising_weight' => $this->db_advising_weight,
'db_allow_dynamic' => $this->db_allow_dynamic,
'db_exclude' => $this->db_exclude,
'db_override_degree_hours' => $this->db_override_degree_hours,
'degree_class' => $this->degree_class,
'degree_level' => $this->degree_level,
'degree_type' => $this->degree_type,
'major_code' => $this->major_code,
'public_notes_array' => $this->public_notes_array,
'title' => $this->title,
'track_code' => $this->track_code,
'track_description' => $this->track_description,
'track_title' => $this->track_title
);
}