function DegreePlan::get_progress_hours

7.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)
6.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)

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.

1 call to DegreePlan::get_progress_hours()
DegreePlan::calculate_progress_hours in classes/DegreePlan.php
Calculate and store progress hour information. Stores in the $this->gpa_calculations array.

File

classes/DegreePlan.php, line 291

Class

DegreePlan

Code

function 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) 
 {


  if ($requirement_type == "degree") {
    $requirement_type = "";
  }



  $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, FALSE, FALSE, $req_by_degree_id); // do not exclude transfer credits, since this is for required hours only.

    }
    else {
      $temp = $sem->list_courses->count_credit_hours($requirement_type, TRUE, TRUE, $bool_qpts_grades_only, $bool_exclude_all_transfer_credits, $req_by_degree_id);

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

    // Make sure the group doesn't have a type of 'x' assigned to it, which means we should
    // skip it.
    if ($g->requirement_type == 'x') {
      continue;
    }

    // If req_by_degree_id is set, make sure this group is assigned to that degree.
    if ($req_by_degree_id != 0 && $g->req_by_degree_id != $req_by_degree_id) {
      continue;
    }


    $g_hours = $g->hours_required;

    // use the min hours if it is set.
    if ($g->min_hours_allowed > 0) {
      $g_hours = $g->min_hours_allowed;
    }

    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, $requirement_type, $bool_exclude_all_transfer_credits);

    }

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

      if (!isset($g->hours_required_by_type [$requirement_type])) {
        $g->hours_required_by_type [$requirement_type] = 0;
      }

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

        // it should just be any hours_required, instead of by type, since a group can only have 1 type.
        if ($g->requirement_type == $requirement_type) {
          $g_hours = $g->hours_required;

          // use the min hours if it is set.
          if ($g->min_hours_allowed > 0) {
            $g_hours = $g->min_hours_allowed;
          }

          $hours += $g_hours;
          continue;
        }

      }

      if ($g->requirement_type == $requirement_type) 
       {
        $hours += $g_hours;
      }




    }
  }

  return $hours;

}