From 3d55eb5f0171ed3b65d58b191a05ce86bed9fbce Mon Sep 17 00:00:00 2001
From: Robert Sesek <rsesek@bluestatic.org>
Date: Sat, 1 Apr 2006 22:07:59 +0000
Subject: [PATCH] Adding structure-creation functions

---
 printer_navigation.php | 58 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 2 deletions(-)

diff --git a/printer_navigation.php b/printer_navigation.php
index 0cfe891..5b52950 100644
--- a/printer_navigation.php
+++ b/printer_navigation.php
@@ -57,11 +57,25 @@ class Printer_Navigation
 	var $toplinks = array();
 	
 	/**
-	* Navigational structure
+	* Navigational tabs: array(text, url)
 	* @var	array
 	* @access	private
 	*/
-	var $structure = array();
+	var $tabs = array();
+	
+	/**
+	* Sections: text
+	* @var	array
+	* @access	private
+	*/
+	var $sections = array();
+	
+	/**
+	* Links: array(text, url)
+	* @var	array
+	* @access	private
+	*/
+	var $links = array();
 	
 	// ###################################################################
 	/**
@@ -95,6 +109,46 @@ class Printer_Navigation
 		$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(
+	*	'<tab_>unique_key'	=> array(
+	*		'<section_>unique_key'	=> array(
+	*			'<link_>unique_key'	=> array('text', 'url')
+	*		)
+	*	)
+	* )
+	*
+	* Note that the portion in brackets is automatically added to the key
+	* when using the set_focus() method and 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);
+		}
+	}
+	
 	// ###################################################################
 	/**
 	* Generates the header HTML that is called in ISSO.Printer->page_start()
-- 
2.43.5