ObjList::add

4.x ObjList.php ObjList::add($c, $bool_add_to_top = false)
1 call to ObjList::add()
_CourseList::add_list in classes/_CourseList.php
Adds the supplied CourseList to the bottom of $this's list.

File

classes/ObjList.php, line 17

Class

ObjList

Code

function add($c, $bool_add_to_top = false) {
  // Adds courses to the list.  Remember to perform
  // reset_counter before using this list, or the count
  // variable will be off!
  if ($bool_add_to_top == false) {
    $this->array_list[] = $c;
    //adminDebug(".....adding course");
  }
  else {
    // We are going to add this to the top of the array, pushing
    // everything else down.
    $temp_array = array();
    $temp_array[0] = $c;

    $new_array = array_merge($temp_array, $this->array_list);
    $this->array_list = $new_array;
    // adminDebug("adding to top...");
  }

  $this->is_empty = false;
  $this->count = count($this->array_list);


}