function _CourseList::remove_excluded

4.x _CourseList.php _CourseList::remove_excluded()
5.x _CourseList.php _CourseList::remove_excluded()

Removes excluded courses from the list (courses that have db_exclude == 1)

File

classes/_CourseList.php, line 2550

Class

_CourseList

Code

function remove_excluded() 
 {
  // Removes courses from the list that have a db_exclude == 1.
  $new_list = new CourseList();
  // Do this by adding elements to an array.
  // course_id => index in list.
  for ($t = 0; $t < $this->count; $t++) 
   {
    $course = $this->array_list [$t];
    if ($course->subject_id == "") 
     { // load descriptive data (include exclude info)
      $course->load_descriptive_data();
    }

    if ($course->db_exclude == 1) 
     {
      continue;
    }

    $new_list->add($course);

  }

  $this->array_list = $new_list->array_list;
  $this->reset_counter();

}