title = $title; } /** * Makes a new instance of the object in a static fashion * * @return object */ public static function make() { $obj = new ReflectionClass(__CLASS__); $args = func_get_args(); return $obj->newInstanceArgs($args); } // ################################################################### /** * 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::row_submit(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::get_language_information(); echo "\n"; echo "\n"; echo "\n\t