function _GroupList::get_clone

5.x _GroupList.php _GroupList::get_clone($bool_return_new_groups = FALSE, $bool_load_groups = TRUE, $bool_reload_missing_courses = FALSE)

Return a GroupList which is a clone of this list.

File

classes/_GroupList.php, line 128

Class

_GroupList

Code

function get_clone($bool_return_new_groups = FALSE, $bool_load_groups = TRUE, $bool_reload_missing_courses = FALSE) 
 {
  $rtn_list = new GroupList();

  for ($t = 0; $t < $this->count; $t++) 
   {
    $group = $this->array_list [$t];


    if ($bool_return_new_groups == TRUE) 
     {
      $new_group = new Group();
      $new_group->group_id = $group->group_id;

      if ($bool_load_groups) {
        $new_group->load_group(); // Make sure the group has all its courses loaded in.
      }

      $new_group->set_requirement_type($group->requirement_type);
      $new_group->set_req_by_degree_id($group->req_by_degree_id);

      $rtn_list->add($new_group);
    }
    else {

      if ($bool_load_groups) {
        $group->load_group(); // Make sure the group has all its courses loaded in.
      }

      if ($bool_reload_missing_courses) {
        $group->reload_missing_courses();
      }


      $group->set_requirement_type($group->requirement_type);
      $group->set_req_by_degree_id($group->req_by_degree_id);

      $rtn_list->add($group);
    }

  }

  return $rtn_list;

}