1 |
joko |
1.1 |
<?php |
2 |
|
|
/** |
3 |
|
|
* This file contains the DataSource::Adapter::phpHtmlLib::DataListSource |
4 |
|
|
* adapter class that inherits from the DataListSource. |
5 |
|
|
* |
6 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
7 |
|
|
* @copyright (c) 2003 - All Rights reserved. |
8 |
|
|
* @license GNU LGPL (GNU Lesser General Public License) |
9 |
|
|
* |
10 |
|
|
* @author-url http://www.netfrag.org/~joko/ |
11 |
|
|
* @license-url http://www.gnu.org/licenses/lgpl.txt |
12 |
|
|
* |
13 |
|
|
* @package org.netfrag.glib |
14 |
|
|
* @module DataSource::Adapter::phpHtmlLib::DataListSource |
15 |
|
|
* |
16 |
|
|
*/ |
17 |
|
|
|
18 |
|
|
/** |
19 |
|
|
* $Id: MemoryDataSource.inc,v 1.3 2003/03/03 21:24:45 joko Exp $ |
20 |
|
|
* |
21 |
|
|
* $Log: MemoryDataSource.inc,v $ |
22 |
|
|
* |
23 |
|
|
*/ |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
class DataSource_Adapter_phpHtmlLib_DataListSource extends MemoryDataListSource { |
28 |
|
|
|
29 |
|
|
/** |
30 |
|
|
* The constructor. |
31 |
|
|
* |
32 |
|
|
* @param DesignPattern::Proxy - a Proxy instance |
33 |
|
|
* |
34 |
|
|
*/ |
35 |
|
|
function DataSource_Adapter_phpHtmlLib_DataListSource(&$proxy) { |
36 |
|
|
|
37 |
|
|
if (!isset($proxy)) { |
38 |
|
|
user_error("Please pass Proxy instance to the Adapter!"); |
39 |
|
|
return; |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
$this->_proxy = &$proxy; |
43 |
|
|
|
44 |
|
|
// tracing |
45 |
|
|
//$this->trace_payload('DataSource_Adapter_phpHtmlLib_DataListSource', $proxy); |
46 |
|
|
|
47 |
|
|
// transfer data to "memory" |
48 |
|
|
//$this->_memory = &$payload; |
49 |
|
|
|
50 |
|
|
//return 1; |
51 |
|
|
|
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
function fetch($force = 0) { |
55 |
|
|
$this->_result = $this->_proxy->get_result(); |
56 |
|
|
//print "size: " . sizeof($this->_result) . "<br/>"; |
57 |
|
|
if (!sizeof($this->_result) || $force) { |
58 |
|
|
$this->_result = $this->_proxy->query_data(); |
59 |
|
|
} |
60 |
|
|
$this->propagate(); |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
function propagate() { |
64 |
|
|
$this->handle_result(); |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
function get_header() { |
70 |
|
|
$this->fetch(); |
71 |
|
|
$this->read_labels_from_result(); |
72 |
|
|
return $this->get_labels(); |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
function do_prequery() { |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
function do_query() { |
79 |
|
|
$this->fetch(); |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
?> |