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 Root Element: Page (PrinterRootElementPage.php)
28 require_once('ISSO/PrinterRootElement.php');
31 * Printer Root Element: Page
33 * This root element represents the entire page and is usually used for all
34 * printer applications
37 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
42 class BSPrinterRootElementPage
extends BSPrinterRootElement
51 * Language information array: ('langcode' =>, 'direction' =>, 'charset' =>)
54 private $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
62 // ###################################################################
66 * @param string Page title
68 function __construct($title)
70 $this->title
= $title;
73 // ###################################################################
75 * Sets the language array information
77 * @param array Language array
79 public function setLanguageInformation($lang)
81 $this->language
= $lang;
84 // ###################################################################
86 * Sets the path to the CSS style sheet
90 public function setStylesheet($stylesheet)
92 $this->stylesheet
= $stylesheet;
95 // ###################################################################
97 * Returns the HTML for all printed children elements
99 * @return string Printed HTML
101 protected function _paintChildren()
105 foreach ($this->children
AS $child)
107 $this->builder
.= "\n" . $child->paint() . "\n";
110 return $this->builder
;
113 // ###################################################################
115 * Tells the element to paint itself (and any children)
117 public function paint()
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 "\n</head>\n<body>\n";
126 if (BSRegister::GetType('PrinterNavigation
') AND (!defined('ISSO_PRINTER_NO_NAVIGATION
') OR !constant('ISSO_PRINTER_NO_NAVIGATION
')))
128 echo BSRegister::GetType('PrinterNavigation
')->generate_header_html();
131 echo $this->_paintChildren();
133 if (BSRegister::GetType('PrinterNavigation
') AND (!defined('ISSO_PRINTER_NO_NAVIGATION
') OR !constant('ISSO_PRINTER_NO_NAVIGATION
')))
135 echo BSRegister::GetType('PrinterNavigation
')->generate_footer_html();
138 $copyright = "\n<br />\n<p align=\"center\" class=\"copyright\">\n\t<a href=\"http://www.bluestatic.org\" target=\"_blank\">" . BSRegister::GetApplication() . ' ' . BSRegister::GetAppVersion() . ", ©2002 - " . gmdate('Y
') . " Blue Static</a>\n</p>";
140 if (!defined('ISSO_PRINTER_HIDE_SETUP
'))
146 if (BSRegister::GetDebug())
148 if (defined('SVN
') AND preg_match('#^\$Id:?#', constant('SVN')))
150 echo preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', "\n<br />\n" . '<div align="center"><strong>\1</strong> — r\2</div>', constant('SVN'));
153 if (defined('ISSO_MT_START'))
155 echo "\n<div align=\"center\">Executed in " . round(BSFunctions
::FetchMicrotimeDiff(ISSO_MT_START
), 10) . ' seconds</div>';
158 echo "\n<br /><div align=\"center\">" . BSRegister
::GetDebugList() . "</div>\n";
160 if (BSRegister
::GetType('Db'))
162 $queries = BSRegister
::GetType('Db')->getHistory();
164 $table = new BSPrinterRootElementTable();
165 $head = new BSPrinterTableElement();
166 $head->addChild(new BSPrinterLabelElement('Query Debug'));
167 $head->setCssClass('thead');
168 $table->addHeadingChild($head);
170 foreach ($queries AS $query)
172 $tr = new BSPrinterTableElement();
173 $tr->addChild(new BSPrinterLabelElement("\n\t\t\t" . $query['query'] . "\n\n\t\t\t<div class=\"smallfont\">(" . $query['time'] . ")</div>\n<!--\n" . $query['trace'] . "\n-->\n\t\t"));
174 $table->addChild($tr);
177 $table->setWidth('30%');
179 echo $table->paint();
184 echo("\n\n</body>\n</html>");
188 /*=====================================================================*
189 || ###################################################################
192 || ###################################################################
193 \*=====================================================================*/