MDL-39488 Lesson Module: Fixed PHP error matching question,
if one or more options have not been selected.
This commit is contained in:
@@ -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.';
|
||||
|
||||
@@ -161,18 +161,13 @@ class lesson_page_type_matching extends lesson_page {
|
||||
}
|
||||
|
||||
$response = $data->response;
|
||||
$empty = 0;
|
||||
|
||||
foreach ($response as $resp) {
|
||||
if ($resp != '') {
|
||||
break;
|
||||
} else {
|
||||
$empty ++;
|
||||
if ($resp == '') {
|
||||
$result->noanswer = true;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
if ($empty == count($response)) {
|
||||
$result->noanswer = true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
$answers = $this->get_answers();
|
||||
|
||||
@@ -191,7 +186,7 @@ class lesson_page_type_matching extends lesson_page {
|
||||
foreach ($response as $id => $value) {
|
||||
$userresponse[] = $value;
|
||||
// Make sure the user's answer exists in question's answer
|
||||
if (array_key_exists($id, $answers) && $value) {
|
||||
if (array_key_exists($id, $answers)) {
|
||||
$answer = $answers[$id];
|
||||
$result->studentanswer .= '<br />'.format_text($answer->answer, $answer->answerformat, $formattextdefoptions).' = '.$answers[$value]->response;
|
||||
if ($id == $value) {
|
||||
|
||||
Reference in New Issue
Block a user