Пример #1
0
 public function display($renderer, $attempt)
 {
     global $USER, $CFG, $PAGE;
     $mform = $this->make_answer_form($attempt);
     $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();
 }
Пример #2
0
 public function display($renderer, $attempt)
 {
     global $USER, $CFG, $PAGE;
     $mform = new lesson_display_answer_form_shortanswer($CFG->wwwroot . '/mod/lesson/continue.php', array('contents' => $this->get_contents(), 'lessonid' => $this->lesson->id));
     $data = new stdClass();
     $data->id = $PAGE->cm->id;
     $data->pageid = $this->properties->id;
     if (isset($USER->modattempts[$this->lesson->id])) {
         $data->answer = s($attempt->useranswer);
     }
     $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();
 }
Пример #3
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();
 }
Пример #4
0
 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();
 }