function Student::get_transfer_course_eqv
Search API
7.x Student.php | Student::get_transfer_course_eqv($transfer_course_id, $bool_ignore_unassigned = false, $require_valid_term_id = "", $require_hours = -1) |
6.x Student.php | Student::get_transfer_course_eqv($transfer_course_id, $bool_ignore_unassigned = false, $require_valid_term_id = "", $require_hours = -1) |
Find a transfer eqv for this student, for this course in question.
1 call to Student::get_transfer_course_eqv()
- Student::load_courses_taken in classes/
Student.php
File
- classes/
Student.php, line 861
Class
Code
function get_transfer_course_eqv($transfer_course_id, $bool_ignore_unassigned = false, $require_valid_term_id = "", $require_hours = -1)
{
// First, make sure that this transfer course hasn't
// been unassigned. Do this by checking through
// the student's courseListUnassignedTransferEQVs.
$temp_course = new Course();
$temp_course->course_id = $transfer_course_id;
if ($bool_ignore_unassigned == false && $this->list_transfer_eqvs_unassigned->find_match($temp_course)) {
// The transfer course in question has had its eqv removed,
// so skip it!
return false;
}
$require_hours = floatval($require_hours);
$valid_term_line = "";
if ($require_valid_term_id != "") {
// We are requesting eqv's only from a particular valid term, so, amend
// the query.
$valid_term_line = "AND valid_term_id = $require_valid_term_id ";
}
// Does the supplied transfer course ID have an eqv?
$res = $this->db->db_query("
SELECT local_course_id FROM transfer_eqv_per_student
WHERE transfer_course_id = ?
AND student_id = ?
AND broken_id = 0
$valid_term_line ", $transfer_course_id, $this->student_id);
if ($cur = $this->db->db_fetch_array($res)) {
$local_course_id = $cur ['local_course_id'];
// If we require that the local course have the same number of hours
// as the transfer, then check that now.
if ($require_hours != -1) {
$temp_course = new Course($local_course_id);
$temp_course->max_hours = floatval($temp_course->max_hours);
$temp_course->min_hours = floatval($temp_course->min_hours);
if (($temp_course->max_hours < $require_hours) || ($temp_course->min_hours > $require_hours)) {
return FALSE;
}
else {
return $local_course_id;
}
}
else {
return $local_course_id;
}
}
return false;
}