You are here

public function CourseObjectPoll::create in Course 7

Same name and namespace in other branches
  1. 6 modules/course_poll/course_poll.classes.inc \CourseObjectPoll::create()
  2. 7.2 modules/course_poll/course_poll.classes.inc \CourseObjectPoll::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 CourseObjectNode::create

File

modules/course_poll/course_poll.classes.inc, line 18

Class

CourseObjectPoll
Parent class for poll tracking.

Code

public function create($node = NULL) {
  $poll = new stdClass();
  $poll->choice = array(
    array(
      'chtext' => 'Yes',
      'chvotes' => 0,
      'weight' => 0,
    ),
    array(
      'chtext' => 'No',
      'chvotes' => 0,
      'weight' => 0,
    ),
  );
  $poll->type = 'poll';
  $poll->active = 1;
  $poll->runtime = 0;
  parent::create($poll);
}