null, 'link' => null); // ################################################################### /** * Adds a global link to the array; these cannot be removed once added * * @param string Link text * @param string HREF of the URL */ public function addTopLink($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" * * @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 */ public function addComponent($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 * * @param string Scope operator * @param string Unique key in scope * @param string Parent operator (links only) */ public function setFocus($scope, $key, $parent) { if ($scope == 'tab') { if (isset($this->tabs["$key"])) { $this->focus["$scope"] = $key; } else { throw new Exception('Invalid key for scope'); } } else if ($scope == 'link') { if (isset($this->links["$parent"]["$key"])) { $this->focus["$scope"] = $key; } else { throw new Exception('Invalid key for scope'); } } else { throw new Exception('BSPrinterNavigation::setFocus() only allows setting of focus for tab and link scopes'); } } // ################################################################### /** * Generates the header HTML that is called in BSPrinterRootElementPage * to setup the navigation frame * * @return string Generated HTML content */ public function constructHeaderHtml() { $output = '' . "\n\n"; // ------------------------------------------------------------------- $output2 = array(); foreach ($this->toplinks AS $href => $text) { $output2[] = '' . $text . ''; } $output .= "\n" . ''; // ------------------------------------------------------------------- $output .= "\n\n" . '
'; // ------------------------------------------------------------------- $output .= "\n" . '
'; foreach ($this->tabs AS $key => $content) { $link = "\n\t" . 'focus['tab'] == $key) { $link .= ' id="focustab"'; } $link .= '>' . $content[0] . ''; $output .= $link; } $output .= "\n" . '
'; // ------------------------------------------------------------------- $output .= "\n\n" . ''; $output .= "\n" . ''; // ------------------------------------------------------------------- $output .= "\n" . ''; // ------------------------------------------------------------------- $output .= "\n" . ''; $output .= "\n" . ''; $output .= "\n\n" . '
'; $output .= "\n\n" . '' . "\n"; return $output; } // ################################################################### /** * Generates the HTML that is inserted in BSPrinterRootElementPage that * closes all of the navigation HTML stuff * * @return string Generated HTML content */ public function constructFooterHtml() { $output = ''; $output .= "\n" . '' . "\n"; $output .= "\n" . '
'; $output .= "\n\n" . '
'; return $output; } } ?>