cvs: pear /Structures_DataGrid/DataGrid Renderer.php /Structures_DataGrid/DataGrid/Renderer Smarty.php
| From: | Olivier Guilyardi | Date: | Fri, 17 Mar 2006 12:56:08 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid Renderer.php /Structures_DataGrid/DataGrid/Renderer Smarty.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39150@lists.php.net to get a copy of this message | ||
olivierg Fri Mar 17 12:56:08 2006 UTC
Modified files:
/pear/Structures_DataGrid/DataGrid Renderer.php
/pear/Structures_DataGrid/DataGrid/Renderer Smarty.php
Log:
firstRecord and lastRecord now start from 1, as page
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer.php?r1=1.35&r2=1.36&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer.php:1.35
pear/Structures_DataGrid/DataGrid/Renderer.php:1.36
--- pear/Structures_DataGrid/DataGrid/Renderer.php:1.35 Fri Mar 17 12:45:06 2006
+++ pear/Structures_DataGrid/DataGrid/Renderer.php Fri Mar 17 12:56:08 2006
@@ -17,7 +17,7 @@
// | Olivier Guilyardi <olivier@samalyse.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Renderer.php,v 1.35 2006/03/17 12:45:06 olivierg Exp $
+// $Id: Renderer.php,v 1.36 2006/03/17 12:56:08 olivierg Exp $
require_once 'PHP/Compat/Function/http_build_query.php';
@@ -81,7 +81,7 @@
* - fillWithEmptyRows
* - numberAlign
*
- * @version $Revision: 1.35 $
+ * @version $Revision: 1.36 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @access public
* @package Structures_DataGrid
@@ -157,14 +157,14 @@
var $_totalRecordsNum;
/**
- * First record number (zero-based), in the current page
+ * First record number (starting from 1), in the current page
* @var int
* @access protected
*/
var $_firstRecord;
/**
- * Last record number (zero-base), in the current page
+ * Last record number (starting from 1), in the current page
* @var int
* @access protected
*/
@@ -370,10 +370,10 @@
$this->_pageLimit = $rowsPerPage;
$this->_totalRecordsNum = $totalRowNum;
$this->_pagesNum = ceil($totalRowNum / $rowsPerPage);
- $this->_firstRecord = ($currentPage - 1) * $rowsPerPage;
- $this->_lastRecord = $currentPage * $rowsPerPage - 1;
- if ($this->_lastRecord >= $totalRowNum) {
- $this->_lastRecord = $totalRowNum - 1;
+ $this->_firstRecord = ($currentPage - 1) * $rowsPerPage + 1;
+ $this->_lastRecord = $currentPage * $rowsPerPage;
+ if ($this->_lastRecord > $totalRowNum) {
+ $this->_lastRecord = $totalRowNum;
}
}
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php?r1=1.17&r2=1.18&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.17
pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.18
--- pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.17 Fri Mar 17 12:45:49 2006
+++ pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php Fri Mar 17 12:56:08 2006
@@ -18,7 +18,7 @@
// | Mark Wiesemann <wiesemann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Smarty.php,v 1.17 2006/03/17 12:45:49 olivierg Exp $
+// $Id: Smarty.php,v 1.18 2006/03/17 12:56:08 olivierg Exp $
require_once 'Structures/DataGrid/Renderer.php';
@@ -50,8 +50,8 @@
* - $columnsNum : number of columns
* - $recordsNum : number of records in the current page
* - $totalRecordsNum : total number of records
- * - $firstRecord : first record number (zero-based)
- * - $lastRecord : last record number (zero-based)
+ * - $firstRecord : first record number (starting from 1)
+ * - $lastRecord : last record number (starting from 1)
*
* This driver also register a Smarty custom function named getPaging
* that can be called from Smarty templates with {getPaging} in order
@@ -64,7 +64,7 @@
* <!-- Show paging links using the custom getPaging function -->
* {getPaging prevImg="<<" nextImg=">>" separator=" | "
delta="5"}
*
- * <p>Showing records {$firstRecord+1} to {$lastRecord+1}
+ * <p>Showing records {$firstRecord} to {$lastRecord}
* from {$totalRecordsNum}, page {$currentPage} of {$pagesNum}</p>
*
* <table cellspacing="0">
@@ -93,7 +93,7 @@
* </table>
* </code>
*
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @access public