From 25fb38d46542b7916af717e792d1a1087a720641 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 19 Jun 2006 14:17:55 +0000 Subject: [PATCH] Merged tag block context fixes from stable --- blocks/blog_tags/block_blog_tags.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index 0a3f5a73900..f1ee063a318 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -41,7 +41,7 @@ class block_blog_tags extends block_base { function get_content() { - global $CFG; + global $CFG, $SITE, $COURSE; if (empty($this->config->timewithin)) { $this->config->timewithin = BLOGDEFAULTTIMEWITHIN; @@ -131,17 +131,21 @@ class block_blog_tags extends block_base { case BLOG_COURSE_LEVEL: $filtertype = 'course'; - global $course; // Need to do this unfortunately for pages like blog pages - if (isset($course->id)) { - $filterselect = $course->id; + if (isset($COURSE->id)) { + $filterselect = $COURSE->id; } else { $filterselect = $this->instance->pageid; } break; default: - $filtertype = 'site'; - $filterselect = SITEID; + if (isset($COURSE->id) && $COURSE->id != SITEID) { + $filtertype = 'course'; + $filterselect = $COURSE->id; + } else { + $filtertype = 'site'; + $filterselect = SITEID; + } break; }