]> git.mjollnir.org Git - moodle.git/commitdiff
Merged tag block context fixes from stable
authormoodler <moodler>
Mon, 19 Jun 2006 14:17:55 +0000 (14:17 +0000)
committermoodler <moodler>
Mon, 19 Jun 2006 14:17:55 +0000 (14:17 +0000)
blocks/blog_tags/block_blog_tags.php

index 0a3f5a7390058eb9a6e1c90d2bc8364f4a696749..f1ee063a318c624874a3647c4d776401f31cedfa 100644 (file)
@@ -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;
                 }