function _CourseList::remove_previously_fulfilled
Search API
4.x _CourseList.php | _CourseList::remove_previously_fulfilled(CourseList $list_courses, $group_id, $bool_keep_repeatable_courses = true, $list_substitutions) |
5.x _CourseList.php | _CourseList::remove_previously_fulfilled(CourseList $list_courses, $group_id, $bool_keep_repeatable_courses = true, $list_substitutions, $degree_id = 0) |
Remove courses from THIS list which appear in listCourses under these conditions:
- the listCourses->"assigned_to_group_id" != $group_id
This function is being used primarily with $list_courses being the list of courses that students have taken. Also checking substitutions for courses substituted into groups.
Parameters
CourseList $list_courses:
int $group_id:
bool $bool_keep_repeatable_courses:
SubstitutionList $list_substitutions:
File
- classes/
_CourseList.php, line 403
Class
Code
function remove_previously_fulfilled(CourseList $list_courses, $group_id, $bool_keep_repeatable_courses = true, $list_substitutions)
{
$rtn_list = new CourseList();
for ($t = 0; $t < $this->count; $t++)
{
$course = $this->array_list [$t];
if ($bool_keep_repeatable_courses == true)
{ // We can always keep repeatable courses in the list.
if ($course->repeat_hours > $course->min_hours)
{
$rtn_list->add($course);
continue;
}
}
// Has the course been substituted?
if ($test_sub = $list_substitutions->find_requirement($course, false, -1))
{
// it WAS substituted, so we should NOT add it to our
// rtnList.
continue;
}
// Okay, now check if $course is anywhere in $list_courses
if ($test_course = $list_courses->find_match($course))
{
// Yes, it found a match.
// I am taking out this part where I say if it is in
// this group then we can keep it. I think that shouldn't
// be in.
// This course is in another group, so do nothing
// and skip it.
// perhaps the course is on the degreePlan in excess with a W
// or F?
if (!$test_course->meets_min_grade_requirement_of(null, "D"))
{
// Meaning, this was a failed attempt, so we can add
// our original course back in.
$rtn_list->add($course);
continue;
}
// perhaps this course was purposefully excluded from
// this list because it did not meet the min grade
// requirements? If this is the case, $course should
// still appear in THIS list.
if (!$test_course->meets_min_grade_requirement_of($course))
{
// Meaning, this was attempt did not meet the
// min grade of the original requirement, so we can add
// our original requirement back in.
$rtn_list->add($course);
continue;
}
}
else {
// The course was NOT found in the courseList,
// so its safe to add it back in.
$rtn_list->add($course);
}
}
$this->array_list = $rtn_list->array_list;
$this->reset_counter();
}