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 1807

Class

_Course

Code

function load_descriptive_transfer_data($student_id = "", $term_id = NULL) 
 {

  // 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 != "") 
   {
    // 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 and other values while we are here
    $this->set_hours_awarded(0, $cur ["hours_awarded"] * 1);
    $this->grade = $cur ["grade"];
    $this->term_id = $cur ["term_id"];

    ///////////////////
    // If a term_id was specified, then let's try to see if we can get more specific information for this course.
    if ($term_id != NULL) {
      $res = $this->db->db_query("SELECT * FROM student_transfer_courses
                    WHERE student_id = ?
                    AND transfer_course_id = ?
                    AND term_id = ? 
                     ", $student_id, $this->course_id, $term_id);
      if ($res) {
        $cur = $this->db->db_fetch_array($res);
        if ($cur) {
          if (trim($cur ["student_specific_course_title"]) != "") {
            $this->title = trim($cur ["student_specific_course_title"]);
          }
          // Also assign hours_awarded and other values while we are here
          if ($cur ["grade"] != "" || $cur ["hours_awarded"] != "") {
            $this->set_hours_awarded(0, $cur ["hours_awarded"] * 1);
            $this->grade = $cur ["grade"];
          }
          $this->term_id = $cur ["term_id"];
        }
      }
    } // if term_id != NULL




    $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"];
      }
    }

  }


}