You are here

function course_report_load in Course 7

Same name and namespace in other branches
  1. 6 course.module \course_report_load()
  2. 7.2 course.module \course_report_load()

Load a course report entry, by report entry ID or node/user object.

Return value

CourseReport An entity representation of a course report.

9 calls to course_report_load()
CourseObjectAccessTestCase::testDisabledCourseObjects in tests/CourseObjectAccessTestCase.test
Test disabled course objects do not show up in the course outline and do not block completion.
CourseObjectAccessTestCase::testHiddenCourseObjects in tests/CourseObjectAccessTestCase.test
Test hidden course objects do not show up in the course outline but block completion.
course_completion_page in includes/course.outline.inc
Render a landing page for course completion.
course_course_enrollment_delete in ./course.module
Implements hook_course_enrollment_delete().
course_course_enrollment_insert in ./course.module
Implements hook_course_enrollment_insert().

... See full list

File

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

Code

function course_report_load($mixed, $user = NULL) {
  if (is_object($mixed)) {
    $entities = entity_load('course_report', FALSE, array(
      'nid' => $mixed->nid,
      'uid' => $user->uid,
    ));
    if ($entities) {
      return reset($entities);
    }
  }
  elseif (is_numeric($user)) {
    $entities = entity_load('course_report', FALSE, array(
      'nid' => $mixed,
      'uid' => $user,
    ));
    if ($entities) {
      return reset($entities);
    }
  }
  else {
    return entity_load_single('course_report', $mixed);
  }
}