) * @var string */ var $realm = '[UNDEFINED REALM]'; /** * CSS to place in the page * @var string */ var $css = ''; // ################################################################### /** * Constructor */ function __construct(&$registry) { $this->registry =& $registry; } // ################################################################### /** * (PHP 4) Constructor */ function Printer(&$registry) { $this->__construct($registry); } // ################################################################### /** * Creates a redirect to another page; constructs the header and footer * (therefore execution stops) * * @access public * * @param string Location to redirect to * @param integer Time to wait before the redirect * @param array An aray of POST variables to send through on the redirect */ function redirect($location, $timeout = 10, $postvars = array()) { $timeout = $timeout * 200; if ($postvars) { $js = << JS; } else { $js = << JS; } $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(); } $this->page_message($this->registry->modules['localize']->string('Redirect'), sprintf($this->registry->modules['localize']->string('Please wait to be redirected. If you are not redirected in a few seconds, click here.'), $location)); $this->page_code($js); $this->page_end(); } // ################################################################### /** * Throws a fatal error; constructs the header and footer * * @access public * * @param string Error messsage text */ function error($message) { $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 * * @access public * * @param string Title of the page * @param string Class of the page to be applied to the body * @param integer Margin of the <div> that all content is placed in * @param string Extra HTML to imbed in the <head> tag * @param string <body> onLoad action to imbed * @param integer Margin of the actual <body > tag * @param string Relative path where the CSS data is stored * @param bool Will force re-print the header if it has already been printed */ function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.', $override = false) { if ($this->registry->debug AND isset($_GET['query'])) { ob_start(); } if (defined('DONE_HEADER') AND !$override) { if (constant('DONE_HEADER') AND !$override) { 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 xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>"; echo "\n\t<title>$title"; echo "\n\t"; echo $this->css; echo ($extra ? "\n$extra" : ''); echo "\n\n\n"; if (!defined('HIDE_SETUP') AND function_exists('_printer_page_start')) { _printer_page_start(); } echo "
\n\n\n"; if (!defined('DONE_HEADER')) { define('DONE_HEADER', 1); } } // ################################################################### /** * Links CSS to the page from a given relative path * * @access public * * @param string Relative path to the CSS file */ 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 * * @access public * * @param string HTML code */ function page_code($code) { echo "\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. * * @access public * * @param string The title of the message (appears at the top of the block) * @param string Content of the message */ function page_message($title, $message) { $this->table_start(true, '75%'); $this->table_head($title, 1); $this->row_span("
$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 * * @access public * * @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 */ function page_confirm($message, $location, $action, $params) { $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 * * @access 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)) { echo '
';
				foreach ($this->registry->modules[ISSO_DB_LAYER]->history AS $query)
				{
					echo $query . "\n\n
\n\n"; } echo '
'; } exit; } $copyright = "\n
\n

\n\t" . $this->registry->application . ' ' . $this->registry->appversion . ", © 2002 - " . date('Y') . " Iris Studios, Inc.\n

"; if (!defined('HIDE_SETUP')) { echo "\n\n
\n$copyright"; } else { echo "\n\n"; } echo $this->registry->construct_debug_block(false); echo "\n\n\n"; exit; } // ------------------------------------------------------------------- // ################################################################### /** * Opens a tag with styling * * @access public * * @param bool Whether to add a
before the table * @param string Value of the width attribute */ 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 * * @access public * * @param string Title string * @param integer Colspan attribute value * @param bool Whether to bold the title */ 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. * * @access public * * @param array Array of titles to print */ 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 * * @access public */ function table_end() { echo "\n
\n"; } // ------------------------------------------------------------------- // ################################################################### /** * Starts a
tag and adds the DO hidden input field * * @access public * * @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) */ 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 * * @access public * * @param string Name of the field * @param string Value of the field */ function form_hidden_field($name, $value) { echo "\n"; } // ################################################################### /** * Closes a tag * * @access public */ function form_end() { echo "
\n\n"; } // ------------------------------------------------------------------- // ################################################################### /** * Creates a table row that spans an entire row; this is used to divide * sections, usually * * @access public * * @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 */ 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 * * @access public * * @param array Array of values in form value => alignment key (c for center, l for left, and r for right) */ 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 * * @access public * * @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 */ 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"; if ($colspan > 2) { echo "\n\t "; } echo "\n\n"; } // ################################################################### /** * Creates a table row with an text field as the value column * * @access public * * @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) */ 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 * * @access public * * @param string Extra text or HTML to insert into the row * @param integer Colspan attribute */ function row_tfoot($data, $colspan = 2) { echo $this->row_span($data, 'tfoot', 'center', $colspan); } // ################################################################### /** * Creates a tfoot table row with submit buttons * * @access public * * @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 */ 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 * * @access public * * @param string Label text * @param string Upload name * @param integer Colspan attribute */ 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 * * @access public * * @param string Label text * @param string Name of the $optionlist\n" . (($is_jump) ? "\nregistry->modules['localize']->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan); } // ################################################################### /** * Creates a row with two radio buttons: yes and now * * @access public * * @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 */ 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$ || ################################################################### \*=====================================================================*/ ?>