From bede8db79f11adac4e8bbfeb25fd969730d9f779 Mon Sep 17 00:00:00 2001 From: vyshane Date: Tue, 15 Aug 2006 05:01:00 +0000 Subject: [PATCH] Updated with new capabilities --- blocks/admin/block_admin.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php index ddc6f7d5a07..212e77e2a99 100644 --- a/blocks/admin/block_admin.php +++ b/blocks/admin/block_admin.php @@ -109,10 +109,7 @@ class block_admin extends block_list { if (isteacher($this->instance->pageid)) { - $isteacheredit = isteacheredit($this->instance->pageid); - if (has_capability('moodle/course:update', $context)) { - //if (isteacheredit($this->instance->pageid)) { $this->content->icons[]=''; if (isediting($this->instance->pageid)) { $this->content->items[]=''.get_string('turneditingoff').''; @@ -124,7 +121,7 @@ class block_admin extends block_list { $this->content->icons[]=''; } - $fullname = fullname($USER, true); + $fullname = fullname($USER, has_capability('moodle/site:viewfullnames', $context)); $editmyprofile = ''.get_string('editmyprofile').''; if (empty($USER->description)) { //Accessibility: replace non-standard with CSS ( makes title visible in IE). @@ -146,7 +143,7 @@ class block_admin extends block_list { $this->content->items[]=''.$strchildcourses.''; $this->content->icons[]=''; } - if ($course->groupmode || !$course->groupmodeforce) { + if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $context)) { $strgroups = get_string('groups'); $this->content->items[]=''.$strgroups.''; $this->content->icons[]=''; @@ -162,19 +159,25 @@ class block_admin extends block_list { $this->content->icons[]=''; } - $this->content->items[]=''.get_string('import').''; - $this->content->icons[]=''; - if (has_capability('moodle/site:import', $context)) { + $this->content->items[]=''.get_string('import').''; + $this->content->icons[]=''; + } + + if (has_capability('moodle/course:reset', $context)) { $this->content->items[]=''.get_string('reset').''; $this->content->icons[]=''; } - $this->content->items[]=''.get_string('reports').''; - $this->content->icons[]=''; - - $this->content->items[]=''.get_string('questions', 'quiz').''; - $this->content->icons[]=''; + if (has_capability('moodle/site:viewreports', $context)) { + $this->content->items[]=''.get_string('reports').''; + $this->content->icons[]=''; + } + + if (has_capability('moodle/course:managequestions', $context)) { + $this->content->items[]=''.get_string('questions', 'quiz').''; + $this->content->icons[]=''; + } if (has_capability('moodle/course:managescales', $context)) { $this->content->items[]=''.get_string('scales').''; @@ -184,7 +187,7 @@ class block_admin extends block_list { $this->content->items[]=''.get_string('grades').''; $this->content->icons[]=''; - if ($isteacheredit) { + if (has_capability('moodle/course:managefiles', $context)) { $this->content->items[]=''.get_string('files').''; $this->content->icons[]=''; }