1 |
<?php |
<?php |
2 |
/** |
/** |
3 |
* This file contains the GenericDataSource child class |
* This file contains the GenericDataSource child class |
|
* that may use arbitrary code modules as database handlers. |
|
|
* It's aims are to get together: |
|
|
* o phpHtmlLibs "source-handlers" |
|
|
* o PEAR's database handlers |
|
|
* o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server) |
|
4 |
* |
* |
5 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
* @package phpHtmlLib |
* @package org.netfrag.glib |
7 |
* @module GenericDataSource |
* @name DataSource::Generic |
8 |
* |
* |
9 |
*/ |
*/ |
10 |
|
|
11 |
/** |
/** |
12 |
|
* <b>Cvs-Log:</b> |
13 |
|
* |
14 |
|
* <pre> |
15 |
* $Id$ |
* $Id$ |
16 |
* |
* |
17 |
* $Log$ |
* $Log$ |
18 |
|
* Revision 1.14 2003/04/04 21:19:21 joko |
19 |
|
* modified exception handling (enhanced, purged redundant code) |
20 |
|
* |
21 |
|
* Revision 1.13 2003/04/04 02:37:14 jonen |
22 |
|
* _query[action] == write |
23 |
|
* |
24 |
|
* Revision 1.12 2003/03/29 08:00:48 joko |
25 |
|
* modified ErrorBoxing |
26 |
|
* |
27 |
|
* Revision 1.11 2003/03/28 06:45:26 joko |
28 |
|
* VERBOSE mode |
29 |
|
* |
30 |
|
* Revision 1.10 2003/03/28 03:01:02 joko |
31 |
|
* more fancy debugging-output |
32 |
|
* |
33 |
|
* Revision 1.9 2003/03/27 16:24:26 jonen |
34 |
|
* + mugled namespace |
35 |
|
* + added enhanced 'queryData' |
36 |
|
* |
37 |
|
* Revision 1.8 2003/03/20 07:22:14 jonen |
38 |
|
* + modified case 'object' to 'objects' |
39 |
|
* (cause its loads all *objects* of a given classname) |
40 |
|
* |
41 |
|
* Revision 1.7 2003/03/11 01:43:00 joko |
42 |
|
* + fixed metadata for phpDocumentor |
43 |
|
* |
44 |
|
* Revision 1.6 2003/03/11 01:22:25 joko |
45 |
|
* + fixed metadata for phpDocumentor |
46 |
|
* |
47 |
|
* Revision 1.5 2003/03/11 00:12:49 joko |
48 |
|
* + fixed metadata for phpDocumentor |
49 |
|
* |
50 |
|
* Revision 1.4 2003/03/10 23:25:03 joko |
51 |
|
* + fixed metadata for phpDocumentor |
52 |
|
* |
53 |
|
* Revision 1.3 2003/03/09 15:50:36 joko |
54 |
|
* + additional metadata for Autodia |
55 |
|
* |
56 |
|
* Revision 1.2 2003/03/05 17:28:43 joko |
57 |
|
* updated docu (phpDocumentor testing....) |
58 |
|
* |
59 |
* Revision 1.1 2003/03/05 12:04:00 joko |
* Revision 1.1 2003/03/05 12:04:00 joko |
60 |
* + initial commit, from GenericDataSource |
* + initial commit, from GenericDataSource |
61 |
* |
* |
82 |
* |
* |
83 |
* Revision 1.1 2003/03/01 03:10:40 joko |
* Revision 1.1 2003/03/01 03:10:40 joko |
84 |
* + initial commit |
* + initial commit |
85 |
* |
* </pre> |
86 |
* |
* |
87 |
*/ |
*/ |
88 |
|
|
110 |
// require_once("PEAR.php"); // FIXME: what about PEAR::XML::RPC? |
// require_once("PEAR.php"); // FIXME: what about PEAR::XML::RPC? |
111 |
// require_once("DB.php"); |
// require_once("DB.php"); |
112 |
|
|
113 |
|
|
114 |
|
loadModule('DesignPattern::Proxy'); |
115 |
|
loadModule('DesignPattern::TransparentProxy'); |
116 |
|
loadModule('DesignPattern::RemoteProxy'); |
117 |
|
|
118 |
|
//class GenericDataSource extends MemoryDataSource { |
119 |
|
//class GenericDataSource extends DesignPattern_Proxy { |
120 |
|
//class GenericDataSource extends DesignPattern_RemoteProxy { |
121 |
|
//class GenericDataSource extends DesignPattern_TransparentProxy { |
122 |
|
|
123 |
|
//class GenericDataSource extends MemoryDataSource { |
124 |
|
//loadModule("DataSource::Proxy::Memory"); |
125 |
|
//class GenericDataSource extends DataSource_Proxy_Memory { |
126 |
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
127 |
|
//class DataSource_GenericDataSource extends DesignPattern_Proxy { |
128 |
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
129 |
|
|
130 |
|
// now independent!!! new class-inheritance-tree possible now! |
131 |
|
// solved by having an Adapter *and* a Proxy here! |
132 |
|
//class GenericDataSource { |
133 |
|
|
134 |
|
loadModule('DesignPattern::AdapterProxy'); |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
/** |
/** |
139 |
* This GenericDataSource child class is *completely* independent |
* This GenericDataSource child class is *completely* independent |
140 |
* of a specific storage implementation and intended to be a wrapper |
* of a specific storage implementation and intended to be a wrapper |
141 |
* class on the way from phpHtmlLib to Xyz. |
* class on the way from phpHtmlLib to Xyz. <br> |
142 |
* ("Yyz" gets represented by Data::Storage by now.....) |
* ("Yyz" gets represented by Data::Storage by now.....) |
143 |
* |
* |
144 |
* GenericDataSource interacts with an intermediate "proxy" object |
* GenericDataSource interacts with an intermediate "proxy" object |
145 |
* (e.g. Data::Driver::Proxy) when doing queries. |
* (e.g. Data::Driver::Proxy) when doing queries. <br> |
146 |
|
* <pre> |
147 |
* Don't mix this up with a persistent database handle which gets |
* Don't mix this up with a persistent database handle which gets |
148 |
* reused each and every time for different queries. |
* reused each and every time for different queries. |
149 |
* Here *is* a new instance of Data::Driver::Proxy for *each* query. |
* Here *is* a new instance of Data::Driver::Proxy for *each* query. |
150 |
|
* </pre> |
151 |
* |
* |
152 |
* But the point is: Caching! The actual *data* isn't read redundant! |
* But the point is: Caching! The actual *data* isn't read redundant! |
153 |
* |
* |
154 |
|
* <pre> |
155 |
|
* --- snipped into here from above --- |
156 |
|
* that may use arbitrary code modules as database handlers. |
157 |
|
* It's aims are to get together: |
158 |
|
* o phpHtmlLibs "source-handlers" |
159 |
|
* o PEAR's database handlers |
160 |
|
* o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server) |
161 |
|
* --- snipped into here from above --- |
162 |
|
* </pre> |
163 |
* |
* |
164 |
|
* <p> |
165 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
166 |
* |
* |
167 |
* Data::Driver::Proxy instantiates "handlers" below itself |
* Data::Driver::Proxy instantiates "handlers" below itself |
171 |
* One worker already implemented is Data::Driver::RPC::Remote, which |
* One worker already implemented is Data::Driver::RPC::Remote, which |
172 |
* talks to a RPC::XML server (todo: talk SOAP!) using PEAR::XML::RPC. |
* talks to a RPC::XML server (todo: talk SOAP!) using PEAR::XML::RPC. |
173 |
* |
* |
174 |
|
* <pre> |
175 |
* --- refactored here, but: redundant somehow --- |
* --- refactored here, but: redundant somehow --- |
176 |
* Data::Driver::Proxy uses a PEAR XML::RPC object to actually |
* Data::Driver::Proxy uses a PEAR XML::RPC object to actually |
177 |
* talk HTTP and serialize data chunks to and from XML, |
* talk HTTP and serialize data chunks to and from XML, |
179 |
* It "proxies" arbitrary data chunks a) inside a native php4 session, |
* It "proxies" arbitrary data chunks a) inside a native php4 session, |
180 |
* b) by talking to a rdbms (single proxy-table) or c) [TODO] using PEAR::Cache. |
* b) by talking to a rdbms (single proxy-table) or c) [TODO] using PEAR::Cache. |
181 |
* --- refactored here, but: redundant somehow --- |
* --- refactored here, but: redundant somehow --- |
182 |
|
* </pre> |
183 |
* |
* |
184 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
185 |
|
* </p> |
186 |
* |
* |
187 |
* |
* |
188 |
* How to use? |
* <p> |
189 |
|
* <b>How to use?</b> |
190 |
* |
* |
191 |
* Pass an array holding "locator metadata" to the constructor. |
* Pass an array holding "locator metadata" to the constructor. |
192 |
* GenericDataSource takes care of the rest. |
* GenericDataSource takes care of the rest. |
193 |
* |
* |
194 |
|
* <pre> |
195 |
* Pass an array to the constructor: (e.g.) |
* Pass an array to the constructor: (e.g.) |
196 |
* |
* |
197 |
* 1. doing rpc-calls.... |
* 1. doing rpc-calls.... |
198 |
|
* <code> |
199 |
* $locator = array( |
* $locator = array( |
200 |
* type => 'rpc', |
* type => 'rpc', |
201 |
* metadata => array( Host => 'localhost', Port => '8765' ), |
* metadata => array( Host => 'localhost', Port => '8765' ), |
202 |
* ); |
* ); |
203 |
* $source = new GenericDataSource($locator); |
* $source = ne w GenericDataSource($locator); |
204 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
205 |
|
* </code> |
206 |
* |
* |
207 |
* 2. [proposal] common datahandles.... |
* 2. [proposal] common datahandles.... |
208 |
|
* <code> |
209 |
* $locator = array( |
* $locator = array( |
210 |
* type => 'mysql', |
* type => 'mysql', |
211 |
* dsn => 'known dsn markup', |
* dsn => 'known dsn markup', |
212 |
* ); |
* ); |
213 |
* $source = new GenericDataSource($locator); |
* $source = ne w GenericDataSource($locator); |
214 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
215 |
|
* </code> |
216 |
|
* </pre> |
217 |
|
* </p> |
218 |
|
* |
219 |
* |
* |
220 |
|
* @link http://www.netfrag.org/~joko/ |
221 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
222 |
|
* |
223 |
|
* @link http://www.netfrag.org/~jonen/ |
224 |
* @author Sebastian Utz <seut@tunemedia.de> |
* @author Sebastian Utz <seut@tunemedia.de> |
225 |
|
* |
226 |
* @copyright (c) 2003 - All Rights reserved. |
* @copyright (c) 2003 - All Rights reserved. |
227 |
|
* |
228 |
|
* @link http://www.gnu.org/licenses/lgpl.txt |
229 |
* @license GNU LGPL (GNU Lesser General Public License) |
* @license GNU LGPL (GNU Lesser General Public License) |
230 |
* |
* |
|
* @author-url http://www.netfrag.org/~joko/ |
|
|
* @author-url http://www.netfrag.org/~jonen/ |
|
|
* @license-url http://www.gnu.org/licenses/lgpl.txt |
|
231 |
* |
* |
232 |
* @package phpHtmlLib |
* @package org.netfrag.glib |
233 |
* @module GenericDataSource |
* @subpackage DataSource |
234 |
|
* @name DataSource::Generic |
235 |
|
* |
236 |
|
* @todo this: |
237 |
|
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
238 |
|
* o implement another Data::Driver::Proxy container |
239 |
|
* |
240 |
|
* <pre> |
241 |
|
* !!!!!!!! THIS IS THE PROBLEM !!!!!!!! |
242 |
|
* !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
243 |
|
* |
244 |
|
* THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy |
245 |
|
* inheritance trees at the same time, which is *not* possible at |
246 |
|
* declare-time. We *do* need some runtime-infrastructure to solve this! |
247 |
|
* |
248 |
|
* TODO: move build- and check-locator stuff from ObjectList to this place!!! |
249 |
|
* |
250 |
|
* ABOUT: |
251 |
|
* 1. otherwhere: WebApp - scope: |
252 |
|
* x handles page vs. block vs. widget; dispatches MVC-View |
253 |
|
* 2. here: DataSource - scope: |
254 |
|
* x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.)) |
255 |
|
* o clean implementation using a DesignPattern::AdapterProxy |
256 |
|
* </pre> |
257 |
* |
* |
|
*/ |
|
|
|
|
|
/** |
|
|
* Todo: |
|
|
* |
|
|
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
|
|
* o implement another Data::Driver::Proxy container |
|
258 |
* |
* |
259 |
*/ |
*/ |
|
|
|
|
|
|
|
// !!!!!!!! THIS IS THE PROBLEM !!!!!!!! |
|
|
// !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
|
|
// |
|
|
// THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy |
|
|
// inheritance trees at the same time, which is *not* possible at |
|
|
// declare-time. We *do* need some runtime-infrastructure to solve this! |
|
|
// |
|
|
// TODO: move build- and check-locator stuff from ObjectList to this place!!! |
|
|
// |
|
|
// ABOUT: |
|
|
// 1. otherwhere: WebApp - scope: |
|
|
// x handles page vs. block vs. widget; dispatches MVC-View |
|
|
// 2. here: DataSource - scope: |
|
|
// x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.)) |
|
|
// o clean implementation using a DesignPattern::AdapterProxy |
|
|
// |
|
|
|
|
|
loadModule('DesignPattern::Proxy'); |
|
|
loadModule('DesignPattern::TransparentProxy'); |
|
|
loadModule('DesignPattern::RemoteProxy'); |
|
|
|
|
|
//class GenericDataSource extends MemoryDataSource { |
|
|
//class GenericDataSource extends DesignPattern_Proxy { |
|
|
//class GenericDataSource extends DesignPattern_RemoteProxy { |
|
|
//class GenericDataSource extends DesignPattern_TransparentProxy { |
|
|
|
|
|
//class GenericDataSource extends MemoryDataSource { |
|
|
//loadModule("DataSource::Proxy::Memory"); |
|
|
//class GenericDataSource extends DataSource_Proxy_Memory { |
|
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
|
|
//class DataSource_GenericDataSource extends DesignPattern_Proxy { |
|
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
|
|
|
|
|
// now independent!!! new class-inheritance-tree possible now! |
|
|
// solved by having an Adapter *and* a Proxy here! |
|
|
//class GenericDataSource { |
|
|
|
|
|
loadModule('DesignPattern::AdapterProxy'); |
|
260 |
class DataSource_Generic extends DesignPattern_AdapterProxy { |
class DataSource_Generic extends DesignPattern_AdapterProxy { |
261 |
|
|
262 |
// !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
// !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
372 |
//$this->_locator->_datasource_type = $query[datasource]; |
//$this->_locator->_datasource_type = $query[datasource]; |
373 |
//$locator[_datasource_type] = $query[datasource]; |
//$locator[_datasource_type] = $query[datasource]; |
374 |
|
|
375 |
|
/** |
376 |
|
* <!-- Autodia --> |
377 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
378 |
|
* $this->_locator = new DataSource_Locator() |
379 |
|
* |
380 |
|
*/ |
381 |
|
|
382 |
// build master locator |
// build master locator |
383 |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) ); |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) ); |
384 |
//exit; |
//exit; |
425 |
//exit; |
//exit; |
426 |
|
|
427 |
|
|
428 |
|
/** |
429 |
|
* <!-- Autodia --> |
430 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
431 |
|
* $proxy = new DesignPattern_RemoteProxy() |
432 |
|
* |
433 |
|
*/ |
434 |
|
|
435 |
|
|
436 |
// --- Proxy selector/dispatcher ... |
// --- Proxy selector/dispatcher ... |
437 |
|
|
438 |
switch ($this->_locator->_datasource_type) { |
switch ($this->_locator->_datasource_type) { |
481 |
case 'phpHtmlLib': |
case 'phpHtmlLib': |
482 |
//$adapter_arguments = $args[title]; |
//$adapter_arguments = $args[title]; |
483 |
|
|
484 |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataListSource'); |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
485 |
|
|
486 |
// in order to let the Adapter communicate with the Proxy, |
// in order to let the Adapter communicate with the Proxy, |
487 |
// instantiate a wrapper method in a third namespace via |
// instantiate a wrapper method in a third namespace via |
528 |
// $this->create_handler(); |
// $this->create_handler(); |
529 |
|
|
530 |
|
|
531 |
|
/** |
532 |
|
* <!-- Autodia --> |
533 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
534 |
|
* $adapter = new DataSource_Adapter_phpHtmlLib_DataListSource() |
535 |
|
* |
536 |
|
*/ |
537 |
|
|
538 |
// V1: |
// V1: |
539 |
//$this->create_adapter($adapter_module, $this->function, $this->arguments); |
//$this->create_adapter($adapter_module, $this->function, $this->arguments); |
540 |
|
|
686 |
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
687 |
switch ($this->_query[metatype]) { |
switch ($this->_query[metatype]) { |
688 |
case 'data': |
case 'data': |
689 |
//$command = 'queryData'; |
$command = 'queryData'; |
690 |
$command = 'getObjects'; // FIXME!!! |
|
691 |
|
//$command = 'getObjects'; // FIXME!!! |
692 |
//$this->_locator->set_option('metadata.command', $command); |
//$this->_locator->set_option('metadata.command', $command); |
693 |
|
/* |
694 |
$args = array(); |
$args = array(); |
695 |
switch ($this->_query[vartype]) { |
switch ($this->_query[vartype]) { |
696 |
case 'object': |
case 'objects': |
697 |
if (!$this->_query[classname]) { |
if (!$this->_query[classname]) { |
698 |
$msg = "_query[vartype] == 'object' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
699 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
700 |
} |
} |
701 |
array_push($args, $this->_query[classname]); |
array_push($args, $this->_query[classname]); |
702 |
break; |
break; |
703 |
} |
} |
704 |
break; |
*/ |
705 |
|
$query_args = array(); |
706 |
|
switch ($this->_query[abstract_type]) { |
707 |
|
case 'list': |
708 |
|
if (!$this->_query[classname]) { |
709 |
|
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
710 |
|
user_error("GenericDataSource::query_data() - failed: " . $msg); |
711 |
|
} |
712 |
|
//array_push($query_args, $this->_query[classname]); |
713 |
|
$query_args[classname] = $this->_query[classname]; |
714 |
|
break; |
715 |
|
case 'item': |
716 |
|
if (!$this->_query[classname]) { |
717 |
|
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
718 |
|
user_error("GenericDataSource::query_data() - failed: " . $msg); |
719 |
|
} |
720 |
|
$query_args[guid] = $this->_query[ident]; |
721 |
|
$query_args[classname] = $this->_query[classname]; |
722 |
|
break; |
723 |
|
} |
724 |
|
if($this->_query[action] == 'write') { |
725 |
|
$query_args[action] = $this->_query[action]; |
726 |
|
$query_args[data] = $this->_query[data]; |
727 |
|
} |
728 |
|
$args = array( |
729 |
|
'data_type' => $this->_query[abstract_type], |
730 |
|
'query_args' => $query_args |
731 |
|
); |
732 |
|
break; |
733 |
|
|
734 |
|
// querySchema |
735 |
case 'schema': |
case 'schema': |
736 |
|
//print "Testing schema:" . "<br>"; |
737 |
$command = 'querySchema'; |
$command = 'querySchema'; |
738 |
|
$args = array( $this->_query[filter] ); |
739 |
break; |
break; |
740 |
} |
} |
741 |
|
|
771 |
|
|
772 |
} |
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
function &fetch_result() { |
function &fetch_result() { |
777 |
|
|
778 |
$this->datasource_handler_buildoptions(); |
$this->datasource_handler_buildoptions(); |
779 |
|
|
780 |
$method = $this->_locator->_call[_method]; |
$call = $this->_locator->get_call(); |
781 |
$args = $this->_locator->_call[_arguments]; |
//print Dumper($call); |
782 |
|
|
783 |
// pre-flight checks |
// pre-flight checks |
784 |
if (!$method) { |
if (!$call[method]) { |
785 |
$msg = "Remote command could not be resolved, please pass in or check configuration."; |
$msg = "Remote method is empty, please pass in proper metadata or check configuration."; |
786 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
787 |
return; |
return; |
788 |
} |
} |
791 |
|
|
792 |
// do remote call here and get result |
// do remote call here and get result |
793 |
// FIXME: handle synchronous/asynchronous mode here!!! |
// FIXME: handle synchronous/asynchronous mode here!!! |
794 |
$this->datasource_handler_call($method, $args); |
$this->datasource_handler_call($call[method], $call[args]); |
795 |
|
|
796 |
|
|
797 |
// TODO: ... = $this->poll_handler_result and $this->get_handler_result |
// TODO: ... = $this->poll_handler_result and $this->get_handler_result |
802 |
$this->_result_count = sizeof($this->_result); |
$this->_result_count = sizeof($this->_result); |
803 |
|
|
804 |
// trace |
// trace |
805 |
if ($this->_debug[notice]) { |
//if (constants::get('VERBOSE') && $this->_debug[notice]) { |
806 |
|
if (constants::get('VERBOSE') or constants::get('ERRORS_ONLY')) { |
807 |
//print "_result = " . Dumper($this->_result); |
//print "_result = " . Dumper($this->_result); |
808 |
print "DataSource::Generic->_result_count = " . $this->_result_count . "<br/>"; |
//print "<div><b><font color=\"darkgreen\">Debug:</font></b> DataSource::Generic->_result_count = <b>" . $this->_result_count . "</b></div>"; |
809 |
|
$this->draw_status_box(); |
810 |
} |
} |
811 |
|
|
812 |
return $this->_result; |
return $this->_result; |
813 |
|
|
814 |
} |
} |
815 |
|
|
816 |
|
function draw_status_box() { |
817 |
|
|
818 |
|
static $boxcount; |
819 |
|
|
820 |
|
$boxcount++; |
821 |
|
|
822 |
|
$box = container(); |
823 |
|
|
824 |
|
// box style |
825 |
|
$style = container( |
826 |
|
html_style("text/css", '.boxlabel_darkgreen { color: darkgreen; font-weight:bold; }'), |
827 |
|
html_style("text/css", '.box_dsg { background: #20ab39; color: white; border: 2px black groove; width:640px; padding:10px; margin:40px; }') |
828 |
|
); |
829 |
|
$box->add( $style ); |
830 |
|
|
831 |
|
// box content |
832 |
|
$statusbox = html_div('box_dsg'); |
833 |
|
$statusbox->add( html_b("DataSource::Generic"), html_br() ); |
834 |
|
$locatorbox = html_div('box_dsg'); |
835 |
|
$locatorbox->set_id("locatorbox_$boxcount"); |
836 |
|
$locatorbox->add( Dumper($this->_locator) ); |
837 |
|
|
838 |
|
// FIXME: ie/mozilla? |
839 |
|
//$locatorbox->set_style('visibility:false;'); |
840 |
|
$locatorbox->set_style('display:none;'); |
841 |
|
|
842 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), jsAnchor( 'toggle_vis', array("locatorbox_$boxcount"), '[show]'), $locatorbox, html_br() ); |
843 |
|
$call = $this->_locator->get_call(); |
844 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() ); |
845 |
|
if (sizeof($call[args])) { |
846 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Arguments:"), Dumper($call[args]), html_br() ); |
847 |
|
} |
848 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Count:"), $this->get_result_count(), html_br() ); |
849 |
|
$box->add( $statusbox ); |
850 |
|
|
851 |
|
//print $box->render(); |
852 |
|
trace( $box ); |
853 |
|
|
854 |
|
} |
855 |
|
|
856 |
|
|
857 |
function &query_data() { |
function &query_data() { |
858 |
//print "query!<br/>"; |
//print "query!<br/>"; |
868 |
function &get_result() { |
function &get_result() { |
869 |
return $this->_result; |
return $this->_result; |
870 |
} |
} |
871 |
|
|
872 |
|
function get_result_count() { |
873 |
|
return $this->_result_count; |
874 |
|
} |
875 |
|
|
876 |
} |
} |
877 |
|
|