You are here

function CourseObjectQuiz::create in Course 6

Same name and namespace in other branches
  1. 7.2 modules/course_quiz/course_quiz.classes.inc \CourseObjectQuiz::create()
  2. 7 modules/course_quiz/course_quiz.classes.inc \CourseObjectQuiz::create()

Create the quiz node and set it as this object's instance.

Overrides CourseObjectNode::create

File

modules/course_quiz/course_quiz.classes.inc, line 8

Class

CourseObjectQuiz

Code

function create() {
  $quiz = new stdClass();
  $quiz->auto_created = TRUE;
  $quiz->type = 'quiz';
  $quiz->title = $this
    ->getTitle();
  $quiz->uid = $this->user->uid;
  $quiz->quiz_always = TRUE;
  $quiz->quiz_open = $quiz->quiz_close = array(
    'month' => date('m'),
    'day' => date('d'),
    'year' => date('Y'),
  );
  $quiz = (object) array_merge(_quiz_get_node_defaults(), (array) $quiz);
  node_save($quiz);
  $this
    ->setNode($quiz);
}