From 994ccb7845e98d8ab3d2a2aa3ec6990523f4c793 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Wed, 25 Oct 2017 09:00:20 +0800 Subject: [PATCH] MDL-60538 lesson: check if max attempts exceeded, use new lang string --- mod/lesson/lang/en/lesson.php | 1 + mod/lesson/locallib.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/lesson/lang/en/lesson.php b/mod/lesson/lang/en/lesson.php index 9e3329e0c8a..4bc9b93441c 100644 --- a/mod/lesson/lang/en/lesson.php +++ b/mod/lesson/lang/en/lesson.php @@ -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.)'; diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index 125397975c5..5eb0341efd9 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -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 = ''; -- 2.43.0