function _CourseList::remove_courses_not_in_degree

5.x _CourseList.php _CourseList::remove_courses_not_in_degree($degree_id)

Removes all courses which are not assigned to this degree_id.

File

classes/_CourseList.php, line 2624

Class

_CourseList

Code

function remove_courses_not_in_degree($degree_id) {

  $new_list = new CourseList();
  for ($t = 0; $t < $this->count; $t++) 
   {
    $course = $this->array_list [$t];
    if ($course == null) 
     {
      continue;
    }

    if ($course->req_by_degree_id != $degree_id) {
      continue;
    }

    // Otherwise, let's add it to the new_list.
    $new_list->add($course);
  }

  // Switch over the reference.
  $this->array_list = $new_list->array_list;
  $this->reset_counter();

}