ISSO is no longer a product regularly released so we'll remove the issoversion tag...
[isso.git] / PrinterRootElementPage.php
1 <?php
2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework
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 Root Element: Page (PrinterRootElementPage.php)
24 *
25 * @package ISSO
26 */
27
28 require_once('ISSO/PrinterRootElement.php');
29
30 /**
31 * Printer Root Element: Page
32 *
33 * This root element represents the entire page and is usually used for all
34 * printer applications
35 *
36 * @author Blue Static
37 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
38 * @version $Revision$
39 * @package ISSO
40 *
41 */
42 class BSPrinterRootElementPage extends BSPrinterRootElement
43 {
44 /**
45 * The page title
46 * @var string
47 */
48 private $title;
49
50 /**
51 * Language information array: ('langcode' =>, 'direction' =>, 'charset' =>)
52 * @var array
53 */
54 private $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
55
56 /**
57 * The CSS stylesheet
58 * @var string
59 */
60 private $stylesheet;
61
62 // ###################################################################
63 /**
64 * Constructor
65 *
66 * @param string Page title
67 */
68 function __construct($title)
69 {
70 $this->title = $title;
71 }
72
73 // ###################################################################
74 /**
75 * Sets the language array information
76 *
77 * @param array Language array
78 */
79 public function setLanguageInformation($lang)
80 {
81 $this->language = $lang;
82 }
83
84 // ###################################################################
85 /**
86 * Sets the path to the CSS style sheet
87 *
88 * @param string Path
89 */
90 public function setStylesheet($stylesheet)
91 {
92 $this->stylesheet = $stylesheet;
93 }
94
95 // ###################################################################
96 /**
97 * Returns the HTML for all printed children elements
98 *
99 * @return string Printed HTML
100 */
101 protected function _paintChildren()
102 {
103 $builder = '';
104
105 foreach ($this->children AS $child)
106 {
107 $this->builder .= "\n" . $child->paint() . "\n";
108 }
109
110 return $this->builder;
111 }
112
113 // ###################################################################
114 /**
115 * Tells the element to paint itself (and any children)
116 */
117 public function paint()
118 {
119 echo("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
120 echo("<html xml:lang=\"" . $this->language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n<head>");
121 echo("\n\t<title>" . sprintf(_('%1$s - %2$s'), BSRegister::GetApplication(), $this->title) . "</title>");
122 echo("\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $this->language['charset'] . "\" />");
123 echo("\n\t<link rel=\"stylesheet\" href=\"" . $this->stylesheet . "\" />");
124 // echo $this->code;
125 echo("\n</head>\n<body>\n");
126
127 if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true)))
128 {
129 echo BSRegister::GetType('PrinterNavigation')->generate_header_html();
130 }
131
132 echo($this->_paintChildren());
133
134 if (BSRegister::GetDebug() AND isset($_GET['query']))
135 {
136 ob_clean();
137 ob_end_clean();
138
139 if (is_array($this->registry->modules[ISSO_DB_LAYER]->history))
140 {
141 foreach ($this->registry->modules[ISSO_DB_LAYER]->history AS $query)
142 {
143 echo $this->registry->modules[ISSO_DB_LAYER]->construct_query_debug($query);
144 }
145 }
146 exit;
147 }
148
149 if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true)))
150 {
151 echo BSRegister::GetType('PrinterNavigation')->generate_footer_html();
152 }
153
154 $copyright = "\n<br />\n<p align=\"center\" class=\"copyright\">\n\t<a href=\"http://www.bluestatic.org\" target=\"_blank\">" . BSRegister::GetApplication() . ' ' . BSRegister::GetAppVersion() . ", &copy;2002 - " . gmdate('Y') . " Blue Static</a>\n</p>";
155
156 if (!defined('ISSO_PRINTER_HIDE_SETUP'))
157 {
158 echo("\n$copyright");
159 //echo $this->registry->construct_debug_block(false);
160 }
161
162 echo("\n\n</body>\n</html>");
163
164 // exit;
165 }
166 }
167
168 /*=====================================================================*
169 || ###################################################################
170 || # $HeadURL$
171 || # $Id$
172 || ###################################################################
173 \*=====================================================================*/
174 ?>