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