Permalink
Browse files

Merge branch 'MDL-26714' of git://github.com/timhunt/moodle

  • Loading branch information...
stronk7 committed Mar 13, 2011
2 parents 9929445 + 9316d66 commit 7e0579cb8c4ef2caa32fc4094f4aa74e703f4444
Showing with 31 additions and 0 deletions.
  1. +31 −0 question/type/multianswer/questiontype.php
@@ -599,6 +599,37 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions
echo '</div>';
}
+ public function compare_responses($question, $state, $teststate) {
+ global $QTYPES;
+
+ foreach ($question->options->questions as $key => $wrapped) {
+ if (empty($wrapped)) {
+ continue;
+ }
+
+ $stateforquestion = clone($state);
+ if (isset($state->responses[$key])) {
+ $stateforquestion->responses[''] = $state->responses[$key];
+ } else {
+ $stateforquestion->responses[''] = '';
+ }
+
+ $teststateforquestion = clone($teststate);
+ if (isset($teststate->responses[$key])) {
+ $teststateforquestion->responses[''] = $teststate->responses[$key];
+ } else {
+ $teststateforquestion->responses[''] = '';
+ }
+
+ if (!$QTYPES[$wrapped->qtype]->compare_responses($wrapped,
+ $stateforquestion, $teststateforquestion)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
function grade_responses(&$question, &$state, $cmoptions) {
global $QTYPES;
$teststate = clone($state);

0 comments on commit 7e0579c

Please sign in to comment.