function _DegreePlan::get_progress_hours

4.x _DegreePlan.php _DegreePlan::get_progress_hours($requirement_type = "", $bool_required_hours_only = TRUE, $bool_qpts_grades_only = FALSE)
5.x _DegreePlan.php _DegreePlan::get_progress_hours($requirement_type = "", $bool_required_hours_only = TRUE, $bool_qpts_grades_only = FALSE, $bool_exclude_all_transfer_credits = FALSE, $req_by_degree_id = 0)
1 call to _DegreePlan::get_progress_hours()

File

classes/_DegreePlan.php, line 106

Class

_DegreePlan

Code

function get_progress_hours($requirement_type = "", $bool_required_hours_only = TRUE, $bool_qpts_grades_only = FALSE) 
 {
  // Returns the number of hours required (or fulfilled) in a degree plan
  // for courses & groups with the specified requirement_type.
  // ex:  "m", "s", etc.  leave blank for ALL required hours.
  // if boolRequiredHours is FALSE, then we will only look for the courses
  // which got fulfilled.

  $hours = 0;

  $this->list_semesters->reset_counter();
  while ($this->list_semesters->has_more()) 
   {
    $sem = $this->list_semesters->get_next();

    if ($bool_required_hours_only == true) 
     {
      $hours += $sem->list_courses->count_hours($requirement_type, true, false);
    }
    else {
      $temp = $sem->list_courses->count_credit_hours($requirement_type, true, true, $bool_qpts_grades_only);
      $hours += $temp;
    }
  }

  // Also, add in groups matching this requirement type.
  $this->list_groups->reset_counter();
  while ($this->list_groups->has_more()) 
   {
    $g = $this->list_groups->get_next();
    if ($g->group_id < 0) 
     { // Skip Add a course group.
      continue;
    }


    $g_hours = $g->hours_required;
    if ($bool_required_hours_only == false) 
     { // only count the fulfilled hours, then.
      $g_hours = $g->get_fulfilled_hours(true, false, true, -1, true, $bool_qpts_grades_only);

    }

    if ($requirement_type == "") 
     {
      $hours += $g_hours;
    }
    else {
      // A requirement is specified, so make sure
      // the group is of this requirement.

      if ($bool_required_hours_only == true) 
       { // make sure it's of the right type.
        $g_hours = $g->hours_required_by_type [$requirement_type] * 1;
        $hours += $g_hours;
        continue;
      }

      if ($g->requirement_type == $requirement_type) 
       {

        $hours += $g_hours;
      }



    }
  }

  return $hours;

}