) * @var string */ private $realm = '[UNDEFINED REALM]'; /** * CSS to place in the page * @var string */ private $css = ''; /** * Extra code to place * @var sring */ private $code = ''; /** * Page-start hooko * @var string */ private $page_start_hook = ':=NO METHOD=:'; /** * Language information array: ('langcode' =>, 'direction' =>, 'charset' =>) * @var array */ private $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8'); /** * Fields array that is used in this module * @var array */ private $fields = array( 'realm' => array(REQ_YES, null, false) ); // ################################################################### /** * Constructor */ public function __construct(&$registry) { $this->registry =& $registry; } // ################################################################### /** * Sets an ISSO field * * @param string Field name * @param mixed Value of the field */ public function set($name, $value) { $this->registry->do_set($name, $value, 'printer'); } // ################################################################### /** * Gets the language array information * * @return array Language array */ public function getLanguageInformation() { return $this->language; } // ################################################################### /** * Sets the language array information * * @param array Language array */ public function setLanguageInformation($lang) { $this->language = $lang; } // ################################################################### /** * Gets an ISSO field * * @param string Field name * * @return mixed Value of the field */ public function get($fieldname) { return $this->registry->do_get($fieldname, 'printer'); } // ################################################################### /** * Creates a redirect to another page; constructs the header and footer * (therefore execution stops) * * @param string Location to redirect to * @param string Redirect message to be shown * @param array An aray of POST variables to send through on the redirect */ public function redirect($location, $message = null, $postvars = array()) { $timeout = 10 * 200; if ($postvars) { $js = << JS; } else { $js = << JS; } if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $this->page_start($this->registry->modules['localize']->string('Redirect')); if ($postvars) { $this->form_start($location, null, false, 'postvars'); foreach ($postvars AS $key => $value) { $this->form_hidden_field($key, $value); } $this->form_end(); } $redir = sprintf($this->registry->modules['localize']->string('Please wait to be redirected. If you are not redirected in a few seconds, click here.'), $location); $override = false; if ($message == null) { $showmessage = $redir; } else { $showmessage = '
' . $message . '
'; $showmessage .= "\n

" . $redir . "

"; $override = true; } $this->page_message($this->registry->modules['localize']->string('Redirect'), $showmessage, $override); $this->page_code($js); $this->page_end(); } // ################################################################### /** * Throws a fatal error; constructs the header and footer * * @param string Error messsage text */ public function error($message) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $this->page_start($this->registry->modules['localize']->string('Error')); $this->page_message($this->registry->modules['localize']->string('Error'), $message); $this->page_end(); exit; } // ################################################################### /** * Outputs the header of the page: doctype, , , , * <body> and imbeds the style information * * @param string Title of the page * @param string Class of the page to be applied to the body * @param string Extra HTML to imbed in the <head> tag * @param string <body> onLoad action to imbed */ public function page_start($actiontitle, $pageclass = null, $extra = '', $onload = false) { $this->registry->check_isso_fields(get_class($this)); if ($this->registry->debug AND isset($_GET['query'])) { ob_start(); } if (defined('ISSO_PRINTER_DONE_HEADER') AND constant('ISSO_PRINTER_DONE_HEADER')) { return; } $title = sprintf($this->registry->modules['localize']->string('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xml:lang=\"" . $this->language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n<head>"; echo "\n\t<title>$title"; echo "\n\t"; echo $this->css; echo $this->code; echo ($extra ? "\n$extra" : ''); echo "\n\n\n"; if ($this->registry->is_loaded('printer_navigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true))) { echo $this->registry->modules['printer_navigation']->generate_header_html(); } if (!defined('ISSO_PRINTER_DONE_HEADER')) { define('ISSO_PRINTER_DONE_HEADER', 1); } } // ################################################################### /** * Links CSS to the page from a given relative path * * @param string Relative path to the CSS file */ public function css_link($path) { $this->css .= "\n\t"; } // ################################################################### /** * Imbeds actual CSS information into the page in "; } // ################################################################### /** * Places raw HTML code directly into the documet at the current * position * * @param string HTML code */ public function page_code($code) { if (defined('ISSO_PRINTER_DONE_HEADER')) { echo "\n\n$code\n\n"; } else { $this->code .= "\n\n$code\n\n"; } } // ################################################################### /** * A block function that produces a table with a message in it. This * does not print the header and footer. * * @param string The title of the message (appears at the top of the block) * @param string Content of the message * @param bool Override the message: control the entire output (no
)? */ public function page_message($title, $message, $overridemessage = false) { $this->table_start(true, '75%'); $this->table_head($title, 1); $this->row_span(($overridemessage ? $message : "
$message
"), ':swap:', 'left', 1); $this->table_end(); } // ################################################################### /** * 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 for YES * @param string DO action to pass * @param array Hidden parameters to pass to the next page */ public function page_confirm($message, $location, $action, $params) { if (!defined('ISSO_PRINTER_NO_NAVIGATION')) { define('ISSO_PRINTER_NO_NAVIGATION', 1); } $this->page_start($this->registry->modules['localize']->string('Confirm')); $this->form_start($location, $action); foreach ($params AS $key => $value) { $this->form_hidden_field($key, $value); } $this->table_start(true, '75%'); $this->table_head($this->registry->modules['localize']->string('Confirm'), 1); $this->row_span("
$message
", ':swap:', 'left', 1); $this->row_submit('', $this->registry->modules['localize']->string('Yes'), ''); $this->table_end(); $this->form_end(); $this->page_end(); } // ################################################################### /** * Closes the HTML document structure an adds the copyright; this also * stops execution of the page */ public function page_end() { if ($this->registry->debug AND isset($_GET['query'])) { ob_clean(); ob_end_clean(); if (is_array($this->registry->modules[ISSO_DB_LAYER]->history)) { foreach ($this->registry->modules[ISSO_DB_LAYER]->history AS $query) { echo $this->registry->modules[ISSO_DB_LAYER]->construct_query_debug($query); } } exit; } if ($this->registry->is_loaded('printer_navigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true))) { echo $this->registry->modules['printer_navigation']->generate_footer_html(); } $copyright = "\n
\n

\n\t" . $this->registry->get('application') . ' ' . $this->registry->get('appversion') . ", ©2002 - " . date('Y') . " Blue Static\n

"; if (!defined('ISSO_PRINTER_HIDE_SETUP')) { echo "\n$copyright"; echo $this->registry->construct_debug_block(false); } echo "\n\n\n"; exit; } // ------------------------------------------------------------------- // ################################################################### /** * Opens a tag with styling * * @param bool Whether to add a
before the table * @param string Value of the width attribute */ public function table_start($break = true, $width = '90%') { if ($break) { echo '
'; } echo "\n
\n"; } // ################################################################### /** * Adds a table row that is sued to head the entire table * * @param string Title string * @param integer Colspan attribute value * @param bool Whether to bold the title */ public function table_head($title, $colspan = 2, $strong = true) { echo "\n\t\n\n"; } // ################################################################### /** * Creates column headings; useful for a grid-style page. This uses a * different styling than table_head() and is usually used directly * after a table header. * * @param array Array of titles to print */ public function table_column_head($columnarray) { if (is_array($columnarray)) { $render = "\n"; foreach ($columnarray AS $header) { $render .= "\t\n"; } $render .= "\n"; echo $render; } } // ################################################################### /** * Closes a
" . (($strong) ? "$title" : $title) . "
$header
tag */ public function table_end() { echo "\n
\n"; } // ------------------------------------------------------------------- // ################################################################### /** * Starts a
tag and adds the DO hidden input field * * @param string Action/name of the file to action to * @param string Value of the DO parameter; used to do-branch * @param bool Enctype attribute; used for mime/multi-part * @param string Name of the form; this only matters for DOM access * @param string Method to action as; POST or GET (default is POST) */ public function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post') { echo "\n\n\n"; if ($do !== null) { $this->form_hidden_field('do', $do); } } // ################################################################### /** * Adds a hidden field at the current location * * @param string Name of the field * @param string Value of the field */ public function form_hidden_field($name, $value) { echo "\n"; } // ################################################################### /** * Closes a tag */ public function form_end() { echo "
\n\n"; } // ------------------------------------------------------------------- // ################################################################### /** * Creates a table row that spans an entire row; this is used to divide * sections, usually * * @param string Text to place in the row * @param string Class name to style with; by default it alternates between alt1 and alt2 (use :swap: to do that) * @param string Alignment of the text in the row * @param integer Colspan attribute */ public function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2) { if ($class === ':swap:') { $this->registry->modules['functions']->exec_swap_bg(); $row_class = $this->registry->modules['functions']->bgcolour; $is_style_element = false; } else { if (preg_match('#:style:(.*?)#i', $class)) { $is_style_element = true; $style = str_replace(':style:', '', $class); } else { $row_class = $class; $is_style_element = false; } } echo "\n\n\t$text\n"; } // ################################################################### /** * Creates a table row that has more than two columns; this is used in * conjunction with table_column_head() usually; it takes an array of * values * * @param array Array of values in form value => alignment key (c for center, l for left, and r for right) */ public function row_multi_item($row_array) { $this->registry->modules['functions']->exec_swap_bg(); foreach ($row_array AS $item => $align) { $row_data["$align"][] = $item; } echo ""; foreach ($row_data AS $align_key => $item_array) { if ($align_key == 'c') { $align = 'center'; } else if ($align_key == 'l') { $align = 'left'; } else if ($align_key == 'r') { $align = 'right'; } foreach ($item_array AS $value) { echo "\n\tregistry->modules['functions']->bgcolour}\" align=\"$align\">$value"; } } echo "\n\n"; } // ################################################################### /** * Generic row creation function that has two columns: label and value; * this is used for many other form functions, but can also be used for * non-editable fields * * @param string Label text * @param string HTML or text to place in the value column * @param string Vertical align (valign attribute) for the row * @param integer Colspan attribute * @param string Class to style the row with; default is to alternate */ public function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1) { global $IS_SETTINGS; if ($class == -1) { if (!$IS_SETTINGS) { $this->registry->modules['functions']->exec_swap_bg(); $row_class = $this->registry->modules['functions']->bgcolour; } else { $row_class = 'alt2'; } } else { $row_class = $class; } echo ""; echo "\n\t$label"; echo "\n\t$value"; echo "\n\n"; } // ################################################################### /** * Creates a table row with an text field as the value column * * @param string Label text * @param string Name of the field * @param string Value of the field * @param integer Colspan attribute * @param integer Size of the field * @param integer Length attribute; use FALSE for no length to be specified * @param bool Whether to make this a password field * @param string Vertical align (valign attribute) */ public function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top') { $this->row_text($label, "", $lalign, $colspan); } // ################################################################### /** * Creates a table row with a ", 'top', $colspan); } // ################################################################### /** * Creates a table row with the tfoot class * * @param string Extra text or HTML to insert into the row * @param integer Colspan attribute */ public function row_tfoot($data, $colspan = 2) { echo $this->row_span($data, 'tfoot', 'center', $colspan); } // ################################################################### /** * Creates a tfoot table row with submit buttons * * @param string Extra HTML to imbed in the row after the buttons * @param string Submit button text (by default it uses pre-translated "Submit" from :save:) * @param string Reset button text (default it uses pre-translated "Reset" from :reset:) * @param integer Colspan attribute */ public function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2) { if ($submit === ':save:') { $submit = " " . $this->registry->modules['localize']->string('Submit') . " "; } else { $submit = " $submit "; } if ($reset === ':reset:') { $reset = " " . $this->registry->modules['localize']->string('Reset') . " "; } else { $reset = (($reset) ? " $reset " : ''); } $output = "\n\t\t"; $output .= ($reset ? "\n\t\t" : ''); $output .= ($extra ? "\n\t\t$extra" : ''); $output .= "\n\t"; $this->row_tfoot($output, $colspan); } // ################################################################### /** * Creates an upload row; you need to specify some other paramaters in * form_start() for this to work * * @param string Label text * @param string Upload name * @param integer Colspan attribute */ public function row_upload($label, $name, $colspan = 2) { $this->row_text($label, "", 'top', $colspan); } // ################################################################### /** * Adds a name-value pair to an array that is constructed into a * table row from list_item() items * * @param string Label text * @param string Name of the $optionlist\n" . (($is_jump) ? "\nregistry->modules['localize']->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan); } // ################################################################### /** * Assembles a list of checkboxes from list_item() items * * @param string Label text * @param string Name of the s * @param integer Colspan attribute */ public function row_checkbox($label, $name, $colspan = 2) { global $listitem; foreach ($listitem AS $value => $box) { $optionlist[] = "\n\t $box[name]"; } $listitem = array(); $this->row_text($label, "\n" . implode('
', $optionlist) . "\n", $colspan); } // ################################################################### /** * Creates a row with two radio buttons: yes and now * * @param string Label text * @param string Name of the BOOL flag * @param bool TRUE to select the YES by default; FALSE for NO * @param integer Colspan attribute */ public function row_yesno($label, $name, $value, $colspan = 2) { $this->row_text($label, " " . $this->registry->modules['localize']->string('Yes') . " " . $this->registry->modules['localize']->string('No'), $colspan); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>