2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Printer - Navigation Generator
24 * printer_navigation.php
30 * Printer - Navigation Generator
32 * This framework works in conjunction with ISSO.Printer to generate a page header
33 * and sidebar to be used for navigation. You set the navigation array and then can
34 * specify a given key to highlight elements. Elements are broken into three types:
35 * tabs (top of the page), groups (blocks of link actions), and links
37 * @author Iris Studios, Inc.
38 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
43 class Printer_Navigation
46 * Framework registry object
53 * Global links that are used for admin home, logout, etc.
57 var $toplinks = array();
60 * Navigational tabs: array(text, url)
71 var $sections = array();
74 * Links: array(text, url)
80 // ###################################################################
84 function __construct(&$registry)
86 $this->registry
=& $registry;
89 // ###################################################################
93 function Printer_Navigation(&$registry)
95 $this->__construct($registry);
98 // ###################################################################
100 * Adds a global link to the array; these cannot be removed once added
104 * @param string Link text
105 * @param string HREF of the URL
107 function add_top_link($text, $href)
109 $this->toplinks
["$href"] = $text;
112 // ###################################################################
114 * Adds to the structure array. The following is the global structure
115 * of the array, but you can specify any entry point. When you add onto
116 * the structure, it will go at the bottom
118 * '<tab>unique_key' => array(
119 * '<section>unique_key' => array(
120 * '<link>unique_key' => array('text', 'url')
125 * Note that the portion in brackets is called the "scope"
129 * @param string Scope to add to
130 * @param string Unique key for the scope
131 * @param string Parent key to add to
132 * @param string Text to display (usually localized)
133 * @param string URL to go to when text is clicked
135 function add_component($scope, $key, $parent, $text, $url)
139 $this->tabs
["$key"] = array($text, $url);
141 else if ($scope == 'section')
143 $this->sections
["$parent"]["$key"] = $text;
145 else if ($scope == 'link')
147 $this->links
["$parent"]["$key"] = array($text, $url);
151 // ###################################################################
153 * Generates the header HTML that is called in ISSO.Printer->page_start()
154 * to setup the navigation frame
158 * @return string Generated HTML content
160 function generate_header_html()
162 $output = '<!-- navigation start -->' . "\n\n";
165 foreach ($this->toplinks
AS $href => $text)
167 $output2[] = '<a href="' . $href . '" class="nav_toplink">' . $text . '</a>';
170 $output .= implode(' • ', $output2);
176 /*=====================================================================*\
177 || ###################################################################
180 || ###################################################################
181 \*=====================================================================*/