function _DegreePlan::load_degree_plan
Search API
4.x _DegreePlan.php | _DegreePlan::load_degree_plan() |
5.x _DegreePlan.php | _DegreePlan::load_degree_plan() |
1 call to _DegreePlan::load_degree_plan()
- _DegreePlan::__construct in classes/
_DegreePlan.php
File
- classes/
_DegreePlan.php, line 235
Class
Code
function load_degree_plan()
{
// Load this degree plan from the database and fully
// assemble it.
$degree_id = $this->degree_id;
$old_semester = "";
$table_name1 = "degrees";
$table_name2 = "degree_requirements";
if ($this->bool_use_draft) {
$table_name1 = "draft_$table_name1";
$table_name2 = "draft_$table_name2";
}
$res = $this->db->db_query("SELECT * FROM $table_name1 a, $table_name2 b
WHERE a.degree_id = '?'
AND a.degree_id = b.degree_id
ORDER BY semester_num ", $this->degree_id);
while ($cur = $this->db->db_fetch_array($res))
{
$this->title = $cur ["title"];
$this->major_code = $cur ["major_code"];
$this->degree_class = strtoupper(trim($cur ["degree_class"]));
$semester_num = $cur ["semester_num"];
if ($semester_num != $old_semester)
{
// This is a new semester object we are dealing with.
$old_semester = $semester_num;
$obj_semester = new Semester($semester_num);
$obj_semester->title = trim($this->array_semester_titles [$semester_num]);
if ($obj_semester->title == "") {
$obj_semester->assign_title();
}
$this->list_semesters->add($obj_semester);
}
if ($cur ["course_id"] * 1 > 0)
{
// A course is the next degree requirement.
//if ($this->bool_use_draft) $cat_year = $this->catalog_year;
$cat_year = $this->catalog_year;
$course_c = new Course($cur ["course_id"], false, $this->db, false, $cat_year, $this->bool_use_draft);
$course_c->assigned_to_semester_num = $semester_num;
$course_c->min_grade = trim(strtoupper($cur ["course_min_grade"]));
if ($course_c->min_grade == "")
{ // By default, all courses have a
// min grade requirement of D.
$course_c->min_grade = "D";
}
$course_c->requirement_type = trim($cur ["course_requirement_type"]);
//adminDebug($course_c->to_string() . $course_c->getCatalogHours());
$obj_semester->list_courses->add($course_c);
}
if ($cur ["group_id"] * 1 > 0)
{
// A group is the next degree requirement.
//$group_g = new Group($cur["group_id"], $this->db, $semester_num);
$title = "";
$icon_filename = "";
// Add the real Group (with all the courses, branches, etc)
// to the DegreePlan's group list!
// First, see if this group alread exists. If it does,
// simply add the number of hours required to it. If not,
// create it fresh.
if ($new_group = $this->find_group($cur ["group_id"]))
{
// Was already there (probably in another semester),
// so, just increment the required hours.
$new_group->hours_required = $new_group->hours_required + ($cur ["group_hours_required"] * 1);
$new_group->hours_required_by_type [$cur ["group_requirement_type"]] += ($cur ["group_hours_required"] * 1);
$title = $new_group->title;
$icon_filename = $new_group->icon_filename;
}
else {
// Was not already there; insert it.
$group_n = new Group($cur ["group_id"], $this->db, $semester_num, $this->student_array_significant_courses, $this->bool_use_draft);
$group_n->hours_required = $cur ["group_hours_required"] * 1;
$group_n->hours_required_by_type [$cur ["group_requirement_type"]] += $group_n->hours_required;
if (trim($cur ["group_min_grade"]) != "")
{
$group_n->assign_min_grade(trim(strtoupper($cur ["group_min_grade"])));
}
$group_n->requirement_type = $cur ["group_requirement_type"];
$title = $group_n->title;
$icon_filename = $group_n->icon_filename;
$this->list_groups->add($group_n);
}
// Add a placeholder to the Semester....
$group_g = new Group();
$group_g->bool_use_draft = $this->bool_use_draft;
$group_g->group_id = $cur ["group_id"];
$group_g->load_descriptive_data();
$group_g->requirement_type = $cur ["group_requirement_type"];
if (trim($cur ["group_min_grade"]) != "")
{
$group_g->assign_min_grade(trim(strtoupper($cur ["group_min_grade"])));
}
$group_g->assigned_to_semester_num = $semester_num;
$group_g->title = "$title";
$group_g->icon_filename = $icon_filename;
$group_g->hours_required = $cur ["group_hours_required"] * 1;
$group_g->bool_placeholder = true;
$obj_semester->list_groups->add($group_g);
}
}
$this->list_groups->sort_priority();
}