function _course_get_course_object_by_uniqid in Course 8.2
Same name and namespace in other branches
- 8.3 course.module \_course_get_course_object_by_uniqid()
- 6 course.module \_course_get_course_object_by_uniqid()
- 7.2 course.module \_course_get_course_object_by_uniqid()
- 7 course.module \_course_get_course_object_by_uniqid()
- 3.x course.module \_course_get_course_object_by_uniqid()
Get a course object by its unique identifier (sessioned course object).
Parameters
string $uniqid: Unique identifier.
Return value
CourseObject|FALSE
3 calls to _course_get_course_object_by_uniqid()
- CourseObjectForm::buildForm in src/
Form/ CourseObjectForm.php - inheritdoc}
- CourseOutlineForm::submitForm in src/
Form/ CourseOutlineForm.php - Form submission handler.
- course_get_course_object_by_id in ./
course.module - Get a course object by its identifier.
File
- ./
course.module, line 379 - course.module Core functionality for Courses.
Code
function _course_get_course_object_by_uniqid($uniqid) {
if (!empty($_SESSION['course'])) {
foreach ($_SESSION['course'] as $cid => $session) {
if (isset($session['editing']) && is_array($session['editing'])) {
foreach ($session['editing'] as $coid => $object) {
if ($coid == $uniqid) {
return CourseObject::create($object);
}
}
}
}
}
return FALSE;
}