diff options
author | Nathan Kinkade <nkinkade@nkinka.de> | 2011-01-14 01:12:32 +0000 |
---|---|---|
committer | Nathan Kinkade <nkinkade@nkinka.de> | 2011-01-14 01:12:32 +0000 |
commit | 2898fe3b82ce10d045dd2c274a3290bacf209a00 (patch) | |
tree | 5aced91bb92d8c9136cabf60ebc918248328907a /modules/tag/helpers | |
parent | 47cbef684d41a4d51a9848091997e10b909abf32 (diff) | |
parent | e4a43c99e421c830e569eaae6294286ed51e0ad8 (diff) |
Git pull from devel line.
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r-- | modules/tag/helpers/tag.php | 4 | ||||
-rw-r--r-- | modules/tag/helpers/tag_event.php | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 14d27c94..7d5c643a 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -36,11 +36,9 @@ class tag_Core { $tag = ORM::factory("tag")->where("name", "=", $tag_name)->find(); if (!$tag->loaded()) { $tag->name = $tag_name; - $tag->count = 0; } $tag->add($item); - $tag->count++; return $tag->save(); } @@ -118,7 +116,7 @@ class tag_Core { static function clear_all($item) { db::build() ->update("tags") - ->set("count", new Database_Expression("`count` - 1")) + ->set("count", db::expr("`count` - 1")) ->where("count", ">", 0) ->where("id", "IN", db::build()->select("tag_id")->from("items_tags")->where("item_id", "=", $item->id)) ->execute(); diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 829089c4..baf8b1ae 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -147,4 +147,19 @@ class tag_event_Core { } } } + + static function info_block_get_metadata($block, $item) { + $tags = array(); + foreach (tag::item_tags($item) as $tag) { + $tags[] = "<a href=\"" . url::site("tag/{$tag->name}") . "\">{$tag->name}</a>"; + } + if ($tags) { + $info = $block->content->metadata; + $info["tags"] = array( + "label" => t("Tags:"), + "value" => implode(", ", $tags) + ); + $block->content->metadata = $info; + } + } } |