1 |
<?php |
2 |
/* |
3 |
## ------------------------------------------------------------------------- |
4 |
## $Id: DHTMLTreeNav.inc,v 1.2 2003/02/28 04:24:17 joko Exp $ |
5 |
## ------------------------------------------------------------------------- |
6 |
## $Log: DHTMLTreeNav.inc,v $ |
7 |
## Revision 1.2 2003/02/28 04:24:17 joko |
8 |
## disabled benchmarking |
9 |
## - purged old code |
10 |
## |
11 |
## Revision 1.1 2003/02/27 16:57:17 joko |
12 |
## + initial commit, inherits from BaseWidget, uses pear-bridge |
13 |
## |
14 |
## ------------------------------------------------------------------------- |
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 |
// pre-flight check |
39 |
if (!$payload) { |
40 |
user_error("DHTMLTreeNav: \$payload was empty."); |
41 |
return; |
42 |
} |
43 |
|
44 |
$args[payload] = &$payload; |
45 |
$args[type] = 'DHTML'; |
46 |
$this->pearbridge = new TreeNav_PearHtmlTreeMenuBridge(&$args); |
47 |
$this->menuobject = $this->pearbridge->getMenuObject(); |
48 |
|
49 |
// initialize output the phpHtmlLib way |
50 |
$this->_init_output(); |
51 |
|
52 |
} |
53 |
|
54 |
|
55 |
function _init_output() { |
56 |
|
57 |
/* |
58 |
// styling |
59 |
$this->add(' |
60 |
<style type="text/css"> |
61 |
body { |
62 |
font-family: Georgia; |
63 |
font-size: 11pt; |
64 |
} |
65 |
|
66 |
.treeMenuDefault { |
67 |
font-style: italic; |
68 |
} |
69 |
|
70 |
.treeMenuBold { |
71 |
font-style: italic; |
72 |
font-weight: bold; |
73 |
} |
74 |
</style> |
75 |
'); |
76 |
*/ |
77 |
|
78 |
$this->add('<script src="inc/js/TreeMenu.js" language="JavaScript" type="text/javascript"></script>'); |
79 |
|
80 |
/* |
81 |
// benchmarking - before |
82 |
$this->add(' |
83 |
<script language="JavaScript" type="text/javascript"> |
84 |
<!-- |
85 |
a = new Date(); |
86 |
a = a.getTime(); |
87 |
//--> |
88 |
</script> |
89 |
'); |
90 |
*/ |
91 |
|
92 |
$this->add($this->menuobject->toHTML()); |
93 |
|
94 |
/* |
95 |
// benchmarking - afterwards |
96 |
$this->add(' |
97 |
<script language="JavaScript" type="text/javascript"> |
98 |
<!-- |
99 |
b = new Date(); |
100 |
b = b.getTime(); |
101 |
|
102 |
document.write("Time to render tree: " + ((b - a) / 1000) + "s"); |
103 |
//--> |
104 |
</script> |
105 |
'); |
106 |
*/ |
107 |
|
108 |
} |
109 |
|
110 |
} |
111 |
|
112 |
?> |