function _course_get_course_object_by_uniqid in Course 6
Same name and namespace in other branches
- 8.3 course.module \_course_get_course_object_by_uniqid()
- 8.2 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.
stdClass $account: Account to instantiate this course object.
Course $course: Course to instantiate this course object.
Return value
CourseObject|FALSE
1 call to _course_get_course_object_by_uniqid()
- course_get_course_object_by_id in ./
course.module - Get a course object by its identifier.
File
- ./
course.module, line 1488 - course.module Core functionality for Courses.
Code
function _course_get_course_object_by_uniqid($uniqid, $account = NULL, $course = NULL) {
if (!empty($_SESSION['course'])) {
foreach ($_SESSION['course'] as $nid => $session) {
if (isset($session['editing']) && is_array($session['editing'])) {
foreach ($session['editing'] as $coid => $object) {
if ($coid == $uniqid) {
$courseObject = course_get_course_object($object, NULL, NULL, $account, $course);
if (!$course) {
$course = course_get_course(node_load($nid));
$courseObject
->setCourse($course);
return $courseObject;
}
}
}
}
}
}
return FALSE;
}