Ignore:
Timestamp:
Mar 19, 2010, 1:50:19 PM (14 years ago)
Author:
plg
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r5173 r5188  
    19821982  return 0;
    19831983}
     1984
     1985function get_fckb_taglist($query)
     1986{
     1987  $result = pwg_query($query);
     1988  $taglist = array();
     1989  while ($row = pwg_db_fetch_assoc($result))
     1990  {
     1991    array_push(
     1992      $taglist,
     1993      array(
     1994        'caption' => $row['tag_name'],
     1995        'value' => '~~'.$row['tag_id'].'~~',
     1996        )
     1997      );
     1998  }
     1999 
     2000  return $taglist;
     2001}
     2002
     2003function get_fckb_tag_ids($raw_tags)
     2004{
     2005  // In $raw_tags we receive something like array('~~6~~', '~~59~~', 'New
     2006  // tag', 'Another new tag') The ~~34~~ means that it is an existing
     2007  // tag. I've added the surrounding ~~ to permit creation of tags like "10"
     2008  // or "1234" (numeric characters only)
     2009
     2010  $tag_ids = array();
     2011 
     2012  foreach ($raw_tags as $raw_tag)
     2013  {
     2014    if (preg_match('/^~~(\d+)~~$/', $raw_tag, $matches))
     2015    {
     2016      array_push($tag_ids, $matches[1]);
     2017    }
     2018    else
     2019    {
     2020      // we have to create a new tag
     2021      array_push(
     2022        $tag_ids,
     2023        tag_id_from_tag_name($raw_tag)
     2024        );
     2025    }
     2026  }
     2027
     2028  return $tag_ids;
     2029}
    19842030?>
Note: See TracChangeset for help on using the changeset viewer.