From 3472ebc081040f070d5ae2b4b911f9c2ced449a5 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Tue, 13 Oct 2009 04:13:20 +0800 Subject: [PATCH] Updated for new sidebar code. --- .../displaytags/helpers/displaytags_block.php | 54 +++++++++++++++++++ .../displaytags/helpers/displaytags_theme.php | 41 -------------- modules/displaytags/module.info | 4 +- 3 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 modules/displaytags/helpers/displaytags_block.php delete mode 100644 modules/displaytags/helpers/displaytags_theme.php diff --git a/modules/displaytags/helpers/displaytags_block.php b/modules/displaytags/helpers/displaytags_block.php new file mode 100644 index 00000000..454ff0b6 --- /dev/null +++ b/modules/displaytags/helpers/displaytags_block.php @@ -0,0 +1,54 @@ + t("Display Tags")); + } + + static function get($block_id, $theme) { + $block = ""; + + // Make sure the current page belongs to an item. + if (!$theme->item()) { + return; + } + + switch ($block_id) { + case "display_tags": + // Create an array of all the tags for the current item. + $tagsItem = ORM::factory("tag") + ->join("items_tags", "tags.id", "items_tags.tag_id") + ->where("items_tags.item_id", $theme->item->id) + ->find_all(); + + // If the current item has at least one tag, display it/them. + if (count($tagsItem) > 0) { + $block = new Block(); + $block->css_id = "g-display-tags"; + $block->title = t("Tags"); + $block->content = new View("displaytags_block.html"); + $block->content->tags = $tagsItem; + } + + break; + } + return $block; + } +} diff --git a/modules/displaytags/helpers/displaytags_theme.php b/modules/displaytags/helpers/displaytags_theme.php deleted file mode 100644 index 529ac5de..00000000 --- a/modules/displaytags/helpers/displaytags_theme.php +++ /dev/null @@ -1,41 +0,0 @@ -item()) { - return; - } - - // Create an array of all the tags for the current item. - $tagsItem = ORM::factory("tag") - ->join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", $theme->item->id) - ->find_all(); - - // If the current item has at least one tag, display it/them. - if (count($tagsItem) > 0) { - $block = new Block(); - $block->css_id = "g-display-tags"; - $block->title = t("Tags"); - $block->content = new View("displaytags_block.html"); - $block->content->tags = $tagsItem; - return $block; - } - } -} diff --git a/modules/displaytags/module.info b/modules/displaytags/module.info index b905a8e4..d8458f10 100644 --- a/modules/displaytags/module.info +++ b/modules/displaytags/module.info @@ -1,3 +1,3 @@ -name = DisplayTags -description = Display all tags for the current photo/album. +name = "DisplayTags" +description = "Display all tags for the current photo/album." version = 1