function _CourseList::count_credit_quality_points

4.x _CourseList.php _CourseList::count_credit_quality_points($requirement_type = "", $bool_use_ignore_list = false, $bool_ignore_enrolled = false)
5.x _CourseList.php _CourseList::count_credit_quality_points($requirement_type = "", $bool_use_ignore_list = false, $bool_ignore_enrolled = false, $bool_exclude_all_transfer_credits = FALSE, $degree_id = 0)

Similar to count_credit_hours, but this will only count courses which have been taken and have a grade. We will return back a sum of their quality points.

@todo ignore list should be db-based, in the settings.

Parameters

string $requirement_type:

  • If set, we will only look for courses matching this requirement_type.

bool $bool_use_ignore_list:

bool $bool_ignore_enrolled:

Return value

int

File

classes/_CourseList.php, line 1708

Class

_CourseList

Code

function count_credit_quality_points($requirement_type = "", $bool_use_ignore_list = false, $bool_ignore_enrolled = false) 
 {

  $points = 0;
  for ($t = 0; $t < $this->count; $t++) 
   {
    $course = $this->array_list [$t];

    if ($bool_use_ignore_list == true) 
     {
      // Do ignore some courses...
      $temp_course_name = $course->subject_id . " " . $course->course_num;
      // Check in our settings to see if we should ignore this course
      // (configured in /custom/settings.php)
      if (in_array($temp_course_name, csv_to_array($GLOBALS ["fp_system_settings"]["ignore_courses_from_hour_counts"]))) {
        continue;
      }

    }


    if ($bool_ignore_enrolled == true) 
     {
      if ($course->is_completed() == false) 
       {
        if ($course->course_list_fulfilled_by->is_empty) 
         {
          continue;
        }
        else {
          if ($course->course_list_fulfilled_by->get_first()->is_completed() == false) 
           {
            continue;
          }
        }
      }
    }

    if ($course->grade != "") 
     {
      if ($requirement_type == "") 
       {
        $p = $course->get_quality_points();
        $points = $points + $p;
      }
      else {
        if ($course->requirement_type == $requirement_type) 
         {
          $p = $course->get_quality_points();
          $points = $points + $p;
          continue;
        }

        // For specifically "university capstone" courses...
        if ($course->requirement_type == "uc" && $requirement_type == "c") 
         {
          $p = $course->get_quality_points();
          $points = $points + $p;
        }

        if ($course->requirement_type == "um" && $requirement_type == "m") 
         {
          $p = $course->get_quality_points();
          $points = $points + $p;
        }


      }
    }
    else {

      // maybe it's a substitution?


      if (($requirement_type == "") || ($requirement_type != "" && $requirement_type == $course->requirement_type)) 
       {
        if ($course->course_list_fulfilled_by->is_empty == false) 
         {
          $cc = $course->course_list_fulfilled_by->get_first();
          if ($cc->bool_substitution) 
           {

            //$h = $cc->substitution_hours;

            //if ($cc->bool_ghost_hour) {
            //  $h = 0;
            //}

            // What are the quality points for this course?						
            $p = $cc->get_quality_points();

            $points = $points + $p;
          }
        }

      }
    }
  }

  return $points;

}