MDL-74127 lesson: Show remaining attempts on all types of jumps

- Show remaining attempts on all types of jumps
- Highlight the lesson tab when viewing the continue page.
This commit is contained in:
Peter Dias
2022-03-17 09:10:28 +08:00
parent 6d7dbaa685
commit 125b689a5c
+4 -2
View File
@@ -4224,9 +4224,11 @@ abstract class lesson_page extends lesson_base {
}
// "number of attempts remaining" message if $this->lesson->maxattempts > 1
// displaying of message(s) is at the end of page for more ergonomic display
if (!$result->correctanswer && ($result->newpageid == 0)) {
// If we are showing the number of remaining attempts, we need to show it regardless of what the next
// jump to page is.
if (!$result->correctanswer) {
// Retrieve the number of attempts left counter for displaying at bottom of feedback page.
if (!empty($this->lesson->maxattempts) && $nattempts >= $this->lesson->maxattempts) {
if ($result->newpageid == 0 && !empty($this->lesson->maxattempts) && $nattempts >= $this->lesson->maxattempts) {
if ($this->lesson->maxattempts > 1) { // don't bother with message if only one attempt
$result->maxattemptsreached = true;
}