You are here

public function CourseObject::getFulfillment in Course 7

Same name and namespace in other branches
  1. 6 includes/course_object.core.inc \CourseObject::getFulfillment()
  2. 7.2 includes/CourseObject.inc \CourseObject::getFulfillment()

Get the user's fulfillment for this course object.

Return value

CourseObjectFulfillment

3 calls to CourseObject::getFulfillment()
CourseObjectQuiz::grade in modules/course_quiz/course_quiz.classes.inc
Marks a user's fulfillment record for this object complete if the user passed the quiz.
CourseObjectQuiz::unenroll in modules/course_quiz/course_quiz.classes.inc
Remove all quiz attempts associated with this fulfillment.
CourseObjectWebform::unEnroll in modules/course_webform/course_webform.classes.inc
Remove all webform submissions associated with this fulfillment.

File

includes/CourseObject.inc, line 703

Class

CourseObject
Parent abstract base class of all course objects.

Code

public function getFulfillment($account = NULL) {
  if (!$account) {

    /** @deprecated */
    if (!empty($this->user)) {
      $account = $this->user;
    }
    else {
      global $user;
      $account = $user;
    }
  }
  if ($entities = entity_load('course_object_fulfillment', FALSE, array(
    'coid' => $this
      ->identifier(),
    'uid' => $account->uid,
  ), TRUE)) {
    return reset($entities);
  }
  else {
    return entity_create('course_object_fulfillment', array(
      'coid' => $this
        ->identifier(),
      'uid' => $account->uid,
      'module' => $this->module,
      'object_type' => $this->object_type,
    ));
  }
}