function _CourseList::get_clone
Search API
4.x _CourseList.php | _CourseList::get_clone($bool_return_new_courses = false) |
5.x _CourseList.php | _CourseList::get_clone($bool_return_new_courses = FALSE) |
Returns a clone CourseList of $this.
Parameters
bool $bool_return_new_courses:
- If set to TRUE, it will create new Course objects based on the course_id's of the ones in $this's list. If set to FALSE, this will add the exact same Course objects by reference to the new list.
Return value
File
- classes/
_CourseList.php, line 1394
Class
Code
function get_clone($bool_return_new_courses = false)
{
// This will return a clone of this list.
// If boolReturnNewCourses is true, then it will
// return a new list of new instances of courses
// from this list.
$rtn_list = new CourseList();
for ($t = 0; $t < $this->count; $t++)
{
$course = $this->array_list [$t];
if ($bool_return_new_courses == true)
{
$new_course = new Course();
$new_course->course_id = $course->course_id;
$rtn_list->add($new_course);
}
else {
$rtn_list->add($course);
}
}
return $rtn_list;
}