21 |
* $Id$ |
* $Id$ |
22 |
* |
* |
23 |
* $Log$ |
* $Log$ |
24 |
|
* Revision 1.8 2005/10/26 22:40:54 jonen |
25 |
|
* + fixed page-control is search-value passed, searching/filtering is already done at backend (Memory!) |
26 |
|
* FIXME: the method '_find_data_' caused a 0 result if try to search already filtered results, fix this! |
27 |
|
* |
28 |
|
* Revision 1.7 2004/10/07 14:16:39 jonen |
29 |
|
* + updates related to HACK at DataSource/Generic (page-control!) |
30 |
|
* |
31 |
|
* Revision 1.6 2004/05/06 17:11:55 jonen |
32 |
|
* bugfix related to new phphtmllib-v2.4.1 of Apr 01, 2004 |
33 |
|
* |
34 |
* Revision 1.5 2003/07/14 10:07:07 jonen |
* Revision 1.5 2003/07/14 10:07:07 jonen |
35 |
* clean up |
* clean up |
36 |
* |
* |
159 |
var $_errors = array(); |
var $_errors = array(); |
160 |
|
|
161 |
|
|
162 |
|
/** |
163 |
|
* This disable searching here. |
164 |
|
* Because lot of entries breaks memory if data is fetched remotely, |
165 |
|
* searching/filtering have to be done at backend. |
166 |
|
* Another search in already searched/filtered data return in 0 data. |
167 |
|
* This can be handled maybe by fixing the '_find_data' method! |
168 |
|
* |
169 |
|
*/ |
170 |
|
var $_enable_search = 0; |
171 |
|
|
172 |
|
|
173 |
/** |
/** |
174 |
* The constructor. |
* The constructor. |
182 |
$this->trace_payload('MemoryDataSource', $payload); |
$this->trace_payload('MemoryDataSource', $payload); |
183 |
|
|
184 |
// transfer data to "memory" |
// transfer data to "memory" |
185 |
$this->_memory = &$payload; |
$this->_memory = &$payload; |
186 |
|
|
187 |
} |
} |
188 |
|
|
189 |
function read_labels_from_result() { |
function read_labels_from_result() { |
190 |
$this->set_labels($this->_result[0]); |
// NEW 2004-10-07: read last entries labes instead of first, |
191 |
|
// because of a HACK at DataSource/Generic, first could be an empty one |
192 |
|
$count = count($this->_result); |
193 |
|
$this->set_labels($this->_result[$count-1]); |
194 |
$this->propagate_schema(); |
$this->propagate_schema(); |
195 |
} |
} |
196 |
|
|
234 |
|
|
235 |
function handle_result() { |
function handle_result() { |
236 |
$this->debug("handle_result", "HANDLE RESULT!<br>"); |
$this->debug("handle_result", "HANDLE RESULT!<br>"); |
237 |
$this->propagate_result(); |
return $this->propagate_result(); |
238 |
} |
} |
239 |
|
|
240 |
function propagate_result() { |
function propagate_result() { |
249 |
} |
} |
250 |
} |
} |
251 |
} |
} |
252 |
|
if ($count > 0) { |
253 |
$this->set_total_rows( $count ); |
$this->set_total_rows($count); |
254 |
$this->sort(); |
$this->sort(); |
255 |
|
return true; |
256 |
|
} else { |
257 |
|
return false; |
258 |
|
} |
259 |
} |
} |
260 |
|
|
261 |
/** |
/** |
272 |
$index = $this->get_data_index(); |
$index = $this->get_data_index(); |
273 |
$limit = $this->get_limit(); |
$limit = $this->get_limit(); |
274 |
$offset = $this->get_offset(); |
$offset = $this->get_offset(); |
275 |
|
|
276 |
if ($limit == -1) { |
if ($limit == -1) { |
277 |
//don't limit the data |
//don't limit the data |
278 |
if ($index > $this->get_total_rows()) { |
if ($index > $this->get_total_rows()) { |
282 |
} |
} |
283 |
} else { |
} else { |
284 |
$left_to_show = $limit - ($index - $offset); |
$left_to_show = $limit - ($index - $offset); |
285 |
if ($left_to_show > 0) { |
if ($left_to_show > 0 ) { |
286 |
return $this->_data[$index]; |
return $this->_data[$index]; |
287 |
} else { |
} else { |
288 |
return NULL; |
return NULL; |
358 |
|
|
359 |
//print "add_row!<br/>"; |
//print "add_row!<br/>"; |
360 |
|
|
361 |
if ($row != NULL) { |
// NEW 2004-10-07: ignore empty entries, |
362 |
if ($this->get_searchby_value()) { |
// because of a HACK at DataSource/Generic, there could be empty one's |
363 |
|
//if ($row != NULL) { |
364 |
|
if ($this->get_searchby_value() && $this->_enable_search) { |
365 |
//user wants to search the data |
//user wants to search the data |
366 |
if ($this->_find_data($row) ) { |
if ($this->_find_data($row) ) { |
367 |
$this->_data[] = $row; |
$this->_data[] = $row; |
373 |
$this->_data[] = $row; |
$this->_data[] = $row; |
374 |
return TRUE; |
return TRUE; |
375 |
} |
} |
376 |
} else { |
//} else { |
377 |
return FALSE; |
// return FALSE; |
378 |
} |
//} |
379 |
} |
} |
380 |
|
|
381 |
function sort() { |
function sort() { |