MDL-59599 navigation: Improve activity status for nav nodes.
authorKathrin Osswald <kathrin.osswald@uni-ulm.de>
Tue, 12 Jun 2018 10:48:41 +0000 (12:48 +0200)
committerKathrin Osswald <kathrin.osswald@uni-ulm.de>
Wed, 4 Jul 2018 17:57:10 +0000 (19:57 +0200)
lib/navigationlib.php

index f8208c8..f2f4cb1 100644 (file)
@@ -2730,7 +2730,12 @@ class global_navigation extends navigation_node {
         }
         if ($navoptions->grades) {
             $url = new moodle_url('/grade/report/index.php', array('id'=>$course->id));
-            $gradenode = $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, 'grades', new pix_icon('i/grades', ''));
+            $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) {
+                $gradenode->make_active();
+            }
         }
 
         return true;