You are here

public function CourseObjectNode::create in Course 7

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

Create a node and set it as this course object's node.

Parameters

stdClass $node: A node to be processed for creation, or none to create a generic node. If a node is provided, it must have at least a type.

Overrides CourseObject::create

3 calls to 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
Create a node and set it as this course object's node.
CourseObjectQuiz::create in modules/course_quiz/course_quiz.classes.inc
Create the quiz node and set it as this object's instance.
5 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
Create a node and set it as this course object's node.
CourseObjectQuiz::create in modules/course_quiz/course_quiz.classes.inc
Create the quiz node and set it as this object's instance.
CourseObjectSignup::create in modules/course_signup/course_signup.classes.inc
Create a node and set it as this course object's node.
CourseObjectUbercart::create in modules/course_uc/course_uc.classes.inc
Don't create new products.

File

includes/CourseObjectNode.inc, line 96

Class

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

Code

public function create($node = NULL) {
  global $user;
  if (!$node) {
    $node = new stdClass();
  }
  if (!isset($node->type)) {
    $node->type = $this
      ->getOption('node_type');
  }
  $node->title = $this
    ->getTitle();
  $node->uid = $user->uid;
  $language = language_default();
  $node->language = $language->language;
  node_object_prepare($node);
  node_save($node);
  $this
    ->setNode($node);
}