function _CourseList::count_credit_quality_points
Search API
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.
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 2240
Class
Code
function count_credit_quality_points($requirement_type = "", $bool_use_ignore_list = false, $bool_ignore_enrolled = false, $bool_exclude_all_transfer_credits = FALSE, $degree_id = 0)
{
$points = 0;
for ($t = 0; $t < $this->count; $t++)
{
$course = $this->array_list [$t];
// Does this course belong to the same degree we are interested in? If not, skip it.
if ($degree_id > 0) {
if ($course->req_by_degree_id != $degree_id && $course->get_has_been_assigned_to_degree_id($degree_id) != TRUE) {
continue;
}
}
// Correct the course's requirement type, if needed (remove the "u")
$cr_type = $course->requirement_type;
$cr_type = str_replace("u", "", $cr_type);
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;
}
// Also, if the course's requirement_type is "x" it means we should ignore it.
if ($course->requirement_type == 'x') {
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 != "")
{
// Make sure we aren't trying to exclude any transfer credits.
if ($bool_exclude_all_transfer_credits) {
if ($course->bool_transfer) {
continue;
}
// Is this a requirement which has been fulfilled by a course? And if so, is THAT course a transfer?
if ($course->course_list_fulfilled_by->is_empty == false) {
$cc = $course->course_list_fulfilled_by->get_first();
if ($cc->bool_transfer) {
continue;
}
}
}
if ($requirement_type == "")
{
$p = $course->get_quality_points($degree_id);
$points = $points + $p;
}
else {
if ($cr_type == $requirement_type)
{
$p = $course->get_quality_points($degree_id);
$points = $points + $p;
continue;
}
}
}
else {
// maybe it's a substitution?
if (($requirement_type == "") || ($requirement_type != "" && $requirement_type == $cr_type))
{
if ($course->course_list_fulfilled_by->is_empty == false)
{
$cc = $course->course_list_fulfilled_by->get_first();
if ($cc->get_bool_substitution($degree_id))
{
// Make sure we aren't trying to exclude any transfer credits.
if ($bool_exclude_all_transfer_credits) {
if ($cc->bool_transfer) {
//fpm($course);
continue;
}
}
//$h = $cc->substitution_hours;
//if ($cc->bool_ghost_hour) {
// $h = 0;
//}
// What are the quality points for this course?
$p = $cc->get_quality_points($degree_id);
$points = $points + $p;
}
}
}
}
}
return $points;
}