Ignore:
Timestamp:
Apr 3, 2006, 12:26:19 AM (18 years ago)
Author:
plg
Message:

improvement: tags replace keywords. Better data model, less
limitations. Each image can be associated to as many tag as needed. Tags can
contain non ASCII characters. Oriented navigation with tags by association.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_html.inc.php

    r1113 r1119  
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
    8 // | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    496495
    497496/**
     497 * Returns an HTML list of tags. It can be a multi select field or a list of
     498 * checkboxes.
     499 *
     500 * @param string HTML field name
     501 * @param array selected tag ids
     502 * @return array
     503 */
     504function get_html_tag_selection(
     505  $tags,
     506  $fieldname,
     507  $selecteds = array(),
     508  $forbidden_categories = null
     509  )
     510{
     511  global $conf;
     512 
     513  $output = '<ul class="tagSelection">';
     514  foreach ($tags as $tag)
     515  {
     516    $output.=
     517      '<li>'
     518      .'<label>'
     519      .'<input type="checkbox" name="'.$fieldname.'[]"'
     520      .' value="'.$tag['tag_id'].'"'
     521      ;
     522
     523    if (in_array($tag['tag_id'], $selecteds))
     524    {
     525      $output.= ' checked="checked"';
     526    }
     527   
     528    $output.=
     529      ' />'
     530      .' '.$tag['name']
     531      .'</label>'
     532      .'</li>'
     533      ."\n"
     534      ;
     535  }
     536  $output.= '</ul>';
     537
     538  return $output;
     539}
     540
     541function name_compare($a, $b)
     542{
     543  return strcmp($a['name'], $b['name']);
     544}
     545
     546/**
    498547 * exits the current script (either exit or redirect)
    499548 */
Note: See TracChangeset for help on using the changeset viewer.