b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _iconlegend.class.php

Documentation is available at _iconlegend.class.php

  1. <?php
  2. /**
  3.  * This file implements displaying of an Icons legend.
  4.  *
  5.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  6.  * See also {@link http://sourceforge.net/projects/evocms/}.
  7.  *
  8.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  9.  *
  10.  *  {@internal License choice
  11.  *  - If you have received this file as part of a package, please find the license.txt file in
  12.  *    the same folder or the closest folder above for complete license terms.
  13.  *  - If you have received this file individually (e-g: from http://cvs.sourceforge.net/viewcvs.py/evocms/)
  14.  *    then you must choose one of the following licenses before using the file:
  15.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17.  *  }}}
  18.  *
  19.  *  {@internal Open Source relicensing agreement:
  20.  *  PROGIDISTRI grants Francois PLANQUE the right to license
  21.  *  PROGIDISTRI's contributions to this file and the b2evolution project
  22.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  23.  *  }}}
  24.  *
  25.  * @package evocore
  26.  *
  27.  * @author fplanque: Francois PLANQUE.
  28.  * @author mbruneau: Marc BRUNEAU / PROGIDISTRI
  29.  *
  30.  * @version $Id: _iconlegend.class.php,v 1.5 2010/02/08 17:51:57 efy-yury Exp $
  31.  */
  32. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  33.  
  34.  
  35. /**
  36.  * Display icon legend.
  37.  *
  38.  * Use {@link get_IconLegend()} to get the instance.
  39.  *
  40.  * @package evocore
  41.  */
  42. class IconLegend
  43. {
  44.     /**
  45.      * List of used icon names
  46.      * @var array 
  47.      */
  48.     var $icons = array();
  49.  
  50.  
  51.     /**
  52.      * Add an icon with his legend to the icons array
  53.      *
  54.      * @param string name of the icon
  55.      */
  56.     function add_icon$icon )
  57.     {
  58.         if!in_array$icon$this->icons ) )
  59.         {
  60.             $this->icons[$icon;
  61.         }
  62.     }
  63.  
  64.  
  65.     /**
  66.      * Display the icon legend
  67.      */
  68.     function display_legend()
  69.     {
  70.         ifempty$this->icons ) )
  71.         {
  72.             return;
  73.         }
  74.  
  75.         // There are some icons to display:
  76.         echo '<div id="icon_legend">'.T_('Legend').': ';
  77.  
  78.         // Loop on all map array of filenames for icons to display icons list in the same order:
  79.         foreach$this->icons as $icon )
  80.         {
  81.             $icon_info get_icon_info($icon);
  82.             if$icon_info )
  83.             {
  84.                 continue;
  85.             }
  86.  
  87.             echo '<span class="legend_element">'.get_icon$icon ).' ';
  88.  
  89.             ifisset$icon_info['legend') )
  90.             // Icon has a legend:
  91.                 echo $icon_info['legend'' ';
  92.             }
  93.             else
  94.             // Icon has no legend so we use the alt:
  95.                 echo $icon_info['alt'' ';
  96.             }
  97.  
  98.             echo '</span>';
  99.         }
  100.  
  101.         echo '</div>';
  102.     }
  103.  
  104.  
  105.     /**
  106.      * Reset icons array
  107.      */
  108.     function reset()
  109.     {
  110.         $this->icons[array();
  111.     }
  112. }
  113.  
  114. /*
  115.  * $Log: _iconlegend.class.php,v $
  116.  * Revision 1.5  2010/02/08 17:51:57  efy-yury
  117.  * copyright 2009 -> 2010
  118.  *
  119.  * Revision 1.4  2009/03/08 23:57:41  fplanque
  120.  * 2009
  121.  *
  122.  * Revision 1.3  2009/02/19 03:54:44  blueyed
  123.  * Optimize: move instantiation of $IconLegend (and $UserSettings query) out of main.inc.php, into get_IconLegend. TODO: test if it works with PHP4, or if it needs assignment by reference. Will do so on the test server.
  124.  *
  125.  * Revision 1.2  2008/01/21 09:35:24  fplanque
  126.  * (c) 2008
  127.  *
  128.  * Revision 1.1  2007/06/25 10:59:01  fplanque
  129.  * MODULES (refactored MVC)
  130.  *
  131.  * Revision 1.9  2007/04/26 00:11:08  fplanque
  132.  * (c) 2007
  133.  *
  134.  * Revision 1.8  2006/12/07 23:13:13  fplanque
  135.  * @var needs to have only one argument: the variable type
  136.  * Otherwise, I can't code!
  137.  *
  138.  * Revision 1.7  2006/11/30 22:34:15  fplanque
  139.  * bleh
  140.  *
  141.  * Revision 1.6  2006/11/28 01:02:53  fplanque
  142.  * minor
  143.  *
  144.  * Revision 1.5  2006/11/26 02:30:39  fplanque
  145.  * doc / todo
  146.  *
  147.  * Revision 1.4  2006/11/26 01:42:10  fplanque
  148.  * doc
  149.  *
  150.  */
  151. ?>

Documentation generated on Sat, 06 Mar 2010 04:13:08 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).