cvs: pear /Structures_DataGrid/DataGrid/Renderer Common.php HTMLTable.php XUL.php
| From: | Olivier Guilyardi | Date: | Thu, 02 Mar 2006 00:42:16 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid/Renderer Common.php HTMLTable.php XUL.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38822@lists.php.net to get a copy of this message | ||
olivierg Thu Mar 2 00:42:16 2006 UTC
Modified files:
/pear/Structures_DataGrid/DataGrid/Renderer Common.php
HTMLTable.php XUL.php
Log:
Simplified the array structure
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Common.php?r1=1.18&r2=1.19&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/Common.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/Common.php:1.18
pear/Structures_DataGrid/DataGrid/Renderer/Common.php:1.19
--- pear/Structures_DataGrid/DataGrid/Renderer/Common.php:1.18 Wed Mar 1 15:16:08 2006
+++ pear/Structures_DataGrid/DataGrid/Renderer/Common.php Thu Mar 2 00:42:16 2006
@@ -17,7 +17,7 @@
// | Olivier Guilyardi <olivier@samalyse.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.18 2006/03/01 15:16:08 olivierg Exp $
+// $Id: Common.php,v 1.19 2006/03/02 00:42:16 olivierg Exp $
/**
* Structures_DataGrid_Renderer_Common Class
@@ -56,7 +56,7 @@
* added
*
*
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.19 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @access public
* @package Structures_DataGrid
@@ -88,14 +88,7 @@
/**
* Fields/directions the data is currently sorted by
*
- * This is an array of the form :
- * array (
- * 0 => array ('field' => 'field1', 'direction' =>
'ASC'),
- * 1 => array ('field' => 'field2', 'direction' =>
'DESC'),
- * etc...
- * );
- *
- * @var array
+ * @var array Form: array (fieldName => direction, ....)
* @access protected
*/
var $_currentSort = array();
@@ -268,13 +261,8 @@
/**
* Specify how the datagrid is currently sorted
*
- * @param string $spec Which fields/directions it is sorted by
- * This is an array of the form :
- * array (
- * 0 => array ('field' => 'field1',
'direction' => 'ASC'),
- * 1 => array ('field' => 'field2',
'direction' => 'DESC'),
- * etc...
- * );
+ * @var array
+ * @param array $spec Form: array (fieldName => direction, ....)
* @access public
*/
function setCurrentSorting($spec)
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php?r1=1.85&r2=1.86&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.85
pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.86
--- pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.85 Wed Mar 1 22:42:35 2006
+++ pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php Thu Mar 2 00:42:16 2006
@@ -18,7 +18,7 @@
// | Mark Wiesemann <wiesemann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: HTMLTable.php,v 1.85 2006/03/01 22:42:35 olivierg Exp $
+// $Id: HTMLTable.php,v 1.86 2006/03/02 00:42:16 olivierg Exp $
require_once 'Structures/DataGrid/Renderer/Common.php';
require_once 'HTML/Table.php';
@@ -56,7 +56,7 @@
* mb_internal_encoding(), otherwise it is ISO-8859-1
*
*
- * @version $Revision: 1.85 $
+ * @version $Revision: 1.86 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
@@ -337,8 +337,10 @@
!in_array($field, $this->_options['disableColumnSorting'])) {
// Determine next sort direction and current sort icon
- if ($this->_currentSort and $this->_currentSort[0]['field'] ==
$field) {
- if ($this->_currentSort[0]['direction'] == 'ASC') {
+ reset($this->_currentSort);
+ if (list($currentField,$currentDirection) = each($this->_currentSort)
+ and $currentField == $field) {
+ if ($currentDirection == 'ASC') {
$icon = $this->_options['sortIconASC'];
$direction = 'DESC';
} else {
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/XUL.php?r1=1.17&r2=1.18&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/XUL.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/XUL.php:1.17
pear/Structures_DataGrid/DataGrid/Renderer/XUL.php:1.18
--- pear/Structures_DataGrid/DataGrid/Renderer/XUL.php:1.17 Wed Mar 1 15:16:08 2006
+++ pear/Structures_DataGrid/DataGrid/Renderer/XUL.php Thu Mar 2 00:42:16 2006
@@ -18,7 +18,7 @@
// | Mark Wiesemann <wiesemann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: XUL.php,v 1.17 2006/03/01 15:16:08 olivierg Exp $
+// $Id: XUL.php,v 1.18 2006/03/02 00:42:16 olivierg Exp $
require_once 'Structures/DataGrid/Renderer/Common.php';
//require_once 'XML/XUL.php';
@@ -40,7 +40,7 @@
* - selfPath: (string) The complete path for sorting and paging links
* (default: $_SERVER['PHP_SELF'])
*
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
@@ -151,8 +151,10 @@
$label = $this->_columns[$col]['label'];
if (in_array($field, $this->_sortableFields)) {
- if ($this->_currentSort and $this->_currentSort[0]['field'] ==
$field) {
- if ($this->_currentSort[0]['direction'] == 'ASC') {
+ reset ($this->_currentSort);
+ if (list($currentField, $direction) = each($this->_currentSort)
+ and $currentField == $field) {
+ if ($direction == 'ASC') {
// The data is currently sorted by $column, ascending.
// That means we want $dirArg set to 'DESC', for the next
// click to trigger a reverse order sort, and we need