You are here

public function CourseObjectNode::create in Course 6

Same name and namespace in other branches
  1. 7.2 includes/CourseObjectNode.inc \CourseObjectNode::create()
  2. 7 includes/CourseObjectNode.inc \CourseObjectNode::create()

Creates a course object.

For example, this would create the new node and return the node ID if this was a CourseObjectNode.

Do not confuse this with save(), which saves the course outline record for tracking.

Course objects should call setInstanceId() if this is a course object that creates external resources.

Overrides CourseObject::create

7 methods override CourseObjectNode::create()
CourseObjectBook::create in modules/course_book/course_book.classes.inc
Make the book.
CourseObjectPoll::create in modules/course_poll/course_poll.classes.inc
Creates a course object.
CourseObjectQuiz::create in modules/course_quiz/course_quiz.classes.inc
Create the quiz node and set it as this object's instance.
CourseObjectScorm::create in modules/course_scorm/course_scorm.classes.inc
Creates a course object.
CourseObjectSignup::create in modules/course_signup/course_signup.classes.inc
Creates a course object.

... See full list

File

includes/course_object.core.inc, line 1110

Class

CourseObjectNode
A course object that uses a node as a base.

Code

public function create() {
  $node = new stdClass();
  $node->type = $this
    ->getOption('node_type');
  $node->title = $this
    ->getTitle();
  $node->uid = $this->user->uid;
  node_save($node);
  $this
    ->setNode($node);
}