function DegreePlan::calculate_progress_quality_points

7.x DegreePlan.php DegreePlan::calculate_progress_quality_points($bool_get_local_only_hours = FALSE, $types = array())
6.x DegreePlan.php DegreePlan::calculate_progress_quality_points($bool_get_local_only_hours = FALSE, $types = array())

Calculate the quality points of our completed courses, so we can use that to figure out GPA.

File

classes/DegreePlan.php, line 238

Class

DegreePlan

Code

function calculate_progress_quality_points($bool_get_local_only_hours = FALSE, $types = array()) {

  // Let's go through our requirement types by code, and collect calcuations on them
  // in the gpa_calculations array.
  if (count($types) == 0) {
    $types = fp_get_requirement_types($this->school_id);
  }

  // Add a pseudo-code in for "degree", which the functions will convert into a blank.
  $types ["degree"] = "Degree (total)";

  // We want to do this for all possible degrees.
  $all_degree_ids = array();
  $all_degree_ids [0] = 0; // Add in the default "0" degree, meaning, don't look for a specific degree_id.

  if ($this->degree_id != DegreePlan::DEGREE_ID_FOR_COMBINED_DEGREE) {
    // Not a combined degree, just use the current degree_id.
    // $all_degree_ids[] = $this->degree_id;   // Not needed?
  }
  else {
    $all_degree_ids = array_merge($all_degree_ids, $this->combined_degree_ids_array);
  }

  foreach ($all_degree_ids as $degree_id) {
    foreach ($types as $code => $desc) {
      // Make sure to skip appropriate codes we don't care about.
      if ($code == 'x') {
        continue;
      }

      $this->gpa_calculations [$degree_id][$code]["qpts"] = $this->get_progress_quality_points($code, FALSE, $degree_id);

      if ($bool_get_local_only_hours) {
        // Get only local courses, too...
        $this->gpa_calculations [$degree_id][$code . "_local"]["qpts"] = $this->get_progress_quality_points($code, TRUE, $degree_id);
      }
    } //foreach types as code

  } //foreach all_degree_ids



}