Merge branch 'MDL-29411_20' of git://github.com/timhunt/moodle into MOODLE_20_STABLE

This commit is contained in:
Sam Hemelryk
2011-09-27 11:17:59 +13:00
2 changed files with 20 additions and 1 deletions
+14 -1
View File
@@ -284,7 +284,7 @@ class question_match_qtype extends default_questiontype {
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 @@ class question_match_qtype extends default_questiontype {
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 @@ class question_randomsamatch_qtype extends question_match_qtype {
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 ////