MDL-60538 lesson: check if max attempts exceeded, use new lang string
authorMihail Geshoski <mihail@moodle.com>
Wed, 25 Oct 2017 01:00:20 +0000 (09:00 +0800)
committerMihail Geshoski <mihail@moodle.com>
Wed, 25 Oct 2017 01:00:20 +0000 (09:00 +0800)
mod/lesson/lang/en/lesson.php
mod/lesson/locallib.php

index 9e3329e..4bc9b93 100644 (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.)';
index 1253979..5eb0341 100644 (file)
@@ -4100,7 +4100,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 = '';