function Course::get_hours

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

Figure out the number of hours this particular instance of the course is worth. In the case of variable hours, it will return the number of hours selected. If that does not exist, it will return the MIN HOURS.

Return value

int

1 call to Course::get_hours()
Course::get_quality_points in classes/Course.php
Calculate the quality points for this course's grade and hours.

File

classes/Course.php, line 1111

Class

Course

Code

function get_hours($degree_id = 0) 
 {

  if ($degree_id == 0) {
    $degree_id = $this->req_by_degree_id;
  }

  // This course might be set to 1 hour, but be a "ghost hour",
  // meaning the student actually earned 0 hours, but we recorded 1
  // to make FP's math work out.  So, let's return back 0 hours.
  if ($this->bool_ghost_hour) 
   {
    $h = 0;
    return $h;
  }

  // Was this course used in a substitution?  If so, use the substitution hours.
  if ($this->get_substitution_hours($degree_id) > 0) {
    return floatval($this->get_substitution_hours($degree_id));
  }


  // Do they have any hours_awarded? (because they completed
  // the course)
  if ($this->get_hours_awarded($degree_id) > 0) 
   {
    $h = $this->get_hours_awarded($degree_id);
    return floatval($h);
  }


  if ($this->has_variable_hours() && $this->advised_hours > -1) {
    return floatval($this->advised_hours);
  }


  // No selected hours, but it's a variable hour course.
  // So, return the min_hours for this course.
  return floatval($this->min_hours);

}