diff options
author | plegall <plg@piwigo.org> | 2010-03-19 12:50:19 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-03-19 12:50:19 +0000 |
commit | 3a076f460d89628e75a7e9e693be0c3962ac2c39 (patch) | |
tree | 2155ac51c61e251057a1d9127b54a4d8588950df /admin/include/functions.php | |
parent | b7fee65e8fccc08b3741bc63725f58aae73eb456 (diff) |
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
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r-- | admin/include/functions.php | 46 |
1 files changed, 46 insertions, 0 deletions
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 |