1 |
<? |
2 |
/* |
3 |
## ----------------------------------------------------------------------------- |
4 |
## $Id: AbstractGUIModule.php,v 1.3 2003/04/04 00:56:08 jonen Exp $ |
5 |
## ----------------------------------------------------------------------------- |
6 |
## $Log: AbstractGUIModule.php,v $ |
7 |
## Revision 1.3 2003/04/04 00:56:08 jonen |
8 |
## + add 'mungle_adapter' function |
9 |
## |
10 |
## Revision 1.2 2003/03/20 07:56:18 jonen |
11 |
## + added docu |
12 |
## |
13 |
## Revision 1.1 2003/03/20 03:49:22 jonen |
14 |
## + initial commit |
15 |
## |
16 |
## Revision 1.1 2003/03/01 22:57:23 cvsmax |
17 |
## + inital commit |
18 |
## |
19 |
## |
20 |
## ----------------------------------------------------------------------------- |
21 |
*/ |
22 |
|
23 |
|
24 |
/** |
25 |
* required only for $this->_abstract_method({methodname}) |
26 |
* can later be used or not without any problems or further |
27 |
* dependencies since this is an abstract base class at the |
28 |
* very top of the inheritance hierarchy. |
29 |
* |
30 |
*/ |
31 |
loadModule('Class::Abstract'); |
32 |
|
33 |
/** |
34 |
* AbstractGUIModule class provides an simple way to create new modules |
35 |
* for the Explorer, eg navigation or data browsing elements. |
36 |
* |
37 |
* @author Sebastian Utz <seut@tunemedia.de> |
38 |
* @package org.netfrag.app |
39 |
* @name WebExplorer::Module::AbstractModule |
40 |
*/ |
41 |
class WebExplorer_Module_AbstractGUIModule extends Class_Abstract { |
42 |
|
43 |
|
44 |
/** |
45 |
* most modules needs arguments e.g. data_locator_key, caption etc. |
46 |
*/ |
47 |
var $_args = array(); |
48 |
|
49 |
/** |
50 |
* variable thats holds the reference to phphtmllib GUI object |
51 |
*/ |
52 |
var $_gui_object; |
53 |
|
54 |
/** |
55 |
* the contructor |
56 |
* |
57 |
* @params struct - the arguments |
58 |
*/ |
59 |
function WebExplorer_Module_AbstractGUIModule($args = array()) { |
60 |
$this->_args = $args; |
61 |
|
62 |
$this->set_gui_object(); |
63 |
//print Dumper($this->_gui_object); |
64 |
} |
65 |
|
66 |
|
67 |
function set_gui_object() { |
68 |
user_error("AbstractGUIModule::set_gui_object() - Child must override"); |
69 |
} |
70 |
|
71 |
|
72 |
function add_hidden_items($items) { |
73 |
foreach($items as $label => $value) { |
74 |
$this->add_hidden_item($label, $value); |
75 |
} |
76 |
} |
77 |
|
78 |
function add_hidden_item($label, $value) { |
79 |
//print "Label: $label => $value<br>"; |
80 |
$this->_gui_object->add_hidden_element($label, $value); |
81 |
} |
82 |
|
83 |
function &get() { |
84 |
if($this->_args['adapter']) { |
85 |
return $this->mungle_adapter($this->_args['adapter']); |
86 |
} else { |
87 |
return $this->_gui_object; |
88 |
} |
89 |
} |
90 |
|
91 |
function mungle_adapter($label) { |
92 |
return php::mkInstance($label, array(&$this->_gui_object)); |
93 |
} |
94 |
|
95 |
} |
96 |
|
97 |
?> |