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