cvs: pear /Structures_DataGrid DataGrid.php
| From: | Olivier Guilyardi | Date: | Mon, 27 Feb 2006 21:06:20 +0000 |
| Subject: | cvs: pear /Structures_DataGrid DataGrid.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38709@lists.php.net to get a copy of this message | ||
olivierg Mon Feb 27 21:06:20 2006 UTC
Modified files:
/pear/Structures_DataGrid DataGrid.php
Log:
The constructor 3rd argument is working again
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid.php?r1=1.39&r2=1.40&diff_format=u
Index: pear/Structures_DataGrid/DataGrid.php
diff -u pear/Structures_DataGrid/DataGrid.php:1.39 pear/Structures_DataGrid/DataGrid.php:1.40
--- pear/Structures_DataGrid/DataGrid.php:1.39 Fri Feb 24 13:40:28 2006
+++ pear/Structures_DataGrid/DataGrid.php Mon Feb 27 21:06:20 2006
@@ -18,7 +18,7 @@
// | Mark Wiesemann <wiesemann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: DataGrid.php,v 1.39 2006/02/24 13:40:28 wiesemann Exp $
+// $Id: DataGrid.php,v 1.40 2006/02/27 21:06:20 olivierg Exp $
require_once 'PEAR.php';
@@ -72,7 +72,7 @@
* ?>
* </code>
*
- * @version $Revision: 1.39 $
+ * @version $Revision: 1.40 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
@@ -161,7 +161,7 @@
* @access public
*/
function Structures_DataGrid($limit = null, $page = null,
- $rendererType = DATAGRID_RENDER_TABLE)
+ $rendererType = null)
{
// Set the defined rowlimit
$this->rowLimit = $limit;
@@ -177,6 +177,10 @@
// Automatic handling of GET/POST/COOKIE variables
$this->_parseHttpRequest();
+
+ if (!is_null ($rendererType)) {
+ $this->setRenderer($rendererType);
+ }
}
/**
@@ -443,8 +447,14 @@
}
}
- if (PEAR::isError($test = $this->setRenderer($type, $options))) {
- return $test;
+ /* Is a renderer driver already loaded and does it exactly match
+ * the driver class name that corresponds to $type ? */
+ if (!isset ($this->_renderer)
+ or !is_a($this->_renderer, "Structures_DataGrid_Renderer_$type")) {
+ /* No, then load the right driver */
+ if (PEAR::isError($test = $this->setRenderer($type, $options))) {
+ return $test;
+ }
}
$this->_renderer->setContainer($container);