Index: blocks/admin/block_admin.php
===================================================================
RCS file: /home/cvs_repositories/globalcvs/ou-moodle/blocks/admin/block_admin.php,v
retrieving revision 1.19
diff -u -r1.19 block_admin.php
--- blocks/admin/block_admin.php 25 Sep 2007 09:18:50 -0000 1.19
+++ blocks/admin/block_admin.php 7 Dec 2007 16:49:40 -0000
@@ -70,10 +70,20 @@
}
/// View course grades (or just your own grades, same link)
- if ((has_capability('moodle/grade:viewall', $context) or
- (has_capability('moodle/grade:view', $context) && $course->showgrades)) && ($course->id!==SITEID)) {
- $this->content->items[]=''.get_string('grades').'';
- $this->content->icons[]='
';
+ /// find all accessible reports
+ if ($course->id!==SITEID) {
+ if ($reports = get_list_of_plugins('grade/report', 'CVS')) { // Get all installed reports
+ foreach ($reports as $key => $plugin) { // Remove ones we can't see
+ if (!has_capability('gradereport/'.$plugin.':view', $context)) {
+ unset($reports[$key]);
+ }
+ }
+ }
+
+ if (!empty($reports)) {
+ $this->content->items[]=''.get_string('grades').'';
+ $this->content->icons[]='
';
+ }
}
/// Course outcomes (to help give it more prominence because it's important)