function Course::get_course_substitution

7.x Course.php Course::get_course_substitution($degree_id = 0)
6.x Course.php Course::get_course_substitution($degree_id = 0)

Similar to the functions regarding display-- get the course substitution based on supplied degree_id. Set degree_id to -1 to just get the first one, if available.

File

classes/Course.php, line 311

Class

Course

Code

function get_course_substitution($degree_id = 0) {
  // If degree_id is zero, then use the course's currently req_by_degree_id.    
  if ($degree_id == 0) {
    $degree_id = $this->req_by_degree_id;
  }

  if ($degree_id > 0) {
    //return $this->course_substitution_by_degree_array[$degree_id];
    return $this->get_details_by_degree($degree_id, "course_substitution");
  }
  else {
    //$x = reset($this->course_substitution_by_degree_array);
    if (isset($this->details_by_degree_array [$degree_id]["course_substitution"])) {
      $x = reset($this->details_by_degree_array [$degree_id]["course_substitution"]);
      if ($x) {
        return $x;
      }
    }
  }

  // Else, return boolean FALSE
  return FALSE;


}