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