Merge branch 'MDL-39488_m24' of git://github.com/rwijaya/moodle into MOODLE_24_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2013-05-09 15:49:24 +02:00
2 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -280,7 +280,7 @@ $string['nameapproved'] = 'Name approved';
$string['namereject'] = 'Sorry, your name has been rejected by the filter.<br />Please try another name.';
$string['new'] = 'new';
$string['nextpage'] = 'Next page';
$string['noanswer'] = 'No answer given. Please go back and submit an answer.';
$string['noanswer'] = 'One or more questions have no answer given. Please go back and submit an answer.';
$string['noattemptrecordsfound'] = 'No attempt records found: no grade given';
$string['nobranchtablefound'] = 'No content page found';
$string['nocommentyet'] = 'No comment yet.';
+6 -7
View File
@@ -161,11 +161,6 @@ class lesson_page_type_matching extends lesson_page {
}
$response = $data->response;
if (!is_array($response)) {
$result->noanswer = true;
return $result;
}
$answers = $this->get_answers();
$correct = array_shift($answers);
@@ -177,12 +172,16 @@ class lesson_page_type_matching extends lesson_page {
}
unset($answers[$key]);
}
// get he users exact responses for record keeping
// get the user's exact responses for record keeping
$hits = 0;
$userresponse = array();
foreach ($response as $id => $value) {
if ($value == '') {
$result->noanswer = true;
return $result;
}
$userresponse[] = $value;
// Make sure the user's answer is exist in question's answer
// Make sure the user's answer exists in question's answer
if (array_key_exists($id, $answers)) {
$answer = $answers[$id];
$result->studentanswer .= '<br />'.format_text($answer->answer, $answer->answerformat, $formattextdefoptions).' = '.$answers[$value]->response;