MDL-60538 lesson: check if max attempts exceeded, use new lang string

This commit is contained in:
Mihail Geshoski
2017-10-25 09:08:29 +08:00
parent bcca46d630
commit c3ddc8e2fd
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -223,6 +223,7 @@ $string['eventquestionanswered'] = 'Question answered';
$string['eventquestionviewed'] = 'Question viewed';
$string['false'] = 'False';
$string['fileformat'] = 'File format';
$string['finalwrong'] = 'Not quite.';
$string['finish'] = 'Finish';
$string['firstanswershould'] = 'First answer should jump to the "Correct" page';
$string['firstwrong'] = 'You have answered incorrectly. Would you like to attempt the question again? (If you now answer the question correctly, it will not count towards your final score.)';
+5 -1
View File
@@ -4070,7 +4070,11 @@ abstract class lesson_page extends lesson_base {
if ($qattempts == 1) {
$result->feedback = $OUTPUT->box(get_string("firstwrong", "lesson"), 'feedback');
} else {
$result->feedback = $OUTPUT->box(get_string("secondpluswrong", "lesson"), 'feedback');
if (!$result->maxattemptsreached) {
$result->feedback = $OUTPUT->box(get_string("secondpluswrong", "lesson"), 'feedback');
} else {
$result->feedback = $OUTPUT->box(get_string("finalwrong", "lesson"), 'feedback');
}
}
} else {
$result->feedback = '';