]>
src.bluestatic.org Git - isso.git/blob - PrinterElement.php
2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Printer Element Abstract Class (PrinterElement.php)
31 * This abstract class is used for all printer elements and describes
32 * the basic functionality of an element.
35 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
40 abstract class BSPrinterElement
46 protected $style = array();
49 * The CSS class to use
52 protected $cssClass = ':swap:';
55 * Tells the element to paint itself (and any children)
57 public abstract function paint();
59 // ###################################################################
61 * Sets the CSS class to use. Use ":swap:" to alternate
63 * @param string CSS class
65 public function setCssClass($class)
67 $this->cssClass
= $class;
70 // ###################################################################
72 * Sets the style information
74 public function setStyle(Array $attributes)
76 $this->style
= $attributes;
79 // ###################################################################
81 * Returns a string of CSS style attributes
83 * @return string CSS attributes
85 protected function _prepareStyle()
87 if (empty($this->style
) AND empty($this->cssClass
))
92 if ($this->cssClass
== ':swap:')
94 BSFunctions
::SwapCssClasses();
95 $class = BSFunctions
::$cssClass;
99 $class = $this->cssClass
;
104 foreach ($this->style
AS $prop => $value)
106 $attrs[] = $prop . ': ' . $value;
109 $style = implode('; ', $attrs);
114 $string .= ' class="' . $class . '"';
118 $string .= ' style="' . $style . '"';
125 /*=====================================================================*
126 || ###################################################################
129 || ###################################################################
130 \*=====================================================================*/