Okay this finally looks good
[isso.git] / PrinterElement.php
1 <?php
2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
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.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 /**
23 * Printer Element Abstract Class (PrinterElement.php)
24 *
25 * @package ISSO
26 */
27
28 /**
29 * Printer Element
30 *
31 * This abstract class is used for all printer elements and describes
32 * the basic functionality of an element.
33 *
34 * @author Blue Static
35 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
36 * @version $Revision$
37 * @package ISSO
38 *
39 */
40 abstract class BSPrinterElement
41 {
42 /**
43 * Style information
44 * @var array
45 */
46 protected $style = array();
47
48 /**
49 * Tells the element to paint itself (and any children)
50 */
51 public abstract function paint();
52
53 // ###################################################################
54 /**
55 * Sets the style information
56 */
57 public function setStyle(Array $attributes)
58 {
59 $this->style = $attributes;
60 }
61
62 // ###################################################################
63 /**
64 * Returns a string of CSS style attributes
65 *
66 * @return string CSS attributes
67 */
68 protected function _prepareStyle()
69 {
70 if (empty($this->style))
71 {
72 return;
73 }
74
75 $attrs = array();
76
77 foreach ($this->style AS $prop => $value)
78 {
79 $attrs[] = $prop . ': ' . $value;
80 }
81
82 return explode('; ', $attrs);
83 }
84 }
85
86 /*=====================================================================*
87 || ###################################################################
88 || # $HeadURL$
89 || # $Id$
90 || ###################################################################
91 \*=====================================================================*/
92 ?>