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