Fixing a few functions that broke during the refactoring
[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
37 /**
38 * Printer System
39 *
40 * This is the root static framework module for the HTML printer system that
41 * works without templates. Here, you simply set the language and stylesheet
42 * information and use the other classes to generate the code.
43 *
44 * @author Blue Static
45 * @copyright Copyright (c)2005 - 2008, Blue Static
46 * @package ISSO
47 *
48 */
49 class BSPrinter
50 {
51 /**
52 * Singleton instance
53 * @var BSPrinter
54 */
55 private static $instance;
56
57 /**
58 * Language information for all printer elements with format array(langcode: en_US, direction: ltr/rtl, charset: utf-8)
59 * @var string
60 */
61 private $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
62
63 /**
64 * CSS stylesheet to link to
65 * @var string
66 */
67 private $stylesheet;
68
69 /**
70 * Realm; the extra bit added to the title
71 * @var string
72 */
73 private $realm = 'BSPrinterOutput';
74
75 // ###################################################################
76 /**
77 * Constructor (private)
78 */
79 private function __construct() {}
80
81 // ###################################################################
82 /**
83 * Returns the singleton instance
84 *
85 * @return BSPrinter Singleton instance
86 */
87 private static function _instance()
88 {
89 if (!self::$instance)
90 {
91 self::$instance = new BSPrinter();
92 }
93 return self::$instance;
94 }
95
96 // ###################################################################
97 /**
98 * Returns the realm
99 *
100 * @return string Realm
101 */
102 public static function get_realm()
103 {
104 return self::_instance()->realm;
105 }
106
107 // ###################################################################
108 /**
109 * Sets the realm
110 *
111 * @param string Realm
112 */
113 public static function set_realm($realm)
114 {
115 self::_instance()->realm = $realm;
116 }
117
118 // ###################################################################
119 /**
120 * Returns the language array
121 *
122 * @return array Language array
123 */
124 public static function get_language_information()
125 {
126 return self::_instance()->language;
127 }
128
129 // ###################################################################
130 /**
131 * Sets the language array information
132 *
133 * @param array Language array
134 */
135 public static function set_language_information($lang)
136 {
137 self::_instance()->language = $lang;
138 }
139
140 // ###################################################################
141 /**
142 * Returns the stylesheet URL
143 *
144 * @return string Stylesheet link
145 */
146 public static function get_stylesheet()
147 {
148 return self::_instance()->stylesheet;
149 }
150
151 // ###################################################################
152 /**
153 * Sets the path to the CSS style sheet
154 *
155 * @param string Path
156 */
157 public static function set_stylesheet($stylesheet)
158 {
159 self::_instance()->stylesheet = $stylesheet;
160 }
161 }
162
163 ?>