Merge branch 'MDL-74127-master' of https://github.com/peterRd/moodle

This commit is contained in:
Sara Arjona 2022-03-17 09:14:58 +01:00
commit 95e3d07435
3 changed files with 6 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}