Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-29411 questiontext images not displayed in randomsamatch generate…

…d questions.
  • Loading branch information...
commit 5751edbcb16870a2675fcb41042e3f33acd68acc 1 parent 51e1e3d
@timhunt timhunt authored
View
15 question/type/match/questiontype.php
@@ -284,7 +284,7 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions
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);
+ $text = $this->format_subquestion_text($subquestion, $state, $context);
$a->text = $this->format_text($text, $subquestion->questiontextformat, $cmoptions);
// Drop-down list:
@@ -329,6 +329,19 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions
include("$CFG->dirroot/question/type/match/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 grade_responses(&$question, &$state, $cmoptions) {
$subquestions = &$state->options->subquestions;
$responses = &$state->responses;
View
6 question/type/randomsamatch/questiontype.php
@@ -334,6 +334,12 @@ function get_possible_responses(&$question) {
function get_random_guess_score($question) {
return 1/$question->options->choose;
}
+
+ function format_subquestion_text($subquestion, $state, $context) {
+ return quiz_rewrite_question_urls($subquestion->questiontext, 'pluginfile.php',
+ $context->id, 'question', 'questiontext',
+ array($state->attempt, $state->question), $subquestion->id);
+ }
}
//// END OF CLASS ////
Please sign in to comment.
Something went wrong with that request. Please try again.