Permalink
Browse files

MDL-29411 questiontext images not displayed in randomsamatch generate…

…d questions.
  • Loading branch information...
1 parent 51e1e3d commit 5751edbcb16870a2675fcb41042e3f33acd68acc @timhunt timhunt committed Sep 21, 2011
Showing with 20 additions and 1 deletion.
  1. +14 −1 question/type/match/questiontype.php
  2. +6 −0 question/type/randomsamatch/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;
@@ -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 ////

0 comments on commit 5751edb

Please sign in to comment.