From 7cf0769e97f879627b9dc818c829c5c3e9341614 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Wed, 15 Nov 2006 07:17:46 +0000 Subject: [PATCH] reenabling this for site level course, backup/restore/assign roles and so on. This provides a course context for the site course --- blocks/admin/block_admin.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php index 9a8031a486..f8c11688cd 100644 --- a/blocks/admin/block_admin.php +++ b/blocks/admin/block_admin.php @@ -22,7 +22,7 @@ class block_admin extends block_list { if (empty($this->instance)) { return $this->content = ''; } else if ($this->instance->pageid == SITEID) { - return $this->content = ''; + // return $this->content = ''; } if (!empty($this->instance->pageid)) { @@ -49,7 +49,7 @@ class block_admin extends block_list { /// Course editing on/off - if (has_capability('moodle/course:update', $context)) { + if (has_capability('moodle/course:update', $context) && ($course->id!==SITEID)) { $this->content->icons[]=''; if (isediting($this->instance->pageid)) { $this->content->items[]=''.get_string('turneditingoff').''; @@ -86,7 +86,7 @@ class block_admin extends block_list { /// Manage groups in this course - if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $context)) { + if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $context) && ($course->id!==SITEID)) { $strgroups = get_string('groups'); $this->content->items[]=''.$strgroups.''; $this->content->icons[]=''; @@ -106,44 +106,44 @@ class block_admin extends block_list { } /// Import data from other courses - if (has_capability('moodle/site:import', $context)) { + if (has_capability('moodle/site:import', $context) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('import').''; $this->content->icons[]=''; } /// Reset this course - if (has_capability('moodle/course:reset', $context)) { + if (has_capability('moodle/course:reset', $context) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('reset').''; $this->content->icons[]=''; } /// View course reports - if (has_capability('moodle/site:viewreports', $context)) { + if (has_capability('moodle/site:viewreports', $context) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('reports').''; $this->content->icons[]=''; } /// Manage questions - if (has_capability('moodle/question:manage', $context)) { + if (has_capability('moodle/question:manage', $context) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('questions', 'quiz').''; $this->content->icons[]=''; } /// Manage scales - if (has_capability('moodle/course:managescales', $context)) { + if (has_capability('moodle/course:managescales', $context) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('scales').''; $this->content->icons[]=''; } /// Manage files - if (has_capability('moodle/course:managefiles', $context)) { + if (has_capability('moodle/course:managefiles', $context) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('files').''; $this->content->icons[]=''; } /// Authorize hooks - if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) { + if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize') && ($course->id!==SITEID)) { require_once($CFG->dirroot.'/enrol/authorize/const.php'); $paymenturl = ''.get_string('payments').' '; if (has_capability('enrol/authorize:managepayments', $context)) { @@ -156,13 +156,13 @@ class block_admin extends block_list { } /// View course grades (or just your own grades, same link) - if (has_capability('moodle/course:viewcoursegrades', $context) or - (has_capability('moodle/user:viewusergrades', $context) && $course->showgrades)) { + if ((has_capability('moodle/course:viewcoursegrades', $context) or + (has_capability('moodle/user:viewusergrades', $context) && $course->showgrades)) && ($course->id!==SITEID)) { $this->content->items[]=''.get_string('grades').''; $this->content->icons[]=''; } - if (empty($course->metacourse)) { + if (empty($course->metacourse) && ($course->id!==SITEID)) { if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Are a guest now $this->content->items[]=''.get_string('enrolme', '', $course->shortname).''; $this->content->icons[]=''; @@ -201,7 +201,9 @@ class block_admin extends block_list { } function applicable_formats() { - return array('all' => false, 'course' => true); + // Yu: Separating site and site course context + // Have to enable for site as well + return array('all' => true, 'course' => true); } } -- 2.39.5