You are here

function course_enrolment_load in Course 6

Load an enrollment from a node ID and user ID.

Parameters

int $nid: Enrollment ID, or node ID.

int $uid: User ID.

Return value

mixed Enrollment object or FALSE

11 calls to course_enrolment_load()
CourseAccessTestCase::testDurationExpiration in tests/CourseAccessTestCase.test
Test the enrollment duration. This does not test the enrollment end date being set correctly.
CourseEnrollmentTestCase::testCourseDuration in tests/CourseEnrollmentTestCase.test
Test for course duration being set properly on enrollment.
CourseEnrollmentTestCase::testCourseEnrollment in tests/CourseEnrollmentTestCase.test
Test for enrollment access and timestamping.
CourseObjectSignupTestCase::testSignupEnrollment in modules/course_signup/course_signup.test
course_course_credit_check_completion in ./course.module
Implements course_credit_check_completion().

... See full list

1 string reference to 'course_enrolment_load'
course_views_bulk_operations_object_info in ./course.module
Implements hook_views_bulk_operations_object_info().

File

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

Code

function course_enrolment_load($nid, $uid = NULL) {
  if (is_object($nid)) {
    $nid = $nid->nid;
  }
  if (!$uid) {
    $sql = "SELECT * FROM {course_enrolment} WHERE eid = %d";
    return db_fetch_object(db_query($sql, $nid));
  }
  if (is_object($uid)) {
    $uid = $uid->uid;
  }
  $sql = "SELECT * FROM {course_enrolment} WHERE nid = %d AND uid = %d";
  return db_fetch_object(db_query($sql, $nid, $uid));
}