From f81893572c8b3be3ce445acefd90835a742270ce Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Fri, 10 Apr 2015 15:32:03 +0800 Subject: [PATCH] MDL-49819 navigation: Added grades back to admin block. Students can once again see the grades in the admin block When navigating a course. Part of MDL-45774. --- lib/navigationlib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 71e8e3ebe27..d75045eed6b 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -3817,6 +3817,18 @@ class settings_navigation extends navigation_node { $reportavailable = false; if (has_capability('moodle/grade:viewall', $coursecontext)) { $reportavailable = true; + } else if (!empty($course->showgrades)) { + $reports = core_component::get_plugin_list('gradereport'); + if (is_array($reports) && count($reports)>0) { // Get all installed reports + arsort($reports); // user is last, we want to test it first + foreach ($reports as $plugin => $plugindir) { + if (has_capability('gradereport/'.$plugin.':view', $coursecontext)) { + //stop when the first visible plugin is found + $reportavailable = true; + break; + } + } + } } if ($reportavailable) { $url = new moodle_url('/grade/report/index.php', array('id'=>$course->id));