function print_question(&$question, &$state, $number, $cmoptions, $options) { global $CFG; $isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE; // For editing teachers print a link to an editing popup window $editlink = $this->get_question_edit_link($question, $cmoptions, $options); $context = $this->get_context_by_category_id($question->category); $question->questiontext = quiz_rewrite_question_urls($question->questiontext, 'pluginfile.php', $context->id, 'question', 'questiontext', array($state->attempt, $state->question), $question->id); $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions); $generalfeedback = ''; if ($isfinished && $options->generalfeedback) { $question->generalfeedback = quiz_rewrite_question_urls($question->generalfeedback, 'pluginfile.php', $context->id, 'question', 'generalfeedback', array($state->attempt, $state->question), $question->id); $generalfeedback = $this->format_text($question->generalfeedback, $question->generalfeedbackformat, $cmoptions); } include "{$CFG->dirroot}/question/type/description/question.html"; }
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG; $context = $this->get_context_by_category_id($question->category); $answers =& $question->options->answers; $readonly = empty($options->readonly) ? '' : 'disabled="disabled"'; // Only use the rich text editor for the first essay question on a page. $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; $inputname = $question->name_prefix; $stranswer = get_string("answer", "quiz") . ': '; /// set question text and media $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); // feedback handling $feedback = ''; if ($options->feedback && !empty($answers)) { foreach ($answers as $answer) { $feedback = quiz_rewrite_question_urls($answer->feedback, 'pluginfile.php', $context->id, 'question', 'answerfeedback', array($state->attempt, $state->question), $answer->id); $feedback = format_text($feedback, $answer->feedbackformat, $formatoptions, $cmoptions->course); } } // get response value if (isset($state->responses[''])) { $value = $state->responses['']; } else { $value = ''; } // answer if (empty($options->readonly)) { // the student needs to type in their answer so print out a text editor $answer = print_textarea(can_use_html_editor(), 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true); } else { // it is read only, so just format the students answer and output it $safeformatoptions = new stdClass(); $safeformatoptions->para = false; $answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course); $answer = '<div class="answerreview">' . $answer . '</div>'; } include "{$CFG->dirroot}/question/type/essay/display.html"; }
/** * Prepare the text of a subquestion for output. * @param object $subquestion * @param object $state * @param object $context * @return string html fragment. */ function format_subquestion_text($subquestion, $state, $context) { return quiz_rewrite_question_urls($subquestion->questiontext, 'pluginfile.php', $context->id, 'qtype_match', 'subquestion', array($state->attempt, $state->question), $subquestion->id); }
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG, $OUTPUT; $context = $this->get_context_by_category_id($question->category); $subquestions = $state->options->subquestions; $correctanswers = $this->get_correct_responses($question, $state); $nameprefix = $question->name_prefix; $answers = array(); // Answer choices formatted ready for output. $allanswers = array(); // This and the next used to detect identical answers $answerids = array(); // and adjust ids. $responses =& $state->responses; // Prepare a list of answers, removing duplicates. foreach ($subquestions as $subquestion) { foreach ($subquestion->options->answers as $ans) { $allanswers[$ans->id] = $ans->answer; if (!in_array($ans->answer, $answers)) { $answers[$ans->id] = strip_tags(format_string($ans->answer, false)); $answerids[$ans->answer] = $ans->id; } } } // Fix up the ids of any responses that point the the eliminated duplicates. foreach ($responses as $subquestionid => $ignored) { if ($responses[$subquestionid]) { $responses[$subquestionid] = $answerids[$allanswers[$responses[$subquestionid]]]; } } foreach ($correctanswers as $subquestionid => $ignored) { $correctanswers[$subquestionid] = $answerids[$allanswers[$correctanswers[$subquestionid]]]; } // Shuffle the answers $answers = draw_rand_array($answers, count($answers)); // Print formulation $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions); // Print the input controls foreach ($subquestions as $key => $subquestion) { if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) { // Subquestion text: $a = new stdClass(); $text = quiz_rewrite_question_urls($subquestion->questiontext, 'pluginfile.php', $context->id, 'qtype_match', 'subquestion', array($state->attempt, $state->question), $subquestion->id); $a->text = $this->format_text($text, $subquestion->questiontextformat, $cmoptions); // Drop-down list: $menuname = $nameprefix . $subquestion->id; $response = isset($state->responses[$subquestion->id]) ? $state->responses[$subquestion->id] : '0'; $a->class = ' '; $a->feedbackimg = ' '; if ($options->readonly and $options->correct_responses) { if (isset($correctanswers[$subquestion->id]) and $correctanswers[$subquestion->id] == $response) { $correctresponse = 1; } else { $correctresponse = 0; } if ($options->feedback && $response) { $a->class = question_get_feedback_class($correctresponse); $a->feedbackimg = question_get_feedback_image($correctresponse); } } $attributes = array(); $attributes['disabled'] = $options->readonly ? 'disabled' : null; $a->control = html_writer::select($answers, $menuname, $response, array('' => 'choosedots'), $attributes); // Neither the editing interface or the database allow to provide // fedback for this question type. // However (as was pointed out in bug bug 3294) the randomsamatch // type which reuses this method can have feedback defined for // the wrapped shortanswer questions. //if ($options->feedback // && !empty($subquestion->options->answers[$responses[$key]]->feedback)) { // print_comment($subquestion->options->answers[$responses[$key]]->feedback); //} $anss[] = $a; } } include "{$CFG->dirroot}/question/type/match/display.html"; }
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG; $context = $this->get_context_by_category_id($question->category); /// This implementation is also used by question type 'numerical' $readonly = empty($options->readonly) ? '' : 'readonly="readonly"'; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; $nameprefix = $question->name_prefix; /// Print question text and media $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); /// Print input controls if (isset($state->responses['']) && $state->responses[''] != '') { $value = ' value="' . s($state->responses['']) . '" '; } else { $value = ' value="" '; } $inputname = ' name="' . $nameprefix . '" '; $feedback = ''; $class = ''; $feedbackimg = ''; if ($options->feedback) { $class = question_get_feedback_class(0); $feedbackimg = question_get_feedback_image(0); //this is OK for the first answer with a good response foreach ($question->options->answers as $answer) { if ($this->test_response($question, $state, $answer)) { // Answer was correct or partially correct. $class = question_get_feedback_class($answer->fraction); $feedbackimg = question_get_feedback_image($answer->fraction); if ($answer->feedback) { $answer->feedback = quiz_rewrite_question_urls($answer->feedback, 'pluginfile.php', $context->id, 'question', 'answerfeedback', array($state->attempt, $state->question), $answer->id); $feedback = format_text($answer->feedback, $answer->feedbackformat, $formatoptions, $cmoptions->course); } break; } } } /// Removed correct answer, to be displayed later MDL-7496 include $this->get_display_html_path(); }
/** * Prints the question including the number, grading details, content, * feedback and interactions * * This function prints the question including the question number, * grading details, content for the question, any feedback for the previously * submitted responses and the interactions. The default implementation calls * various other methods to print each of these parts and most question types * will just override those methods. * @param object $question The question to be rendered. Question type * specific information is included. The * maximum possible grade is in ->maxgrade. The name * prefix for any named elements is in ->name_prefix. * @param object $state The state to render the question in. The grading * information is in ->grade, ->raw_grade and * ->penalty. The current responses are in * ->responses. This is an associative array (or the * empty string or null in the case of no responses * submitted). The last graded state is in * ->last_graded (hence the most recently graded * responses are in ->last_graded->responses). The * question type specific information is also * included. * @param integer $number The number for this question. * @param object $cmoptions * @param object $options An object describing the rendering options. */ function print_question(&$question, &$state, $number, $cmoptions, $options, $context = null) { /* The default implementation should work for most question types provided the member functions it calls are overridden where required. The layout is determined by the template question.html */ global $CFG, $OUTPUT; $context = $this->get_context_by_category_id($question->category); $question->questiontext = quiz_rewrite_question_urls($question->questiontext, 'pluginfile.php', $context->id, 'question', 'questiontext', array($state->attempt, $state->question), $question->id); $question->generalfeedback = quiz_rewrite_question_urls($question->generalfeedback, 'pluginfile.php', $context->id, 'question', 'generalfeedback', array($state->attempt, $state->question), $question->id); $isgraded = question_state_is_graded($state->last_graded); if (isset($question->randomquestionid)) { $actualquestionid = $question->randomquestionid; } else { $actualquestionid = $question->id; } // For editing teachers print a link to an editing popup window $editlink = $this->get_question_edit_link($question, $cmoptions, $options); $generalfeedback = ''; if ($isgraded && $options->generalfeedback) { $generalfeedback = $this->format_text($question->generalfeedback, $question->generalfeedbackformat, $cmoptions); } $grade = ''; if ($question->maxgrade > 0 && $options->scores) { if ($cmoptions->optionflags & QUESTION_ADAPTIVE) { if ($isgraded) { $grade = question_format_grade($cmoptions, $state->last_graded->grade) . '/'; } else { $grade = '--/'; } } $grade .= question_format_grade($cmoptions, $question->maxgrade); } $formatoptions = new stdClass(); $formatoptions->para = false; $comment = format_text($state->manualcomment, $state->manualcommentformat, $formatoptions, $cmoptions->course); $commentlink = ''; if (!empty($options->questioncommentlink)) { $strcomment = get_string('commentorgrade', 'quiz'); $link = new moodle_url($options->questioncommentlink, array('question' => $actualquestionid)); $action = new popup_action('click', $link, 'commentquestion', array('height' => 480, 'width' => 750)); $commentlink = $OUTPUT->container($OUTPUT->action_link($link, $strcomment, $action), 'commentlink'); } $history = $this->history($question, $state, $number, $cmoptions, $options); include "{$CFG->dirroot}/question/type/question.html"; }
/** * This function has been reinserted in numerical/questiontype.php to simplify * the separate rendering of number and unit */ function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG, $OUTPUT; $context = $this->get_context_by_category_id($question->category); $readonly = empty($options->readonly) ? '' : 'readonly="readonly"'; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; $nameprefix = $question->name_prefix; $component = 'qtype_' . $question->qtype; // rewrite instructions text $question->options->instructions = quiz_rewrite_question_urls($question->options->instructions, 'pluginfile.php', $context->id, $component, 'instruction', array($state->attempt, $state->question), $question->id); /// Print question text and media $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); /// Print input controls // as the entry is controlled the question type here is numerical // In all cases there is a text input for the number // If $question->options->showunits == NUMERICALQUESTIONUNITTEXTDISPLAY // there is an additional text input for the unit // If $question->options->showunits == NUMERICALQUESTIONUNITMULTICHOICEDISPLAY" // radio elements display the defined unit // The code allows the input number elememt to be displayed // before i.e. at left or after at rigth of the unit variants. $nameanswer = "name=\"" . $question->name_prefix . "answer\""; $nameunit = "name=\"" . $question->name_prefix . "unit\""; // put old answer data in $state->responses['answer'] and $state->responses['unit'] if (isset($state->responses['']) && $state->responses[''] != '' && !isset($state->responses['answer'])) { $this->split_old_answer($state->responses[''], $question->options->units, $state->responses['answer'], $state->responses['unit']); } // prepare the values of the input elements to be dispalyed answer i.e. number and unit if (isset($state->responses['answer']) && $state->responses['answer'] != '') { $valueanswer = ' value="' . s($state->responses['answer']) . '" '; } else { $valueanswer = ' value="" '; } if (isset($state->responses['unit']) && $state->responses['unit'] != '') { $valueunit = ' value="' . s($state->responses['unit']) . '" '; } else { $valueunit = ' value="" '; if ($question->options->showunits == NUMERICALQUESTIONUNITTEXTDISPLAY) { $valueunit = ' value="' . s($question->options->units[0]->unit) . '" '; } } $feedback = ''; $class = ''; $classunit = ''; $classunitvalue = ''; $feedbackimg = ''; $feedbackimgunit = ''; $answerasterisk = false; $response = ''; $valid_numerical_unit = false; $valid_numerical_unit_index = -1; $unit_in_numerical_answer = false; $rawgrade = 0; if ($options->feedback) { $class = question_get_feedback_class(0); $classunit = question_get_feedback_class(0); $feedbackimg = question_get_feedback_image(0); $feedbackimgunit = question_get_feedback_image(0); $classunitvalue = 0; $valid_numerical_unit_index = -1; // if there is unit in answer and unitgradingtype = 0 // the grade is 0 //this is OK for the first answer with a good response // having to test for * so response as long as not empty // $response = $this->extract_numerical_response($state->responses['answer']); // test for a greater than 0 grade foreach ($question->options->answers as $answer) { if ($this->test_response($question, $state, $answer)) { // Answer was correct or partially correct. if ($answer->answer === '*') { $answerasterisk = true; } // in all cases $class = question_get_feedback_class($answer->fraction); $feedbackimg = question_get_feedback_image($answer->fraction); if ($question->options->unitgradingtype == 0 || $question->options->unitgradingtype == 0 && $answer->answer === '*') { // if * then unit has the $answer->fraction value // if $question->options->unitgradingtype == 0 everything has been checked // if $question->options->showunits == NUMERICALQUESTIONUNITTEXTINPUTDISPLAY // then number - unit combination has been used to test response // so the unit should have same color $classunit = question_get_feedback_class($answer->fraction); $feedbackimgunit = question_get_feedback_image($answer->fraction); $rawgrade = $answer->fraction; } else { /* so we need to apply unit grading i.e. to check if the number-unit combination * was the rigth one * on NUMERICALQUESTIONUNITTEXTINPUTDISPLAY we need only to ckeck if applyunit will test OK * with the $state->responses['unit'] value which cannot be empty * if $state->responses['unit'] * if apply-unit is true with a specific unit as long as the unit as been written either in the * we need the numerical response and test it with the available units * if the unit used is good then it should be set OK * however the unit could have been put in the number element in this case * the unit penalty should be apllied. * testing apply_unit with no units will get us a false response if there is any text in it * testing apply_unit with a given unit will get a good value if the number is good with this unit * apply unit will return the numerical if * we need to know which conditions let to a good numerical value that were done in the */ $valid_numerical_unit = false; $rawgrade = $answer->fraction; $valid_numerical_unit_index = -1; $invalid_unit_in_numerical_answer = false; if ($answerasterisk) { $classunit = question_get_feedback_class($answer->fraction); $feedbackimgunit = question_get_feedback_image($answer->fraction); $valid_numerical_unit = true; //everything is true with * } else { // if( isset($state->responses['unit']) && $state->responses['unit'] != '' ){// unit should be written in the unit input or checked in multichoice // we need to see if something was written in the answer field that was not in the number // although we cannot actually detect units put before the number which will cause bad numerical. // use extract response $response = $this->extract_numerical_response($state->responses['answer']); if (isset($response->unit) && $response->unit != '') { $unit_in_numerical_answer = true; } else { $unit_in_numerical_answer = false; } // the we let the testing to the two cases either // NUMERICALQUESTIONUNITTEXTINPUTDISPLAY or // NUMERICALQUESTIONUNITMULTICHOICEDISPLAY if (!isset($state->responses['unit']) || $state->responses['unit'] == '') { // unit should be written in the unit input or checked in multichoice $valid_numerical_unit = false; $classunit = question_get_feedback_class(0); $feedbackimgunit = question_get_feedback_image(0); $empty_unit = true; } else { // echo"<p> some unit answer <pre>";print_r($answer) ;echo"</pre></p>"; // echo"<p> some unit answer <pre>";print_r($answer) ;echo"</pre></p>"; $empty_unit = false; $valid_numerical_unit = false; foreach ($question->options->units as $key => $unit) { if ($unit->unit == $state->responses['unit']) { // $response = $this->apply_unit($state->responses['answer'].$unit->unit, array($question->options->units[$key])) ; // echo "<p> avant false valid_numerical_unit_index $valid_numerical_unit_index ".$state->responses['answer']."</p>"; $invalid_unit_found = 0; if ($response->number !== false) { //echo "<p> avanr get valid_numerical_unit_index $valid_numerical_unit_index </p>"; // $this->get_tolerance_interval($answer); $testresponse = $response->number / $unit->multiplier; if ($answer->min <= $testresponse && $testresponse <= $answer->max) { //echo "<p> apres min max valid_numerical_unit_index $valid_numerical_unit_index </p>"; $classunit = question_get_feedback_class($answer->fraction); //question_get_feedback_class(1); $feedbackimgunit = question_get_feedback_image($rawgrade); $valid_numerical_unit = true; $valid_numerical_unit_index = $key; break; } } } } } } } if ($answer->feedback) { $answer->feedback = quiz_rewrite_question_urls($answer->feedback, 'pluginfile.php', $context->id, 'question', 'answerfeedback', array($state->attempt, $state->question), $answer->id); $feedback = format_text($answer->feedback, $answer->feedbackformat, $formatoptions, $cmoptions->course); } break; } } } $state->options->raw_unitpenalty = 0; $raw_unitpenalty = 0; if ($question->options->showunits == NUMERICALQUESTIONUNITNODISPLAY || $question->options->showunits == NUMERICALQUESTIONUNITTEXTDISPLAY) { $classunitvalue = 1; } if (!$answerasterisk && $question->options->unitgradingtype != 0 && (!$valid_numerical_unit || $unit_in_numerical_answer)) { if ($question->options->unitgradingtype == 1) { $raw_unitpenalty = $question->options->unitpenalty * $rawgrade; } else { $raw_unitpenalty = $question->options->unitpenalty; } $state->options->raw_unitpenalty = $raw_unitpenalty; } /// Removed correct answer, to be displayed later MDL-7496 include "{$CFG->dirroot}/question/type/numerical/display.html"; }
/** * Prints the main content of the question including any interactions */ function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG; $context = $this->get_context_by_category_id($question->category); $readonly = $options->readonly ? ' disabled="disabled"' : ''; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; // Print question formulation $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); $answers =& $question->options->answers; $trueanswer =& $answers[$question->options->trueanswer]; $falseanswer =& $answers[$question->options->falseanswer]; $correctanswer = $trueanswer->fraction == 1 ? $trueanswer : $falseanswer; $trueclass = ''; $falseclass = ''; $truefeedbackimg = ''; $falsefeedbackimg = ''; // Work out which radio button to select (if any) if (isset($state->responses[''])) { $response = $state->responses['']; } else { $response = ''; } $truechecked = $response == $trueanswer->id ? ' checked="checked"' : ''; $falsechecked = $response == $falseanswer->id ? ' checked="checked"' : ''; // Work out visual feedback for answer correctness. if ($options->feedback) { if ($truechecked) { $trueclass = question_get_feedback_class($trueanswer->fraction); } else { if ($falsechecked) { $falseclass = question_get_feedback_class($falseanswer->fraction); } } } if ($options->feedback || $options->correct_responses) { if (isset($answers[$response])) { $truefeedbackimg = question_get_feedback_image($trueanswer->fraction, !empty($truechecked) && $options->feedback); $falsefeedbackimg = question_get_feedback_image($falseanswer->fraction, !empty($falsechecked) && $options->feedback); } } $inputname = ' name="' . $question->name_prefix . '" '; $trueid = $question->name_prefix . 'true'; $falseid = $question->name_prefix . 'false'; $radiotrue = '<input type="radio"' . $truechecked . $readonly . $inputname . 'id="' . $trueid . '" value="' . $trueanswer->id . '" /><label for="' . $trueid . '">' . s($trueanswer->answer) . '</label>'; $radiofalse = '<input type="radio"' . $falsechecked . $readonly . $inputname . 'id="' . $falseid . '" value="' . $falseanswer->id . '" /><label for="' . $falseid . '">' . s($falseanswer->answer) . '</label>'; $feedback = ''; if ($options->feedback and isset($answers[$response])) { $chosenanswer = $answers[$response]; $chosenanswer->feedback = quiz_rewrite_question_urls($chosenanswer->feedback, 'pluginfile.php', $context->id, 'question', 'answerfeedback', array($state->attempt, $state->question), $chosenanswer->id); $feedback = format_text($chosenanswer->feedback, $chosenanswer->feedbackformat, $formatoptions, $cmoptions->course); } include "{$CFG->dirroot}/question/type/truefalse/display.html"; }
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG; // required by file api $context = $this->get_context_by_category_id($question->category); $component = 'qtype_' . $question->qtype; $answers =& $question->options->answers; $correctanswers = $this->get_correct_responses($question, $state); $readonly = empty($options->readonly) ? '' : 'disabled="disabled"'; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; // Print formulation $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); $answerprompt = $question->options->single ? get_string('singleanswer', 'quiz') : get_string('multipleanswers', 'quiz'); // Print each answer in a separate row foreach ($state->options->order as $key => $aid) { $answer =& $answers[$aid]; $checked = ''; $chosen = false; if ($question->options->single) { $type = 'type="radio"'; $name = "name=\"{$question->name_prefix}\""; if (isset($state->responses['']) and $aid == $state->responses['']) { $checked = 'checked="checked"'; $chosen = true; } } else { $type = ' type="checkbox" '; $name = "name=\"{$question->name_prefix}{$aid}\""; if (isset($state->responses[$aid])) { $checked = 'checked="checked"'; $chosen = true; } } $a = new stdClass(); $a->id = $question->name_prefix . $aid; $a->class = ''; $a->feedbackimg = ''; // Print the control $a->control = "<input {$readonly} id=\"{$a->id}\" {$name} {$checked} {$type} value=\"{$aid}\" />"; if ($options->correct_responses && $answer->fraction > 0) { $a->class = question_get_feedback_class(1); } if ($options->feedback && $chosen || $options->correct_responses) { if ($type == ' type="checkbox" ') { $a->feedbackimg = question_get_feedback_image($answer->fraction > 0 ? 1 : 0, $chosen && $options->feedback); } else { $a->feedbackimg = question_get_feedback_image($answer->fraction, $chosen && $options->feedback); } } // Print the answer text $a->text = $this->number_in_style($key, $question->options->answernumbering) . format_text($answer->answer, $answer->answerformat, $formatoptions, $cmoptions->course); // Print feedback if feedback is on if (($options->feedback || $options->correct_responses) && $checked) { // feedback for each answer $a->feedback = quiz_rewrite_question_urls($answer->feedback, 'pluginfile.php', $context->id, 'question', 'answerfeedback', array($state->attempt, $state->question), $answer->id); $a->feedback = format_text($a->feedback, $answer->feedbackformat, $formatoptions, $cmoptions->course); } else { $a->feedback = ''; } $anss[] = clone $a; } $feedback = ''; if ($options->feedback) { if ($state->raw_grade >= $question->maxgrade / 1.01) { $feedback = $question->options->correctfeedback; $feedbacktype = 'correctfeedback'; } else { if ($state->raw_grade > 0) { $feedback = $question->options->partiallycorrectfeedback; $feedbacktype = 'partiallycorrectfeedback'; } else { $feedback = $question->options->incorrectfeedback; $feedbacktype = 'incorrectfeedback'; } } $feedback = quiz_rewrite_question_urls($feedback, 'pluginfile.php', $context->id, $component, $feedbacktype, array($state->attempt, $state->question), $question->id); $feedbackformat = $feedbacktype . 'format'; $feedback = format_text($feedback, $question->options->{$feedbackformat}, $formatoptions, $cmoptions->course); } include "{$CFG->dirroot}/question/type/multichoice/display.html"; }