_Group::get_fulfilled_quality_points

5.x _Group.php _Group::get_fulfilled_quality_points($bool_check_subgroups = true, $only_count_semester_num = -1, $bool_ignore_enrolled = false, $bool_require_has_been_displayed = false, $requirement_type = "", $bool_exclude_all_transfer_credits = FALSE)
4.x _Group.php _Group::get_fulfilled_quality_points($bool_check_subgroups = true, $only_count_semester_num = -1, $bool_ignore_enrolled = false, $bool_require_has_been_displayed = false)

Returns the quality points earned for all of the courses in this group

File

classes/_Group.php, line 436

Class

_Group

Code

function get_fulfilled_quality_points($bool_check_subgroups = true, $only_count_semester_num = -1, $bool_ignore_enrolled = false, $bool_require_has_been_displayed = false) {
  $points = 0;
  // if onlyCountSemesterNum != -1, then we will only count courses
  // who have their "assigned_to_semester_num" = $only_count_semester_num.

  $this->list_courses->reset_counter();
  while ($this->list_courses->has_more()) {
    $c = $this->list_courses->get_next();
    if ($only_count_semester_num != -1 && $c->assigned_to_semester_num != $only_count_semester_num) {
      // Only accept courses assigned to a particular semester.
      continue;
    }


    if (is_object($c->course_list_fulfilled_by) && !($c->course_list_fulfilled_by->is_empty)) {
      if ($bool_ignore_enrolled == true) {
        // Only allow it if it has been completed.
        if ($c->course_list_fulfilled_by->get_first()->is_completed() == false) {
          continue;
        }
      }

      $p = 0;

      // Are we requiring that the course has been displayed?
      if (!$bool_require_has_been_displayed || ($bool_require_has_been_displayed && $c->course_list_fulfilled_by->get_first()->bool_has_been_displayed == TRUE)) {
        $p = $c->course_list_fulfilled_by->count_credit_quality_points("", TRUE, TRUE);
      }

      $points = $points + $p;

    }

  }

  if ($bool_check_subgroups == TRUE) {
    // If there are any subgroups for this group, then run
    // this function for each group as well.
    $this->list_groups->reset_counter();
    while ($this->list_groups->has_more()) {

      $g = $this->list_groups->get_next();
      $gp = $g->get_fulfilled_quality_points(TRUE, $only_count_semester_num, $bool_ignore_enrolled);
      $points = $points + $gp;
    }
  }


  return $points;

}