/[cvs]/nfo/php/libs/net.php.pear/HTML/TreeMenu/docs/example.php
ViewVC logotype

Contents of /nfo/php/libs/net.php.pear/HTML/TreeMenu/docs/example.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Thu Feb 27 16:45:23 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
+ initial commit, from PEAR

1 <?php
2 // +-----------------------------------------------------------------------+
3 // | Copyright (c) 2002-2003, Richard Heyes, Harald Radi |
4 // | All rights reserved. |
5 // | |
6 // | Redistribution and use in source and binary forms, with or without |
7 // | modification, are permitted provided that the following conditions |
8 // | are met: |
9 // | |
10 // | o Redistributions of source code must retain the above copyright |
11 // | notice, this list of conditions and the following disclaimer. |
12 // | o Redistributions in binary form must reproduce the above copyright |
13 // | notice, this list of conditions and the following disclaimer in the |
14 // | documentation and/or other materials provided with the distribution.|
15 // | o The names of the authors may not be used to endorse or promote |
16 // | products derived from this software without specific prior written |
17 // | permission. |
18 // | |
19 // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 // | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 // | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 // | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 // | |
31 // +-----------------------------------------------------------------------+
32 // | Author: Richard Heyes <richard@phpguru.org> |
33 // | Harald Radi <harald.radi@nme.at> |
34 // +-----------------------------------------------------------------------+
35 //
36 // Id: example.php,v 1.12 2003/02/21 18:19:39 richard Exp
37 // $Id: example.php,v 1.12 2003/02/21 18:19:39 richard Exp $
38
39 require_once('HTML/TreeMenu.php');
40 //require_once('../TreeMenu.php');
41
42 $icon = 'folder.gif';
43 $expandedIcon = 'folder-expanded.gif';
44
45 $menu = new HTML_TreeMenu();
46
47 $node1 = new HTML_TreeNode(array('text' => "First level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon), array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')"));
48 $node1_1 = &$node1->addItem(new HTML_TreeNode(array('text' => "Second level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
49 $node1_1_1 = &$node1_1->addItem(new HTML_TreeNode(array('text' => "Third level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
50 $node1_1_1_1 = &$node1_1_1->addItem(new HTML_TreeNode(array('text' => "Fourth level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
51 $node1_1_1_1->addItem(new HTML_TreeNode(array('text' => "Fifth level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'cssClass' => 'treeMenuBold')));
52
53 $node1->addItem(new HTML_TreeNode(array('text' => "Second level, item 2", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
54 $node1->addItem(new HTML_TreeNode(array('text' => "Second level, item 3", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
55
56 $menu->addItem($node1);
57 $menu->addItem($node1);
58
59 // Create the presentation class
60 $treeMenu = &new HTML_TreeMenu_DHTML($menu, array('images' => '../images', 'defaultClass' => 'treeMenuDefault'));
61 $listBox = &new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self'));
62 ?>
63 <html>
64 <head>
65 <style type="text/css">
66 body {
67 font-family: Georgia;
68 font-size: 11pt;
69 }
70
71 .treeMenuDefault {
72 font-style: italic;
73 }
74
75 .treeMenuBold {
76 font-style: italic;
77 font-weight: bold;
78 }
79 </style>
80 <script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script>
81 </head>
82 <body>
83
84 <script language="JavaScript" type="text/javascript">
85 <!--
86 a = new Date();
87 a = a.getTime();
88 //-->
89 </script>
90
91 <?$treeMenu->printMenu()?>
92 <?$listBox->printMenu()?>
93
94 <script language="JavaScript" type="text/javascript">
95 <!--
96 b = new Date();
97 b = b.getTime();
98
99 document.write("Time to render tree: " + ((b - a) / 1000) + "s");
100 //-->
101 </script>
102 </body>
103 </html>

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