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