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