1 |
joko |
1.1 |
<?php |
2 |
|
|
/* |
3 |
|
|
## ------------------------------------------------------------------------- |
4 |
joko |
1.2 |
## $Id: DHTMLTreeNav.inc,v 1.1 2003/02/27 16:57:17 joko Exp $ |
5 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
6 |
joko |
1.2 |
## $Log: DHTMLTreeNav.inc,v $ |
7 |
|
|
## Revision 1.1 2003/02/27 16:57:17 joko |
8 |
|
|
## + initial commit, inherits from BaseWidget, uses pear-bridge |
9 |
|
|
## |
10 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
// This is a phpHtmlLib extension class implementing nested trees. |
16 |
|
|
|
17 |
|
|
// It inherits from phpHtmlLib's BaseWidget to be transparently spooled |
18 |
|
|
// down when rendering (->render!). |
19 |
|
|
|
20 |
|
|
// It uses phpHtmlLib::TreeNav::PearHtmlTreeMenuBridge to access |
21 |
|
|
// some fine component libraries from PEAR to get things done. |
22 |
|
|
|
23 |
|
|
// Please also visit its sister class phpHtmlLib::TreeNav::SelectNav, |
24 |
|
|
// which displays a nested tree flattened into a html-form "select" element. |
25 |
|
|
|
26 |
|
|
|
27 |
|
|
class DHTMLTreeNav extends BaseWidget { |
28 |
|
|
|
29 |
|
|
var $pearbridge; |
30 |
|
|
var $menuobject; |
31 |
|
|
|
32 |
|
|
function DHTMLTreeNav(&$payload) { |
33 |
|
|
|
34 |
|
|
$args[payload] = &$payload; |
35 |
|
|
$args[type] = 'DHTML'; |
36 |
|
|
$this->pearbridge = new TreeNav_PearHtmlTreeMenuBridge(&$args); |
37 |
|
|
$this->menuobject = $this->pearbridge->getMenuObject(); |
38 |
|
|
|
39 |
|
|
// initialize output the phpHtmlLib way |
40 |
|
|
$this->_init_output(); |
41 |
|
|
|
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
function _init_output() { |
46 |
|
|
|
47 |
joko |
1.2 |
/* |
48 |
|
|
// styling |
49 |
joko |
1.1 |
$this->add(' |
50 |
|
|
<style type="text/css"> |
51 |
|
|
body { |
52 |
|
|
font-family: Georgia; |
53 |
|
|
font-size: 11pt; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
.treeMenuDefault { |
57 |
|
|
font-style: italic; |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
.treeMenuBold { |
61 |
|
|
font-style: italic; |
62 |
|
|
font-weight: bold; |
63 |
|
|
} |
64 |
|
|
</style> |
65 |
|
|
'); |
66 |
joko |
1.2 |
*/ |
67 |
|
|
|
68 |
|
|
$this->add('<script src="inc/js/TreeMenu.js" language="JavaScript" type="text/javascript"></script>'); |
69 |
joko |
1.1 |
|
70 |
joko |
1.2 |
/* |
71 |
|
|
// benchmarking - before |
72 |
joko |
1.1 |
$this->add(' |
73 |
|
|
<script language="JavaScript" type="text/javascript"> |
74 |
|
|
<!-- |
75 |
|
|
a = new Date(); |
76 |
|
|
a = a.getTime(); |
77 |
|
|
//--> |
78 |
|
|
</script> |
79 |
|
|
'); |
80 |
joko |
1.2 |
*/ |
81 |
joko |
1.1 |
|
82 |
joko |
1.2 |
$this->add($this->menuobject->toHTML()); |
83 |
joko |
1.1 |
|
84 |
joko |
1.2 |
/* |
85 |
|
|
// benchmarking - afterwards |
86 |
joko |
1.1 |
$this->add(' |
87 |
|
|
<script language="JavaScript" type="text/javascript"> |
88 |
|
|
<!-- |
89 |
|
|
b = new Date(); |
90 |
|
|
b = b.getTime(); |
91 |
|
|
|
92 |
|
|
document.write("Time to render tree: " + ((b - a) / 1000) + "s"); |
93 |
|
|
//--> |
94 |
|
|
</script> |
95 |
|
|
'); |
96 |
joko |
1.2 |
*/ |
97 |
joko |
1.1 |
|
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
?> |