From 42cc453778c3d524bd7e340982b2afd2df2c9b79 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 28 Aug 2007 06:38:21 +0000 Subject: [PATCH] Added new tags block for all tags --- blocks/blog_tags/block_tags.php | 86 +++++++++++++++++++++++++++ blocks/blog_tags/config_instance.html | 20 +------ 2 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 blocks/blog_tags/block_tags.php diff --git a/blocks/blog_tags/block_tags.php b/blocks/blog_tags/block_tags.php new file mode 100644 index 0000000000..69c4cbd6b5 --- /dev/null +++ b/blocks/blog_tags/block_tags.php @@ -0,0 +1,86 @@ +version = 2007082800; + $this->title = get_string('blocktagstitle', 'tag'); + } + + function instance_allow_multiple() { + return true; + } + + function has_config() { + return false; + } + + function applicable_formats() { + return array('all' => true, 'my' => false, 'tag' => false); + } + + function instance_allow_config() { + return true; + } + + function specialization() { + + // load userdefined title and make sure it's never empty + if (empty($this->config->title)) { + $this->title = get_string('blocktagstitle','tag'); + } else { + $this->title = $this->config->title; + } + } + + function get_content() { + + global $CFG, $SITE, $COURSE, $USER; + + if (empty($CFG->usetags)) { + $this->content->text = ''; + return $this->content; + } + + if (empty($this->config->numberoftags)) { + $this->config->numberoftags = 80; + } + + if ($this->content !== NULL) { + return $this->content; + } + + if (empty($this->instance)) { + $this->content = ''; + return $this->content; + } + + $this->content = new stdClass; + $this->content->footer = ''; + + /// Get a list of tags + + include($CFG->dirroot.'/tag/lib.php'); + + $this->content->text = print_tag_cloud(popular_tags_count($this->config->numberoftags), false, 170,70, true); + + return $this->content; + } + + function instance_config_print() { + global $CFG; + + /// set up the numberoftags select field + $numberoftags = array(); + for($i=1;$i<=200;$i++) $numberoftags[$i] = $i; + + if (is_file($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html')) { + print_simple_box_start('center', '', '', 5, 'blockconfigglobal'); + include($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html'); + print_simple_box_end(); + } else { + notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me())); + } + } +} + +?> diff --git a/blocks/blog_tags/config_instance.html b/blocks/blog_tags/config_instance.html index dd1eb665b4..0b17765192 100644 --- a/blocks/blog_tags/config_instance.html +++ b/blocks/blog_tags/config_instance.html @@ -1,15 +1,9 @@ config->title)) { - $this->config->title = get_string('blogtags', 'blog'); - } - if (empty($this->config->timewithin)) { - $this->config->timewithin = BLOGDEFAULTTIMEWITHIN; + $this->config->title = get_string('blocktagstitle', 'tag'); } if (empty($this->config->numberoftags)) { - $this->config->numberoftags = BLOGDEFAULTNUMBEROFTAGS; - } - if (empty($this->config->sort)) { - $this->config->sort = BLOGDEFAULTSORT; + $this->config->numberoftags = 80; } ?> @@ -25,16 +19,6 @@ config->numberoftags) ?> - -: -config->timewithin) ?> - - - -: -config->sort) ?> - - " /> -- 2.39.5