[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 4 5 /** 6 * Image_Graph - PEAR PHP OO Graph Rendering Utility. 7 * 8 * PHP versions 4 and 5 9 * 10 * LICENSE: This library is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License as published by 12 * the Free Software Foundation; either version 2.1 of the License, or (at your 13 * option) any later version. This library is distributed in the hope that it 14 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 16 * General Public License for more details. You should have received a copy of 17 * the GNU Lesser General Public License along with this library; if not, write 18 * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 * 02111-1307 USA 20 * 21 * @category Images 22 * @package Image_Graph 23 * @subpackage Fill 24 * @author Jesper Veggerby <pear.nosey@veggerby.dk> 25 * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen 26 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 27 * @version CVS: $Id: Array.php,v 1.8 2005/08/24 20:36:03 nosey Exp $ 28 * @link http://pear.php.net/package/Image_Graph 29 */ 30 31 /** 32 * Include file Image/Graph/Fill.php 33 */ 34 require_once 'Image/Graph/Fill.php'; 35 36 /** 37 * A sequential array of fillstyles. 38 * 39 * This is used for filling multiple objects within the same element with 40 * different styles. This is done by adding multiple fillstyles to a FillArrray 41 * structure. The fillarray will then when requested return the 'next' fillstyle 42 * in sequential order. It is possible to specify ID tags to each fillstyle, 43 * which is used to make sure some data uses a specific fillstyle (i.e. in a 44 * multiple-/stackedbarchart you name the {@link Image_Graph_Dataset}s and uses 45 * this name as ID tag when adding the dataset's associated fillstyle to the 46 * fillarray. 47 * 48 * @category Images 49 * @package Image_Graph 50 * @subpackage Fill 51 * @author Jesper Veggerby <pear.nosey@veggerby.dk> 52 * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen 53 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 54 * @version Release: 0.7.2 55 * @link http://pear.php.net/package/Image_Graph 56 */ 57 class Image_Graph_Fill_Array extends Image_Graph_Fill 58 { 59 60 /** 61 * The fill array 62 * @var array 63 * @access private 64 */ 65 var $_fillStyles = array (); 66 67 /** 68 * Resets the fillstyle 69 * 70 * @access private 71 */ 72 function _reset() 73 { 74 reset($this->_fillStyles); 75 } 76 77 /** 78 * Add a fill style to the array 79 * 80 * @param Image_Graph_Fill $style The style to add 81 * @param string $id The id or name of the style 82 */ 83 function &add(& $style, $id = '') 84 { 85 if ($id == '') { 86 $this->_fillStyles[] =& $style; 87 } else { 88 $this->_fillStyles[$id] =& $style; 89 } 90 reset($this->_fillStyles); 91 return $style; 92 } 93 94 /** 95 * Add a color to the array 96 * 97 * @param int $color The color 98 * @param string $id The id or name of the color 99 */ 100 function addColor($color, $id = false) 101 { 102 if ($id !== false) { 103 $this->_fillStyles[$id] = $color; 104 } else { 105 $this->_fillStyles[] = $color; 106 } 107 reset($this->_fillStyles); 108 } 109 110 /** 111 * Return the fillstyle 112 * 113 * @return int A GD fillstyle 114 * @access private 115 */ 116 function _getFillStyle($ID = false) 117 { 118 if (($ID === false) || (!isset($this->_fillStyles[$ID]))) { 119 $ID = key($this->_fillStyles); 120 if (!next($this->_fillStyles)) { 121 reset($this->_fillStyles); 122 } 123 } 124 $fillStyle =& $this->_fillStyles[$ID]; 125 126 if (is_object($fillStyle)) { 127 return $fillStyle->_getFillStyle($ID); 128 } elseif ($fillStyle !== null) { 129 return $fillStyle; 130 } else { 131 return parent::_getFillStyle($ID); 132 } 133 } 134 135 } 136 137 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |