function CourseObjectQuiz::create in Course 6
Same name and namespace in other branches
- 7.2 modules/course_quiz/course_quiz.classes.inc \CourseObjectQuiz::create()
- 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
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);
}