From 07e8f72f720425db48c896de4caaaaac1304e478 Mon Sep 17 00:00:00 2001 From: Peter Dias Date: Mon, 14 Mar 2022 10:43:53 +0800 Subject: [PATCH] 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. --- mod/lesson/classes/output/report_action_menu.php | 2 +- mod/lesson/continue.php | 2 +- mod/lesson/locallib.php | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mod/lesson/classes/output/report_action_menu.php b/mod/lesson/classes/output/report_action_menu.php index 1735932a420..f8544036e91 100644 --- a/mod/lesson/classes/output/report_action_menu.php +++ b/mod/lesson/classes/output/report_action_menu.php @@ -69,7 +69,7 @@ class report_action_menu implements templatable, renderable { $reportselect = new \url_select($menu, $this->url->out(false), null, 'lesson-report-select'); $data = [ 'reportselect' => $reportselect->export_for_template($output), - 'heading' => $menu[$reportselect->selected] + 'heading' => $menu[$reportselect->selected] ?? '' ]; return $data; } diff --git a/mod/lesson/continue.php b/mod/lesson/continue.php index f51b550bc1c..673c8536e3c 100644 --- a/mod/lesson/continue.php +++ b/mod/lesson/continue.php @@ -76,7 +76,7 @@ if ($result->nodefaultresponse || $result->inmediatejump) { // Set Messages. $lesson->add_messages_on_page_process($page, $result, $reviewmode); - +$PAGE->set_secondary_active_tab('modulepage'); $PAGE->set_url('/mod/lesson/view.php', array('id' => $cm->id, 'pageid' => $page->id)); $PAGE->set_subpage($page->id); diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index f3a1e15d731..56c0a07da29 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -4229,9 +4229,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; }