You are here

function CourseObject::__construct in Course 6

Construct a course object from a database record.

Use course_get_course_object to load an object when parameters are not already known.

Parameters

array $config: An object with object_type, module, and instance

object $account: (optional) A user account object.

Course $course: (optional) An instantiated Course object.

Overrides CourseHandler::__construct

1 call to CourseObject::__construct()
CourseObjectNode::__construct in includes/course_object.core.inc
Construct a course object from a database record.
1 method overrides CourseObject::__construct()
CourseObjectNode::__construct in includes/course_object.core.inc
Construct a course object from a database record.

File

includes/course_object.core.inc, line 32

Class

CourseObject
Parent abstract base class of all course objects.

Code

function __construct($config = array(), $account = NULL, Course $course = NULL) {
  $config = (array) $config;
  $this->serializedField = 'data';
  $this->handlerType = 'course_object';
  $this->primaryKey = 'coid';
  $this->table = 'course_outline';

  // Pass configuration to parent.
  parent::__construct($config);
  if (!$account) {
    global $user;
    $account = $user;
  }
  $this->user = $account;
  if ($course) {
    $this->course = $course;
  }
  $this->courseObjectFulfillment = new CourseObjectFulfillment($this, $account);
}