Exemple #1
0
    public function display($renderer, $attempt) {
        global $USER, $CFG, $PAGE;
        $answers = $this->get_answers();
        shuffle($answers);

        $params = array('answers'=>$answers, 'lessonid'=>$this->lesson->id, 'contents'=>$this->get_contents(), 'attempt'=>$attempt);
        $mform = new lesson_display_answer_form_truefalse($CFG->wwwroot.'/mod/lesson/continue.php', $params);
        $data = new stdClass;
        $data->id = $PAGE->cm->id;
        $data->pageid = $this->properties->id;
        $mform->set_data($data);
        return $mform->display();
    }
Exemple #2
0
 public function display($renderer, $attempt)
 {
     global $USER, $CFG, $PAGE;
     $answers = $this->get_answers();
     foreach ($answers as $key => $answer) {
         $answers[$key] = parent::rewrite_answers_urls($answer);
     }
     shuffle($answers);
     $params = array('answers' => $answers, 'lessonid' => $this->lesson->id, 'contents' => $this->get_contents(), 'attempt' => $attempt);
     $mform = new lesson_display_answer_form_truefalse($CFG->wwwroot . '/mod/lesson/continue.php', $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();
 }