You are here

function course_get_course_object_by_id in Course 7

Same name and namespace in other branches
  1. 8.3 course.module \course_get_course_object_by_id()
  2. 8.2 course.module \course_get_course_object_by_id()
  3. 6 course.module \course_get_course_object_by_id()
  4. 7.2 course.module \course_get_course_object_by_id()
  5. 3.x course.module \course_get_course_object_by_id()

Get a course object by its identifier.

Parameters

int $coid: The numeric ID of the course object.

stdClass $account: If specified the CourseObject will be loaded with this user (for access and fulfillment tracking).

Return value

CourseObject|FALSE A loaded CourseObject or FALSE if no object found.

15 calls to course_get_course_object_by_id()
CourseObjectFulfillmentTestCase::testCourseContentObjectFulfillment in tests/CourseObjectFulfillmentTestCase.test
Test fulfillment of CourseObjects with an enrolled/unenrolled user
CourseObjectManualTestCase::testCourseObjectManual in modules/course_object_manual/course_object_manual.test
Test manual course object functionality.
CourseObjectQuizTestCase::testQuizCourseObject in modules/course_quiz/course_quiz.test
CourseObjectSignupTestCase::testSignupCourseObject in modules/course_signup/course_signup.test
Test the fulfillment of an attendance object.
CourseObjectTestCase::testCourseObjectBasicCrud in tests/CourseObjectTestCase.test
Test basic save/load of CourseObjects.

... See full list

File

./course.module, line 1494
course.module Core functionality for Courses.

Code

function course_get_course_object_by_id($coid, $account = NULL, $course = NULL) {
  if (!is_numeric($coid)) {
    return _course_get_course_object_by_uniqid($coid, $account, $course);
  }
  if ($courseObject = entity_load_single('course_object', $coid)) {
    $courseObject
      ->setUser($account);
    return $courseObject;
  }
}