function Course::load_course

7.x Course.php Course::load_course($course_id, $is_transfer = false)
6.x Course.php Course::load_course($course_id, $is_transfer = false)

Loads $this as a new course, based on course_id.

Parameters

int $course_id:

bool $is_transfer:

2 calls to Course::load_course()
Course::load_course_from_data_string in classes/Course.php
This will take a data string, as created by the function to_data_string(), and make $this object match the original object. It is a poor man's unserialize. See to_data_string()'s description for a fuller picture of what is going on.
Course::__construct in classes/Course.php
The constructor for a Course object.

File

classes/Course.php, line 1286

Class

Course

Code

function load_course($course_id, $is_transfer = false) 
 {

  if ($this->db == NULL) 
   {
    $this->db = get_global_database_handler();
  }


  $catalog_line = "";
  if ($this->catalog_year != "") {
    $catalog_line = " AND catalog_year = '$this->catalog_year' ";
  }

  if ($is_transfer == false) {
    $this->load_descriptive_data();
  }
  else {
    // This is a transfer course.  


    $res = $this->db->db_query("SELECT * FROM
                    transfer_courses a,
                    transfer_institutions b
                    WHERE 
                     a.transfer_course_id = '?' 
                     AND a.institution_id = b.institution_id ", $course_id);
    $cur = $this->db->db_fetch_array($res);
    $this->subject_id = $cur ["subject_id"];
    $this->course_num = $cur ["course_num"];
    $this->course_id = $course_id;
    $this->school_id = $cur ['school_id'];
    $this->bool_transfer = true;
    $this->institution_id = $cur ["institution_id"];
    $this->institution_name = $cur ["name"];

  }

  $this->assign_display_status();




  // When we load this course, let's also check for any hooks.
  // Since this class might be used outside of FP, only do this if we know
  // that the bootstrap.inc file has been executed.
  if ($GLOBALS ["fp_bootstrap_loaded"] == TRUE) {
    invoke_hook("course_load", array(&$this));
  }




}