MDL-59599 navigation: Respect previous activity-level navigation
authorDavid Monllao <davidm@moodle.com>
Wed, 11 Jul 2018 09:52:57 +0000 (11:52 +0200)
committerDavid Monllao <davidm@moodle.com>
Wed, 11 Jul 2018 10:01:08 +0000 (12:01 +0200)
The original patch was overwriting grading methods navigation.

All credit goes to Andrew Nicols.

lib/navigationlib.php

index 3ec8ccc..4a1f7d7 100644 (file)
@@ -2733,7 +2733,7 @@ class global_navigation extends navigation_node {
             $gradenode = $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null,
                 'grades', new pix_icon('i/grades', ''));
             // If the page type matches the grade part, then make the nav drawer grade node (incl. all sub pages) active.
-            if (strpos($this->page->pagetype, 'grade-') === 0) {
+            if ($this->page->context->contextlevel < CONTEXT_MODULE && strpos($this->page->pagetype, 'grade-') === 0) {
                 $gradenode->make_active();
             }
         }