[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
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-2007 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.1 2007/06/25 10:59:01 fplanque 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 * @package evocore 39 */ 40 class IconLegend 41 { 42 /** 43 * List of used icon names 44 * @var array 45 */ 46 var $icons = array(); 47 48 49 /** 50 * Constructor 51 * @return IconLegend 52 */ 53 function IconLegend() 54 { 55 } 56 57 /** 58 * Add an icon with his legend to the icons array 59 * 60 * @param string name of the icon 61 */ 62 function add_icon( $icon ) 63 { 64 if( !in_array( $icon, $this->icons ) ) 65 { 66 $this->icons[] = $icon; 67 } 68 } 69 70 71 /** 72 * Display the icon legend 73 */ 74 function display_legend() 75 { 76 if( empty( $this->icons ) ) 77 { 78 return; 79 } 80 81 // There are some icons to display: 82 echo '<div id="icon_legend">'.T_('Legend').': '; 83 84 // Loop on all map array of filenames for icons to display icons list in the same order: 85 foreach( $this->icons as $icon ) 86 { 87 $icon_info = get_icon_info($icon); 88 if( ! $icon_info ) 89 { 90 continue; 91 } 92 93 echo '<span class="legend_element">'.get_icon( $icon ).' '; 94 95 if( isset( $icon_info['legend'] ) ) 96 { // Icon has a legend: 97 echo $icon_info['legend'] . ' '; 98 } 99 else 100 { // Icon has no legend so we use the alt: 101 echo $icon_info['alt'] . ' '; 102 } 103 104 echo '</span>'; 105 } 106 107 echo '</div>'; 108 } 109 110 111 /** 112 * Reset icons array 113 */ 114 function reset() 115 { 116 $this->icons[] = array(); 117 } 118 } 119 120 /* 121 * $Log: _iconlegend.class.php,v $ 122 * Revision 1.1 2007/06/25 10:59:01 fplanque 123 * MODULES (refactored MVC) 124 * 125 * Revision 1.9 2007/04/26 00:11:08 fplanque 126 * (c) 2007 127 * 128 * Revision 1.8 2006/12/07 23:13:13 fplanque 129 * @var needs to have only one argument: the variable type 130 * Otherwise, I can't code! 131 * 132 * Revision 1.7 2006/11/30 22:34:15 fplanque 133 * bleh 134 * 135 * Revision 1.6 2006/11/28 01:02:53 fplanque 136 * minor 137 * 138 * Revision 1.5 2006/11/26 02:30:39 fplanque 139 * doc / todo 140 * 141 * Revision 1.4 2006/11/26 01:42:10 fplanque 142 * doc 143 * 144 */ 145 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |