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); } /** * Sets the navigation object * * @param BSPrinterNavigation Navigator * * @return fluent interface */ public function setNavigator(BSPrinterNavigation $nav) { $this->navigator = $nav; return $this; } /** * Returns the printer navigation object * * @return BSPrinterNavigation Navigation object */ public function getNavigatior() { return $this->navigatior; } /** * Sets the code to inject into the
element of the page * * @param string Code */ public function setHeaderCode($code) { $this->headerCode = $code; } /** * Creates a redirect to another page; constructs the header and footer * (therefore execution stops) * * @param string Location * @param string Redirect message to be shown * @param array An aray of POST variables to send through on the redirect */ public static function redirect($location, $message = null, $postvars = array()) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $page = new BSPrinterRootPage(_('Redirect')); $page->addChild(new BSPrinterElementLabel(' ')); if ($postvars) { $vars = new BSPrinterRootForm($location, $postvars['do'], 'postvars'); unset($postvars['do']); foreach ($postvars as $key => $value) { $vars->addChild(new BSPrinterElement('hidden', $key, $value)); } $page->addChild($vars); } $redir = _('Please wait to be redirected. This page will load in a few seconds.'); if ($message == null) { $showmessage = $redir; } else { $showmessage = '' . $message . ''; $showmessage .= "\n
" . $redir . "
"; } $page->addChild(BSPrinterRootPage::message(_('Redirect'), $showmessage)); $page->paint(); exit; } /** * Prints a complete table message * * @param string Message title * @param string Message text * * @return BSPrinterRootTable A table */ public static function message($title, $message) { $table = new BSPrinterRootTable(); $head = new BSPrinterElementTable(); $head->setCssClass('tcat'); $head->addChild(new BSPrinterElementLabel($title)); $table->addHeadingChild($head); $msg = new BSPrinterElementTable(); $msg->addChild(new BSPrinterElementLabel((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 Location to go to if the user confirms * @param string Form 'do' value * @param array Hidden parameters to pass to the next page */ public static function confirm($message, $action, $do, $params) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $page = new BSPrinterRootPage(_('Confirm')); $form = new BSPrinterRootForm($action, $do); foreach ($params as $key => $value) { $form->addChild(new BSPrinterElement('hidden', $key, $value)); } $page->addChild($form); $table = new BSPrinterRootTable(); $table->setWidth('75%'); $head = new BSPrinterElementTable(); $head->addChild(new BSPrinterElementLabel(_('Confirm'))); $head->setCssClass('tcat'); $table->addChild($head); $table->addChild(new BSPrinterElementTable(new BSPrinterElementLabel("
$message"))); $no = new BSPrinterElement('button', '__no__', _('No')); $no->setOnClick('history.back(1); return false;'); $table->addChild(BSPrinterElementTable::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 BSPrinterRootPage(_('Error')); $page->addChild(BSPrinterRootPage::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) { $builder .= "\n" . $child->paint() . "\n"; } return $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
\n\t" . BSPrinter::get_copyright() . "\n
"; if (!defined('ISSO_PRINTER_HIDE_SETUP')) { echo "\n$copyright"; echo "\n\n\n"; if (BSApp::get_debug()) { if (defined('SVN') && 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