From 8fa0a97895b6229a1fa3984846c71b9accf23f1e Mon Sep 17 00:00:00 2001 From: Gareth Barnard <1058419+gjb2048@users.noreply.github.com> Date: Wed, 24 Jul 2024 21:57:54 +0100 Subject: [PATCH] Use section anchors in links when editing - pt 2. --- lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib.php b/lib.php index c7b52cb1..56f267fb 100755 --- a/lib.php +++ b/lib.php @@ -56,14 +56,14 @@ protected function __construct($format, $courseid) { parent::__construct($format, $courseid); if ($courseid != 1) { - $currentsettings = $this->get_settings(); - if (!empty($currentsettings['popup'])) { - if ($currentsettings['popup'] == 2) { - global $PAGE; - $context = context_course::instance($courseid); - if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) { - $this->coursedisplay = COURSE_DISPLAY_MULTIPAGE; - } else { + global $USER; + $context = context_course::instance($courseid); + if (!empty($USER->editing) && has_capability('moodle/course:update', $context)) { + $this->coursedisplay = COURSE_DISPLAY_SINGLEPAGE; + } else { + $currentsettings = $this->get_settings(); + if (!empty($currentsettings['popup'])) { + if ($currentsettings['popup'] == 2) { $this->coursedisplay = COURSE_DISPLAY_SINGLEPAGE; } }