function _Course::get_hours

4.x _Course.php _Course::get_hours()
5.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 1129

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 $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 $h;
  }


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


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

}