public function Course::__construct in Course 6
Parameters
stdClass $node:
stdClass $user:
Overrides CourseHandler::__construct
File
- includes/
course.core.inc, line 381 - course.core.inc File for main Course class.
Class
- Course
- An object that holds CourseObjects and tracker functions?
Code
public function __construct($node, $user = NULL) {
$this->primaryKey = 'nid';
$this->handlerType = 'course';
$this->table = 'course_node';
if (is_object($node)) {
$this->node = $node;
}
else {
$this->node = node_load($node);
}
if (is_object($user)) {
$this->user = $user;
}
else {
$this->user = user_load($user);
}
$sql = "SELECT * FROM {course_node} WHERE nid = %d";
$result = db_query($sql, $this->node->nid);
if ($config = db_fetch_array($result)) {
parent::__construct($config);
}
else {
parent::__construct(array(
'nid' => $this->node->nid,
'uid' => $this->user->uid,
));
}
$this->tracker = new CourseReport($this);
}