These two files need to be swapped
[isso.git] / Printer.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright (c)2005-2008 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 2 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 System (printer.php)
24 *
25 * @package ISSO
26 */
27
28 require_once(ISSO . '/PrinterElement.php');
29 require_once(ISSO . '/PrinterBaseElement.php');
30 require_once(ISSO . '/PrinterLabelElement.php');
31 require_once(ISSO . '/PrinterRootElement.php');
32 require_once(ISSO . '/PrinterRootElementPage.php');
33 require_once(ISSO . '/PrinterRootElementTable.php');
34 require_once(ISSO . '/PrinterRootElementForm.php');
35 require_once(ISSO . '/PrinterTableElement.php');
36 require_once(ISSO . '/PrinterNavigation.php');
37
38 /**
39 * Printer System
40 *
41 * This is the root static framework module for the HTML printer system that
42 * works without templates. Here, you simply set the language and stylesheet
43 * information and use the other classes to generate the code.
44 *
45 * @author Blue Static
46 * @copyright Copyright (c)2005 - 2008, Blue Static
47 * @package ISSO
48 *
49 */
50 class BSPrinter
51 {
52 /**
53 * Singleton instance
54 * @var BSPrinter
55 */
56 private static $instance;
57
58 /**
59 * Language information for all printer elements with format array(langcode: en_US, direction: ltr/rtl, charset: utf-8)
60 * @var string
61 */
62 private $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
63
64 /**
65 * CSS stylesheet to link to
66 * @var string
67 */
68 private $stylesheet;
69
70 /**
71 * Realm; the extra bit added to the title
72 * @var string
73 */
74 private $realm = 'BSPrinterOutput';
75
76 /**
77 * The copyright string used in the footer
78 * @var string
79 */
80 private $copyright;
81
82 // ###################################################################
83 /**
84 * Constructor (private)
85 */
86 private function __construct() {}
87
88 // ###################################################################
89 /**
90 * Returns the singleton instance
91 *
92 * @return BSPrinter Singleton instance
93 */
94 private static function _instance()
95 {
96 if (!self::$instance)
97 {
98 self::$instance = new BSPrinter();
99 }
100 return self::$instance;
101 }
102
103 /**
104 * Returns the copyright string
105 *
106 * @return string
107 */
108 public static function get_copyright()
109 {
110 self::_instance()->copyright;
111 }
112
113 /**
114 * Sets the copyright string
115 *
116 * @param string The copyright string
117 */
118 public static function set_copyright($copyright)
119 {
120 self::_instance()->copyright = $copyright;
121 }
122
123 // ###################################################################
124 /**
125 * Returns the realm
126 *
127 * @return string Realm
128 */
129 public static function get_realm()
130 {
131 return self::_instance()->realm;
132 }
133
134 // ###################################################################
135 /**
136 * Sets the realm
137 *
138 * @param string Realm
139 */
140 public static function set_realm($realm)
141 {
142 self::_instance()->realm = $realm;
143 }
144
145 // ###################################################################
146 /**
147 * Returns the language array
148 *
149 * @return array Language array
150 */
151 public static function get_language_information()
152 {
153 return self::_instance()->language;
154 }
155
156 // ###################################################################
157 /**
158 * Sets the language array information
159 *
160 * @param array Language array
161 */
162 public static function set_language_information($lang)
163 {
164 self::_instance()->language = $lang;
165 }
166
167 // ###################################################################
168 /**
169 * Returns the stylesheet URL
170 *
171 * @return string Stylesheet link
172 */
173 public static function get_stylesheet()
174 {
175 return self::_instance()->stylesheet;
176 }
177
178 // ###################################################################
179 /**
180 * Sets the path to the CSS style sheet
181 *
182 * @param string Path
183 */
184 public static function set_stylesheet($stylesheet)
185 {
186 self::_instance()->stylesheet = $stylesheet;
187 }
188 }
189
190 ?>