function Course::__construct
Search API
7.x Course.php | Course::__construct($course_id = "", $is_transfer = false, DatabaseHandler $db = NULL, $is_blank = false, $catalog_year = "", $bool_use_draft = false) |
6.x Course.php | Course::__construct($course_id = "", $is_transfer = false, DatabaseHandler $db = NULL, $is_blank = false, $catalog_year = "", $bool_use_draft = false) |
The constructor for a Course object.
Parameters
int $course_id:
- Numeric course_id of the course to try to load. Leave blank if you simply wish to instantiate a course object.
bool $is_transfer:
- Is this course a transfer course? Meaning, from another school.
DatabaseHandler $db:
bool $is_blank:
int $catalog_year:
- What catalog_year does this Course belong to? This is used later when we call load_descriptive_data() to get its description, hour count, etc.
bool $bool_use_draft:
File
- classes/
Course.php, line 78
Class
Code
function __construct($course_id = "", $is_transfer = false, DatabaseHandler $db = NULL, $is_blank = false, $catalog_year = "", $bool_use_draft = false)
{
$this->advised_hours = -1;
if ($is_blank == true)
{ // Do nothing if this is a "blank" course.
return;
}
$array_valid_names = array(); // will hold all "valid" names for this course (non excluded names).
$this->course_id = intval($course_id); // Force it to be numeric.
$this->appears_in_semester_nums = array(); // for combo-degrees
$this->temp_old_course_id = 0; // Used in case we delete the course_id, we can get it back (good with substitutions of transfers that are outdated).
$this->catalog_year = $catalog_year;
$this->assigned_to_semester_num = -1;
//$this->assigned_to_group_id = 0; // deprecated
$this->assigned_to_group_ids_array = array();
$this->bool_advised_to_take = false;
$this->bool_added_course = false;
$this->specified_repeats = 0;
$this->bool_specified_repeat = false;
// Give this course instance a "random" numeric id, meaning, it doesn't really mean anything.
// It used to actually be random, but we will use a simple increment instead to ensure it is unique.
if (!isset($GLOBALS ['fp_courses_random_ids'])) {
$GLOBALS ['fp_courses_random_ids'] = 10;
}
$this->random_id = $GLOBALS ['fp_courses_random_ids'];
++$this->display_status = "eligible";
$this->course_list_fulfilled_by = new CourseList();
$this->group_list_unassigned = new GroupList();
$this->bool_use_draft = $bool_use_draft;
$this->disp_for_group_id = "";
$this->req_by_degree_id = 0;
//$this->bool_has_been_displayed_by_degree_array = array();
//$this->bool_substitution_by_degree_array = array();
$this->db_substitution_id_array = array();
//$this->course_substitution_by_degree_array = array();
$this->details_by_degree_array = array();
$this->details_by_degree_array [-1] = array(); // to keep notices from showing up.
$this->assigned_to_degree_ids_array = array();
// Always override if the global variable is set.
if (@$GLOBALS ["fp_advising"]["bool_use_draft"] == true) {
$this->bool_use_draft = true;
}
$this->db = $db;
if ($db == NULL)
{
$this->db = get_global_database_handler();
}
if ($course_id != "")
{
$this->load_course($course_id, $is_transfer);
}
}