You are here

function CourseObjectFulfillment::__construct in Course 6

Construct the fulfillment object.

A CourseObject and user are required to construct a fulfillment object.

Parameters

CourseObject $courseObject:

Object $user:

Overrides CourseHandler::__construct

File

includes/course_object.core.inc, line 981

Class

CourseObjectFulfillment
Parent class for course object fulfillment.

Code

function __construct(CourseObject $courseObject, $user) {

  // Set storage.
  $this->handlerType = 'course_object_fulfillment';
  $this->table = 'course_outline_fulfillment';
  $this->primaryKey = 'cofid';
  $this->serializedField = 'info';
  $this->courseObject = $courseObject;
  $sql = "SELECT * FROM {course_outline_fulfillment} WHERE coid = %d AND uid = %d";
  $fulfillment = db_fetch_array(db_query($sql, $this->courseObject
    ->getId(), $user->uid));
  $this
    ->setOptions($fulfillment);

  // Set course object ID.
  $this
    ->setOption('coid', $this->courseObject
    ->getId());
  $this
    ->setOption('uid', $user->uid);
}