title = $title; } // ################################################################### /** * Creates a redirect to another page; constructs the header and footer * (therefore execution stops) * * @param string Controller * @param string Action * @param string Redirect message to be shown * @param array An aray of POST variables to send through on the redirect */ public static function Redirect($controller, $action, $message = null, $postvars = array()) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $page = new BSPrinterRootElementPage(_('Redirect')); $page->addChild(new BSPrinterLabelElement(' ')); if ($postvars) { $vars = new BSPrinterRootElementForm($controller, $action, 'postvars'); foreach ($postvars AS $key => $value) { $vars->addChild(new BSPrinterBaseElement('hidden', $key, $value)); } $page->addChild($vars); } $redir = _('Please wait to be redirected. This page will load in a few seconds.'); $override = false; if ($message == null) { $showmessage = $redir; } else { $showmessage = '
' . $message . '
'; $showmessage .= "\n

" . $redir . "

"; $override = true; } $page->addChild(BSPrinterRootElementPage::Message(_('Redirect'), $showmessage)); $page->paint(); exit; } // ################################################################### /** * Prints a complete table message * * @param string Message title * @param string Message text * * @return BSPrinterRootElementTable A table */ public static function Message($title, $message) { $table = new BSPrinterRootElementTable(); $head = new BSPrinterTableElement(); $head->setCssClass('tcat'); $head->addChild(new BSPrinterLabelElement($title)); $table->addHeadingChild($head); $msg = new BSPrinterTableElement(); $msg->addChild(new BSPrinterLabelElement((strpos($message, '$message" : $message))); $table->addChild($msg); return $table; } // ################################################################### /** * Produces an entire page layout that asks the user whether or not * they want to perform X action and provides a link to the YES and NO * action * * @param string Message that asks if they want to do X * @param string Controller to go for YES * @param string Action to pass * @param array Hidden parameters to pass to the next page */ public static function Confirm($message, $controller, $action, $params) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $page = new BSPrinterRootElementPage(_('Confirm')); $form = new BSPrinterRootElementForm($controller, $action); foreach ($params AS $key => $value) { $form->addChild(new BSPrinterBaseElement('hidden', $key, $value)); } $page->addChild($form); $table = new BSPrinterRootElementTable(); $table->setWidth('75%'); $head = new BSPrinterTableElement(); $head->addChild(new BSPrinterLabelElement(_('Confirm'))); $head->setCssClass('tcat'); $table->addChild($head); $table->addChild(new BSPrinterTableElement(new BSPrinterLabelElement("
$message
"))); $no = new BSPrinterBaseElement('button', '__no__', _('No')); $no->setOnClick('history.back(1); return false;'); $table->addChild(BSPrinterTableElement::RowSubmit(array($no), _('Yes'), null)); $form->addChild($table); $page->paint(); exit; } // ################################################################### /** * Throws a fatal error message * * @param string Error string */ public static function Error($message) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $page = new BSPrinterRootElementPage(_('Error')); $page->addChild(BSPrinterRootElementPage::Message(_('Error'), $message)); $page->paint(); exit; } // ################################################################### /** * Returns the HTML for all printed children elements * * @return string Printed HTML */ protected function _paintChildren() { $builder = ''; foreach ($this->children AS $child) { $this->builder .= "\n" . $child->paint() . "\n"; } return $this->builder; } // ################################################################### /** * Tells the element to paint itself (and any children) */ public function paint() { $language = BSPrinter::GetLanguageInformation(); echo "\n"; echo "\n"; echo "\n\t" . sprintf(_('%1$s - %2$s - %3$s'), BSApp::GetApplication(), BSPrinter::GetRealm(), $this->title) . ""; echo "\n\t"; echo "\n\t"; echo "\n\n\n"; if (BSApp::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) { echo BSApp::GetType('PrinterNavigation')->constructHeaderHtml(); } echo $this->_paintChildren(); if (BSApp::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) { echo BSApp::GetType('PrinterNavigation')->constructFooterHtml(); } $copyright = "\n
\n

\n\t" . BSApp::GetApplication() . ' ' . BSApp::GetAppVersion() . ", ©2002 - " . gmdate('Y') . " Blue Static\n

"; if (!defined('ISSO_PRINTER_HIDE_SETUP')) { echo "\n$copyright"; echo "\n\n\n"; if (BSApp::GetDebug()) { if (defined('SVN') AND preg_match('#^\$Id:?#', constant('SVN'))) { 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
\n" . '
\1 — r\2
', constant('SVN')); } if (defined('ISSO_MT_START')) { echo "\n
Executed in " . round(BSFunctions::FetchMicrotimeDiff(ISSO_MT_START), 10) . ' seconds
'; } echo "\n
" . BSApp::GetDebugList() . "
\n"; if (BSApp::GetType('Db')) { $queries = BSApp::GetType('Db')->getHistory(); $table = new BSPrinterRootElementTable(); $head = new BSPrinterTableElement(); $head->addChild(new BSPrinterLabelElement('Query Debug')); $head->setCssClass('thead'); $table->addHeadingChild($head); foreach ($queries AS $query) { $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement("\n\t\t\t" . $query['query'] . "\n\n\t\t\t
(" . $query['time'] . ")
\n\n\t\t")); $table->addChild($tr); } $table->setWidth('30%'); echo $table->paint(); } } } echo "\n\n\n"; } } /*=====================================================================* || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>