Skip to content

Commit

Permalink
MDL-12501 - Logic for including 'Grades' link in admin block is diffe…
Browse files Browse the repository at this point in the history
…rent for the logic in grade/report/index.php.
  • Loading branch information
tjhunt committed Dec 7, 2007
1 parent cc4dae1 commit f8c7c3a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions blocks/admin/block_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ function get_content() {
}

/// 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[]='<a href="'.$CFG->wwwroot.'/grade/report/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" class="icon" alt="" />';
/// 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[]='<a href="'.$CFG->wwwroot.'/grade/report/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" class="icon" alt="" />';
}
}

/// Course outcomes (to help give it more prominence because it's important)
Expand Down

0 comments on commit f8c7c3a

Please sign in to comment.