cvs: pear /Structures_DataGrid/DataGrid Core.php
| From: | Andrew Nagy | Date: | Wed, 18 Aug 2004 18:42:07 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid Core.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-23081@lists.php.net to get a copy of this message | ||
asnagy Wed Aug 18 14:42:07 2004 EDT
Modified files:
/pear/Structures_DataGrid/DataGrid Core.php
Log:
the datasource fetch method now handles sorting and limiting, no need for this in the
bindDataSource method
http://cvs.php.net/diff.php/pear/Structures_DataGrid/DataGrid/Core.php?r1=1.13&r2=1.14&ty=u
Index: pear/Structures_DataGrid/DataGrid/Core.php
diff -u pear/Structures_DataGrid/DataGrid/Core.php:1.13
pear/Structures_DataGrid/DataGrid/Core.php:1.14
--- pear/Structures_DataGrid/DataGrid/Core.php:1.13 Tue Aug 17 17:52:58 2004
+++ pear/Structures_DataGrid/DataGrid/Core.php Wed Aug 18 14:42:07 2004
@@ -16,7 +16,7 @@
// | Author: Andrew Nagy <asnagy@webitecture.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Core.php,v 1.13 2004/08/17 21:52:58 asnagy Exp $
+// $Id: Core.php,v 1.14 2004/08/18 18:42:07 asnagy Exp $
require_once 'Structures/DataGrid/Column.php';
require_once 'Structures/DataGrid/Record.php';
@@ -28,7 +28,7 @@
* It offers the paging and sorting methods as well as the record and column
* management methods.
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @access public
* @package Structures_DataGrid
@@ -165,24 +165,22 @@
* Allows binding to a data source driver.
*
* @access public
- * @param mixed $dataSource The data source driver object
- * @return mixed True if successful, otherwise PEAR_Error
+ * @param mixed $source The data source driver object
+ * @return mixed True if successful, otherwise PEAR_Error
*/
- function bindDataSource(&$dataSource)
+ function bindDataSource(&$source)
{
if (is_subclass_of($source, 'structures_datagrid_datasource')) {
- $this->_dataSource =& $driver;
- $driver->limit($this->page, $this->rowLimit);
- if ($this->sortArray != null) {
- $driver->sort($this->sortArray);
- }
- $data = $driver->fetch();
- if (PEAR::isError($data)) {
+ $this->_dataSource =& $source;
+ $recordSet = $source->fetch(($this->page*$this->rowLimit),
+ $this->rowLimit, $this->sortArray[0],
+ this->sortArray[1]);
+ if (PEAR::isError($recordSet)) {
return $data;
} else {
- $this->recordSet = $data['Records'];
- if (isset($data['Columns'])) {
- $this->columnSet = $data['Columns'];
+ $this->recordSet = $recordSet;
+ if ($columnSet = $source->getColumns()) {
+ $this->columnSet = $columnSet;
}
}
} else {