public function display($renderer, $attempt) { global $CFG, $PAGE; $answers = $this->get_used_answers(); shuffle($answers); $action = $CFG->wwwroot . '/mod/lesson/continue.php'; $params = array('answers' => $answers, 'lessonid' => $this->lesson->id, 'contents' => $this->get_contents(), 'attempt' => $attempt); if ($this->properties->qoption) { $mform = new lesson_display_answer_form_multichoice_multianswer($action, $params); } else { $mform = new lesson_display_answer_form_multichoice_singleanswer($action, $params); } $data = new stdClass(); $data->id = $PAGE->cm->id; $data->pageid = $this->properties->id; $mform->set_data($data); return $mform->display(); }
public function display($renderer, $attempt) { global $CFG, $PAGE; $answers = $this->get_used_answers(); shuffle($answers); $action = $CFG->wwwroot . '/mod/lesson/continue.php'; $params = array('answers' => $answers, 'lessonid' => $this->lesson->id, 'contents' => $this->get_contents(), 'attempt' => $attempt); if ($this->properties->qoption) { $mform = new lesson_display_answer_form_multichoice_multianswer($action, $params); } else { $mform = new lesson_display_answer_form_multichoice_singleanswer($action, $params); } $data = new stdClass(); $data->id = $PAGE->cm->id; $data->pageid = $this->properties->id; $mform->set_data($data); // Trigger an event question viewed. $eventparams = array('context' => context_module::instance($PAGE->cm->id), 'objectid' => $this->properties->id, 'other' => array('pagetype' => $this->get_typestring())); $event = \mod_lesson\event\question_viewed::create($eventparams); $event->trigger(); return $mform->display(); }