*
* @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);
- }
}
// ###################################################################
$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";
}