From 3a076f460d89628e75a7e9e693be0c3962ac2c39 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 19 Mar 2010 12:50:19 +0000 Subject: feature 724: FCBKcomplete propagated to element_set_global and element_set_unit to manage tags. Note: multiple instances of FCBKcomplete on the same page does not work as good as a single instance. git-svn-id: http://piwigo.org/svn/trunk@5188 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'admin/include/functions.php') diff --git a/admin/include/functions.php b/admin/include/functions.php index eb6a4181b..c7b8bf5f1 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1981,4 +1981,50 @@ function get_active_menu($menu_page) } return 0; } + +function get_fckb_taglist($query) +{ + $result = pwg_query($query); + $taglist = array(); + while ($row = pwg_db_fetch_assoc($result)) + { + array_push( + $taglist, + array( + 'caption' => $row['tag_name'], + 'value' => '~~'.$row['tag_id'].'~~', + ) + ); + } + + return $taglist; +} + +function get_fckb_tag_ids($raw_tags) +{ + // In $raw_tags we receive something like array('~~6~~', '~~59~~', 'New + // tag', 'Another new tag') The ~~34~~ means that it is an existing + // tag. I've added the surrounding ~~ to permit creation of tags like "10" + // or "1234" (numeric characters only) + + $tag_ids = array(); + + foreach ($raw_tags as $raw_tag) + { + if (preg_match('/^~~(\d+)~~$/', $raw_tag, $matches)) + { + array_push($tag_ids, $matches[1]); + } + else + { + // we have to create a new tag + array_push( + $tag_ids, + tag_id_from_tag_name($raw_tag) + ); + } + } + + return $tag_ids; +} ?> \ No newline at end of file -- cgit v1.2.3