From: moodler Date: Mon, 1 May 2006 03:11:45 +0000 (+0000) Subject: Some fixes for the links in the blog tags block X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6279c33fbd12e35bfa88c4aabddc5a24ce49e261;p=moodle.git Some fixes for the links in the blog tags block --- diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index b478efdc35..49569d73be 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -4,6 +4,14 @@ define('BLOGDEFAULTTIMEWITHIN', 90); define('BLOGDEFAULTNUMBEROFTAGS', 20); define('BLOGDEFAULTSORT', 'text'); +if (!defined('BLOG_USER_LEVEL')) { + define ('BLOG_USER_LEVEL', 1); + define ('BLOG_GROUP_LEVEL', 2); + define ('BLOG_COURSE_LEVEL', 3); + define ('BLOG_SITE_LEVEL', 4); + define ('BLOG_GLOBAL_LEVEL', 5); +} + class block_blog_tags extends block_base { function init() { $this->version = 2006032000; @@ -116,8 +124,29 @@ class block_blog_tags extends block_base { /// Finally we create the output foreach ($etags as $tag) { - $link = $CFG->wwwroot.'/blog/index.php?courseid='. - $this->instance->pageid.'&filtertype=site&tagid='.$tag->id; + switch ($CFG->bloglevel) { + case BLOG_USER_LEVEL: + $filtertype = 'user'; + $filterselect = $USER->id; + break; + + case BLOG_GROUP_LEVEL: + $filtertype = 'group'; + $filterselect = get_current_group($this->instance->pageid); + break; + + case BLOG_COURSE_LEVEL: + $filtertype = 'course'; + $filterselect = $this->instance->pageid; + break; + + default: + $filtertype = 'site'; + $filterselect = SITEID; + break; + } + + $link = $CFG->wwwroot.'/blog/index.php?filtertype='.$filtertype.'&filterselect='.$filterselect.'&tagid='.$tag->id; $this->content->text .= ''.