function ObjList::add

7.x ObjList.php ObjList::add($c, $bool_add_to_top = false)
6.x ObjList.php ObjList::add($c, $bool_add_to_top = false)
4.x ObjList.php ObjList::add($c, $bool_add_to_top = false)
5.x ObjList.php ObjList::add($c, $bool_add_to_top = false)

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);


}