public function formulation_and_controls(question_attempt $qa, question_display_options $options) { global $PAGE; $question = $qa->get_question(); if ($question->answerdisplay == "dragdrop") { $PAGE->requires->js('/question/type/gapfill/jquery/jquery-1.4.2.js'); $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.core.min.js'); $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.widget.min.js'); $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.mouse.min.js'); $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.draggable.min.js'); $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.droppable.min.js'); $PAGE->requires->js('/question/type/gapfill/dragdrop.js'); } $answers = $qa->get_step(0)->get_qt_var('_allanswers'); $output = ''; if ($question->answerdisplay == "dragdrop") { $ddclass = " draggable answers "; $answers = $this->get_answers('dragdrop', $answers); foreach ($answers as $value) { $output .= '<span class="' . $ddclass . '">' . $value . "</span> "; } $output .= "</br></br>"; } $marked_gaps = $question->get_marked_gaps($qa, $options); foreach ($question->textfragments as $place => $fragment) { if ($place > 0) { $output .= $this->embedded_element($qa, $place, $options, $marked_gaps); } /* format the non entry field parts of the question text, this will also ensure images get displayed */ $output .= $question->format_text($fragment, $question->questiontextformat, $qa, 'question', 'questiontext', $question->id); } print "<br/>"; if ($qa->get_state() == question_state::$invalid) { $output .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $output)), array('class' => 'validationerror')); } return $output; }
protected function init_order(question_attempt $qa) { if (is_null($this->order)) { $this->order = explode(',', $qa->get_step(0)->get_qt_var('_order')); } }
public function notify_metadata_modified(question_attempt $qa, $name) { if (array_key_exists($qa->get_slot(), $this->attemptsadded)) { return; } if ($this->is_step_added($qa->get_step(0)) !== false) { return; } if (isset($this->metadataadded[$qa->get_slot()][$name])) { return; } if (isset($this->metadatamodified[$qa->get_slot()][$name])) { return; } $this->metadatamodified[$qa->get_slot()][$name] = $qa; }