/[cvs]/nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/navigation/DHTMLTreeNav.inc
ViewVC logotype

Annotation of /nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/navigation/DHTMLTreeNav.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Wed Jul 7 02:38:45 2004 UTC (20 years, 2 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +15 -12 lines
now independent of Data::Lift

1 joko 1.1 <?php
2     /**
3     * This file contains the TreeNav_PearHtmlTreeMenuBridge class.
4     *
5     * @author Andreas Motl <andreas.motl@ilo.de>
6     * @package org.netfrag.patches
7     * @name DHTMLTreeNav
8     *
9     */
10    
11     /**
12     * Cvs-Log:
13     *
14 joko 1.2 * $Id: DHTMLTreeNav.inc,v 1.1 2003/06/06 04:18:03 joko Exp $
15 joko 1.1 *
16     * $Log: DHTMLTreeNav.inc,v $
17 joko 1.2 * Revision 1.1 2003/06/06 04:18:03 joko
18     * rearranged widgets
19     *
20 joko 1.1 * Revision 1.2 2003/05/13 16:29:11 joko
21     * using built-in structure reader
22     *
23     *
24     * Revision 1.1 2003/04/18 13:53:05 joko
25     * from com.newsblob.phphtmllib/widgets
26     *
27     * Revision 1.2 2003/02/28 04:24:17 joko
28     * disabled benchmarking
29     * - purged old code
30     *
31     * Revision 1.1 2003/02/27 16:57:17 joko
32     * + initial commit, inherits from BaseWidget, uses pear-bridge
33     *
34     *
35     */
36    
37 joko 1.2 require_once('HTML/TreeMenu.php');
38    
39 joko 1.1 /**
40     * DHTMLTreeNav
41     *
42     * This is a phpHtmlLib extension class implementing nested trees.
43     *
44     * It inherits from phpHtmlLib's BaseWidget to be transparently spooled
45     * down when rendering (->render!).
46     *
47 joko 1.2 * It uses some fine component libraries from PEAR to get things done.
48 joko 1.1 *
49     * Please also visit its sister class phpHtmlLib::TreeNav::SelectNav,
50     * which displays a nested tree flattened into a html-form "select" element.
51     *
52     *
53     * @author Andreas Motl <andreas.motl@ilo.de>
54     * @copyright (c) 2003 - All Rights reserved.
55     * @license GNU LGPL (GNU Lesser General Public License)
56     *
57     * @link http://www.netfrag.org/~joko/
58     * @link http://www.gnu.org/licenses/lgpl.txt
59     *
60     * @package org.netfrag.patches
61     * @subpackage phphtmllib::widgets
62     * @name DHTMLTreeNav
63     *
64     * @link http://cvs.netfrag.org/php/libs/org.netfrag.patches
65     *
66     */
67     class DHTMLTreeNav extends BaseWidget {
68    
69     var $menuobject;
70    
71     function DHTMLTreeNav(&$payload) {
72    
73     // pre-flight check
74     if (!$payload) {
75     user_error("DHTMLTreeNav: \$payload was empty.");
76     return;
77     }
78    
79 joko 1.2 $params = array(
80     type => 'kriesing',
81     structure => $payload
82     );
83     $treemenu = HTML_TreeMenu::createFromStructure($params);
84    
85     // menu style: nested tree, nodes rendered hierarchical
86     $this->menuobject = new HTML_TreeMenu_DHTML($treemenu, array('images' => 'img/widgets/tree', 'defaultClass' => 'treeMenuDefault'));
87 joko 1.1
88     // initialize output the phpHtmlLib way
89     $this->_init_output();
90    
91     }
92    
93    
94     function _init_output() {
95    
96     /*
97     // styling
98     $this->add('
99     <style type="text/css">
100     body {
101     font-family: Georgia;
102     font-size: 11pt;
103     }
104    
105     .treeMenuDefault {
106     font-style: italic;
107     }
108    
109     .treeMenuBold {
110     font-style: italic;
111     font-weight: bold;
112     }
113     </style>
114     ');
115     */
116    
117     $this->add('<script src="inc/js/TreeMenu.js" language="JavaScript" type="text/javascript"></script>');
118    
119     /*
120     // benchmarking - before
121     $this->add('
122     <script language="JavaScript" type="text/javascript">
123     <!--
124     a = new Date();
125     a = a.getTime();
126     //-->
127     </script>
128     ');
129     */
130    
131     $this->add($this->menuobject->toHTML());
132    
133     /*
134     // benchmarking - afterwards
135     $this->add('
136     <script language="JavaScript" type="text/javascript">
137     <!--
138     b = new Date();
139     b = b.getTime();
140    
141     document.write("Time to render tree: " + ((b - a) / 1000) + "s");
142     //-->
143     </script>
144     ');
145     */
146    
147     }
148    
149     }
150    
151     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed