function _Course::load_descriptive_transfer_data

4.x _Course.php _Course::load_descriptive_transfer_data($student_id = 0)
5.x _Course.php _Course::load_descriptive_transfer_data($student_id = "", $term_id = NULL)

Similar to load_descriptive_data(), this will load whatever we have for $this transfer course.

Parameters

int $student_id:

  • If > 0, we will look for the course data which has been assigned for this particular student. If it == 0, we will just use the first bit of data we find.

File

classes/_Course.php, line 1210

Class

_Course

Code

function load_descriptive_transfer_data($student_id = 0) 
 {
  // This method should be called to load transfer course data
  // into THIS object.  It assumes that $this->course_id is a transfer
  // course's ID, which can be looked up in flightpath.transfer_courses.

  // If a student_id is specified, it will load eqv information.
  if ($this->db == null) 
   {
    $this->db = get_global_database_handler();
  }



  $res = $this->db->db_query("SELECT * FROM transfer_courses
									     WHERE transfer_course_id = '?' ", $this->course_id);
  $cur = $this->db->db_fetch_array($res);

  $this->subject_id = $cur ["subject_id"];
  $this->course_num = $cur ['course_num'];
  $this->title = $this->fix_title($cur ['title']);
  $this->min_hours = $cur ["min_hours"] * 1;
  $this->max_hours = $cur ["max_hours"] * 1;
  $this->institution_id = $cur ["institution_id"];
  // Try to figure out the institution name for this course...
  $this->institution_name = $this->db->get_institution_name($this->institution_id);

  if ($student_id > 0) 
   {
    // Because transfer credit titles may differ from student
    // to student, let's look up the title in the per-student transfer courses table...

    $res = $this->db->db_query("SELECT * FROM student_transfer_courses
									WHERE student_id = '?'
									AND transfer_course_id = '?' 
									 ", $student_id, $this->course_id);
    $cur = $this->db->db_fetch_array($res);
    if (trim($cur ["student_specific_course_title"]) != "") {
      $this->title = trim($cur ["student_specific_course_title"]);
    }
    // Also assign hours_awarded while we are here.
    $this->hours_awarded = $cur ["hours_awarded"] * 1;


    $already = array(); // to prevent duplicates from showing up, keep up with
    // eqv's we've already recorded.


    $res2 = $this->db->db_query("SELECT * FROM transfer_eqv_per_student
            					WHERE student_id = '?'	
            					AND transfer_course_id = '?' 
            					 ", $student_id, $this->course_id);
    while ($cur2 = $this->db->db_fetch_array($res2)) 
     {

      if (!in_array($cur2 ["local_course_id"], $already)) {
        $c = new Course($cur2 ["local_course_id"]);
        $this->transfer_eqv_text .= "$c->subject_id $c->course_num
  							(" . $c->get_catalog_hours() . " " . t("hrs") . ") ";
        $already [] = $cur2 ["local_course_id"];
      }
    }

  }


}