From: moodler Date: Sat, 30 Sep 2006 08:22:17 +0000 (+0000) Subject: IFxed some notices when the block was used on sticky blocks page. MDL-6620 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d4484f3209be20308101a10eb73b77f8ba8f2c7f;p=moodle.git IFxed some notices when the block was used on sticky blocks page. MDL-6620 --- diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php index c6e4dc8793..a3dab444e8 100644 --- a/blocks/admin/block_admin.php +++ b/blocks/admin/block_admin.php @@ -8,7 +8,7 @@ class block_admin extends block_list { function get_content() { - global $CFG, $USER; + global $CFG, $USER, $SITE; if ($this->content !== NULL) { return $this->content; @@ -25,10 +25,17 @@ class block_admin extends block_list { return $this->content = ''; } + if (!empty($this->instance->pageid)) { + $context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid); + } - $course = get_record('course', 'id', $this->instance->pageid); + if (empty($context)) { + $context = get_context_instance(CONTEXT_SYSTEM); + } - $context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid); + if (!$course = get_record('course', 'id', $this->instance->pageid)) { + $course = $SITE; + } if (!has_capability('moodle/course:view', $context)) { // Just return return $this->content;