Skip to content

Commit

Permalink
MDL-29411 questiontext images not displayed in randomsamatch generate…
Browse files Browse the repository at this point in the history
…d questions.
  • Loading branch information
timhunt committed Sep 26, 2011
1 parent 51e1e3d commit 5751edb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 14 additions & 1 deletion question/type/match/questiontype.php
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions question/type/randomsamatch/questiontype.php
Expand Up @@ -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 ////
Expand Down

0 comments on commit 5751edb

Please sign in to comment.