From 9505ac83a2035a5a6adeba2428fa739083c9af94 Mon Sep 17 00:00:00 2001 From: Robert Sesek <rsesek@bluestatic.org> Date: Sun, 16 Apr 2006 18:47:57 +0000 Subject: [PATCH] Fix the set_focus() setting issues --- printer_navigation.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/printer_navigation.php b/printer_navigation.php index f50bbdc..0604a41 100644 --- a/printer_navigation.php +++ b/printer_navigation.php @@ -163,30 +163,36 @@ class Printer_Navigation * * @param string Scope operator * @param string Unique key in scope + * @param string Parent operator (links only) */ - function set_focus($scope, $key) + function set_focus($scope, $key, $parent) { if ($scope == 'tab') { - $array = 'tabs'; + if (isset($this->tabs["$key"])) + { + $this->focus["$scope"] = $key; + } + else + { + trigger_error('Invalid key for scope', E_USER_WARNING); + } } else if ($scope == 'link') { - $array = 'links'; + if (isset($this->links["$parent"]["$key"])) + { + $this->focus["$scope"] = $key; + } + else + { + trigger_error('Invalid key for scope', E_USER_WARNING); + } } 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; - } - else - { - trigger_error('Invalid key for scope', E_USER_WARNING); - } } // ################################################################### @@ -250,7 +256,7 @@ class Printer_Navigation $output .= "\n\t" . '<li class="header"><span>' . $text . '</span></li>'; foreach ((array)$this->links["$key"] AS $key2 => $content) { - $output .= "\n\t" . '<li' . ($this->focus['link'] == $key ? ' class="focus"' : '') . '><a href="' . $content[1] . '"><span>' . $content[0] . '</span></a></li>'; + $output .= "\n\t" . '<li' . ($this->focus['link'] == $key2 ? ' class="focus"' : '') . '><a href="' . $content[1] . '"><span>' . $content[0] . '</span></a></li>'; } $output .= "\n" . '</ul>' . "\n"; } -- 2.43.5