diff options
Diffstat (limited to 'modules/tag/helpers')
| -rw-r--r-- | modules/tag/helpers/tag.php | 19 | ||||
| -rw-r--r-- | modules/tag/helpers/tag_search.php | 24 |
2 files changed, 43 insertions, 0 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 7c4b56ba..ab5ee303 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -79,6 +79,25 @@ class tag_Core { } } + + /** + * Return all the tags for a given item. + * @return array + */ + static function item_tags($item) { + access::required("view", $item); + $tags = array(); + foreach (Database::instance() + ->select("name") + ->from("tags") + ->join("items_tags", "tags.id", "items_tags.tag_id", "left") + ->where("items_tags.item_id", $item->id) + ->get() as $row) { + $tags[] = $row->name; + } + return $tags; + } + static function get_add_form($item) { $form = new Forge("tags", "", "post", array("id" => "gAddTagForm")); $label = $item->is_album() ? diff --git a/modules/tag/helpers/tag_search.php b/modules/tag/helpers/tag_search.php new file mode 100644 index 00000000..034b7af5 --- /dev/null +++ b/modules/tag/helpers/tag_search.php @@ -0,0 +1,24 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class tag_search_Core { + static function item_index_data($item) { + return join(" ", tag::item_tags($item)); + } +} |
