null, 'link' => null); // ################################################################### /** * Constructor */ function __construct(&$registry) { $this->registry =& $registry; } // ################################################################### /** * (PHP 4) Constructor */ function Printer_Navigation(&$registry) { $this->__construct($registry); } // ################################################################### /** * Adds a global link to the array; these cannot be removed once added * * @access public * * @param string Link text * @param string HREF of the URL */ function add_top_link($text, $href) { $this->toplinks["$href"] = $text; } // ################################################################### /** * Adds to the structure array. The following is the global structure * of the array, but you can specify any entry point. When you add onto * the structure, it will go at the bottom * array( * 'unique_key' => array( * '
unique_key' => array( * 'unique_key' => array('text', 'url') * ) * ) * ) * * Note that the portion in brackets is called the "scope" * * @access public * * @param string Scope to add to * @param string Unique key for the scope * @param string Parent key to add to * @param string Text to display (usually localized) * @param string URL to go to when text is clicked */ function add_component($scope, $key, $parent, $text, $url) { if ($scope == 'tab') { $this->tabs["$key"] = array($text, $url); } else if ($scope == 'section') { $this->sections["$parent"]["$key"] = $text; } else if ($scope == 'link') { $this->links["$parent"]["$key"] = array($text, $url); } } // ################################################################### /** * Sets the focus for either a tab or link * * @access public * * @param string Scope operator * @param string Unique key in scope */ function set_focus($scope, $key) { if ($scope == 'tab') { $array = 'tabs'; } else if ($scope == 'link') { $array = 'links'; } else { trigger_error('Printer_Navigation::set_focus() only allows setting of focus for tab and link scopes', E_USER_ERROR); } if (isset($this->{$array}["$key"])) { $this->focus["$scope"] = $key; } } // ################################################################### /** * Generates the header HTML that is called in ISSO.Printer->page_start() * to setup the navigation frame * * @access public * * @return string Generated HTML content */ function generate_header_html() { $output = '' . "\n\n"; $output2 = array(); foreach ($this->toplinks AS $href => $text) { $output2[] = '' . $text . ''; } $output .= implode(' • ', $output2); $output .= '
'; foreach ($this->tabs AS $key => $content) { $link = "\n\t" . '' . $content[0] . ''; $output .= $link; } $output .= "\n" . '
'; $output .= "\n\n" . ''; $output .= "\n" . '
'; $output .= '
    '; foreach ((array)$this->sections[ $this->focus['tab'] ] AS $key => $text) { $output .= '
  • ' . $text . '
      '; foreach ((array)$this->links["$key"] AS $key2 => $content) { $link = '
    • ' . $content[0] . '
    • '; if ($this->focus['link'] == $key) { $output .= "$link"; } else { $output .= $link; } } $output .= '
    '; } $output .= '
'; return $output; } // ################################################################### /** * Generates the HTML that is inserted in ISSO.Printer->page_end() that * closes all of the navigation HTML stuff * * @access public * * @return string Generated HTML content */ function generate_footer_html() { $output = ''; $output .= "\n" . '
'; $output .= "\n\n" . ''; return $output; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>