1 |
<?php |
2 |
/* |
3 |
## ------------------------------------------------------------------------- |
4 |
## $Id: SelectNav.inc,v 1.2 2003/02/28 04:24:17 joko Exp $ |
5 |
## ------------------------------------------------------------------------- |
6 |
## $Log: SelectNav.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:36 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::DHTMLTreeNav, |
28 |
// which displays a navigatable tree (expand, collapse) using JavaScript. |
29 |
|
30 |
|
31 |
class SelectNav extends BaseWidget { |
32 |
|
33 |
var $pearbridge; |
34 |
var $menuobject; |
35 |
|
36 |
function SelectNav(&$payload) { |
37 |
|
38 |
$args[payload] = &$payload; |
39 |
$args[type] = 'Listbox'; |
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 |
$this->add('<script src="inc/js/TreeMenu.js" language="JavaScript" type="text/javascript"></script>'); |
52 |
|
53 |
/* |
54 |
// benchmarking - before |
55 |
$this->add(' |
56 |
<script language="JavaScript" type="text/javascript"> |
57 |
<!-- |
58 |
a = new Date(); |
59 |
a = a.getTime(); |
60 |
//--> |
61 |
</script> |
62 |
'); |
63 |
*/ |
64 |
|
65 |
$this->add($this->menuobject->toHTML()); |
66 |
|
67 |
/* |
68 |
// benchmarking - afterwards |
69 |
$this->add(' |
70 |
<script language="JavaScript" type="text/javascript"> |
71 |
<!-- |
72 |
b = new Date(); |
73 |
b = b.getTime(); |
74 |
|
75 |
document.write("Time to render tree: " + ((b - a) / 1000) + "s"); |
76 |
//--> |
77 |
</script> |
78 |
'); |
79 |
*/ |
80 |
|
81 |
} |
82 |
|
83 |
} |
84 |
|
85 |
?> |