| 12 |
// $Id$ |
// $Id$ |
| 13 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
| 14 |
// $Log$ |
// $Log$ |
| 15 |
|
// Revision 1.7 2003/04/18 15:48:00 joko |
| 16 |
|
// better error handling: a) croak messages, b) just perform lift module if instance could be created |
| 17 |
|
// |
| 18 |
|
// Revision 1.6 2003/03/09 15:49:20 joko |
| 19 |
|
// fix towards optimizing autodocumentation: |
| 20 |
|
// enriched with metadata to tell autodia how to build object-relationships by discarding the fancy namespacing stuff there |
| 21 |
|
// |
| 22 |
|
// Revision 1.5 2003/03/08 20:04:59 root |
| 23 |
|
// + optimized comments for Autodia |
| 24 |
|
// |
| 25 |
// Revision 1.4 2003/03/08 18:22:23 joko |
// Revision 1.4 2003/03/08 18:22:23 joko |
| 26 |
// updated comments: now in phpDocumentor style |
// updated comments: now in phpDocumentor style |
| 27 |
// |
// |
| 69 |
* @link http://www.gnu.org/licenses/lgpl.txt |
* @link http://www.gnu.org/licenses/lgpl.txt |
| 70 |
* |
* |
| 71 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
| 72 |
* @subpackage Data::Lift |
* @subpackage DataLift |
| 73 |
* @name Data::Lift |
* @name Data::Lift |
| 74 |
* |
* |
| 75 |
* @link http://cvs.netfrag.org/php/libs/org.netfrag.glib |
* @link http://cvs.netfrag.org/php/libs/org.netfrag.glib |
| 79 |
* @todo refactor Data::Encode to a plugin module |
* @todo refactor Data::Encode to a plugin module |
| 80 |
* @todo combine Data::Lift and Data::Container somehow |
* @todo combine Data::Lift and Data::Container somehow |
| 81 |
* @todo integrate with Data::Driver somehow -- proposal: |
* @todo integrate with Data::Driver somehow -- proposal: |
| 82 |
* $lift = new Data::Lift($locator); |
* // $lift = ne w Data::Lift($locator); |
| 83 |
* $lift->perform(); // talks to a Data::Driver |
* // $lift->perform(); // talks to a Data::Driver |
| 84 |
* |
* |
|
* can do: |
|
|
* new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu |
|
|
* new Data_Lift_hash_job_html |
|
| 85 |
* |
* |
| 86 |
*/ |
*/ |
| 87 |
class Data_Lift { |
class Data_Lift { |
| 88 |
|
|
| 89 |
|
/** |
| 90 |
|
* this is to trick Autodia let understanding "namespaces" in php |
| 91 |
|
* unless the pattern can be tweaked by mode (namespace=0|1) |
| 92 |
|
* // $this = ne w Data::Lift(&$payload, $options = array()); |
| 93 |
|
*/ |
| 94 |
|
|
| 95 |
var $dblocations; |
var $dblocations; |
| 96 |
var $actor; |
var $actor; |
| 97 |
|
var $actor_instance; |
| 98 |
|
|
| 99 |
var $payload; |
var $payload; |
| 100 |
var $vartype; |
var $vartype; |
| 149 |
//print "metatype: " . $this->metatype . "<br>"; |
//print "metatype: " . $this->metatype . "<br>"; |
| 150 |
|
|
| 151 |
if (!$good) { |
if (!$good) { |
| 152 |
print "Data::Lift cannot handle this payload: "; |
$msg = "Data::Lift cannot handle this payload: "; |
| 153 |
print "(vartype=" . $this->vartype . ", metatype=" . $this->metatype . ")<br/>"; |
$msg .= "[vartype=" . $this->vartype . ", metatype=" . $this->metatype . "]<br/>"; |
| 154 |
print Dumper($this->payload); |
$msg .= "payload: '" . Dumper($this->payload) . "'"; |
| 155 |
|
user_error($msg); |
| 156 |
} |
} |
| 157 |
|
|
| 158 |
} |
} |
| 185 |
function &_perform_actor() { |
function &_perform_actor() { |
| 186 |
//$actor_file = join('/', $this->actor) . '.php'; |
//$actor_file = join('/', $this->actor) . '.php'; |
| 187 |
//include($actor_file); |
//include($actor_file); |
| 188 |
|
|
| 189 |
|
/** |
| 190 |
|
* <!-- Autodia --> |
| 191 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
| 192 |
|
* $this->_actor_instance = new Data_Lift_hash_job_html() |
| 193 |
|
* $this->_actor_instance = new Data_Lift_hash_tree_PEAR_Tree() |
| 194 |
|
* $this->_actor_instance = new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu() |
| 195 |
|
* $this->_actor_instance = new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu_DHTML() |
| 196 |
|
* $this->_actor_instance = new Data_Lift_object_tree_common_PEAR_HTML_TreeMenu_Listbox() |
| 197 |
|
* |
| 198 |
|
*/ |
| 199 |
|
|
| 200 |
$actor_name = 'Data/Lift/' . join('/', $this->actor); |
$actor_name = 'Data/Lift/' . join('/', $this->actor); |
| 201 |
|
//$actor_name = 'Data::Lift::' . join('::', $this->actor); |
| 202 |
|
|
| 203 |
|
//$actor_object = mkObject($actor_name); |
| 204 |
|
//return $actor_object->perform($this->payload); |
| 205 |
|
|
| 206 |
|
// fix [2003-04-13]: just perform if instance good |
| 207 |
|
//if ($actor_object = php::mkComponent($actor_name)) { |
| 208 |
$actor_object = mkObject($actor_name); |
$actor_object = mkObject($actor_name); |
| 209 |
return $actor_object->perform($this->payload); |
if (is_object($actor_object) && method_exists($actor_object, 'perform')) { |
| 210 |
|
return $actor_object->perform($this->payload); |
| 211 |
|
} else { |
| 212 |
|
user_error("Data::Lift could not call method 'perform' on actor object. [actor_name='$actor_name']"); |
| 213 |
|
//return array(); |
| 214 |
|
} |
| 215 |
|
|
| 216 |
} |
} |
| 217 |
|
|
| 218 |
function get() { |
function get() { |
| 225 |
|
|
| 226 |
} |
} |
| 227 |
|
|
|
?> |
|
| 228 |
|
?> |