Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Bug #1501 Feature Requests and Code
Submitted: 2004-05-26 06:44 UTC
From: michael at mompopmedia dot com Assigned: asnagy
Status: Closed Package: Structures_DataGrid
PHP Version: 5.0.0RC2 (Release Candidate 2) OS: RH9
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-26 06:44 UTC] michael at mompopmedia dot com
Description: ------------ I have implemented two small changes to the HTMLTable.php renderer that I think should be implemented across renderers (see below diff): 1) getPaging now takes a 6th parameter that allows you to apply misc. other options to the Page class 2) Applied to properties (path, and fieldName) a la pager class that allows you to override the path and filename that the renderer builds it's sort links on. I hope these changes (or a variation of), can make it into the distribution. Thanks, Michael Reproduce code: --------------- =================================================================== RCS file: /vhome/cvs/cvsroot/gateway/lib/Structures/DataGrid/Renderer/HTMLTable.php,v retrieving revision 1.1 retrieving revision 1.2 diff -p --unified=3 -r1.1 -r1.2 --- HTMLTable.php 2004/05/26 05:31:32 1.1 +++ HTMLTable.php 2004/05/26 06:43:37 1.2 @@ -16,7 +16,7 @@ // | Author: Andrew Nagy <asnagy@webitecture.org> | // +----------------------------------------------------------------------+ // -// $Id: HTMLTable.php,v 1.1 2004/05/26 05:31:32 cvs Exp $ +// $Id: HTMLTable.php,v 1.2 2004/05/26 06:43:37 cvs Exp $ require_once 'HTML/Table.php'; require_once 'Pager/Pager.php'; @@ -24,7 +24,7 @@ require_once 'Pager/Pager.php'; /** * Structures_DataGrid_Renderer_HTMLTable Class * - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @author Andrew S. Nagy <asnagy@webitecture.org> * @access public * @package Structures_DataGrid @@ -73,6 +73,18 @@ class Structures_DataGrid_Renderer_HTMLT * @var array */ var $emptyRowAttributes = array(); + + /** + * complete path to the page (without the page name) + * @var string + */ + var $path; + + /** + * name of the page + * @var string + */ + var $fileName; /** * The structures_datagrid object @@ -149,7 +161,8 @@ class Structures_DataGrid_Renderer_HTMLT { $this->rowLightBgColor = $bgColor; } - + + /** * Define the table's autofill value. This value appears only in an empty * table cell. @@ -210,7 +223,13 @@ class Structures_DataGrid_Renderer_HTMLT } // Build URL -- This needs much refinement :) - $url = $_SERVER['PHP_SELF'] . '?'; + if (isset($this->path) && isset($this->fileName)) { + $url = $this->path . $this->fileName . '?'; + } elseif (isset($this->path)) { + $url = $this->path . '?'; + } else { + $url = $_SERVER['PHP_SELF'] . '?'; + } if (isset($_SERVER['QUERY_STRING'])) { $qString = explode('&', $_SERVER['QUERY_STRING']); $i = 0; @@ -335,7 +354,7 @@ class Structures_DataGrid_Renderer_HTMLT * @see HTML::Pager */ function getPaging($mode = 'Sliding', $separator = '|', $prev = '<<', - $next = '>>', $delta = 5) + $next = '>>', $delta = 5, $user_options = null) { // Generate Paging $options = array('mode' => $mode, @@ -343,6 +362,9 @@ class Structures_DataGrid_Renderer_HTMLT 'separator' => $separator, 'prevImg' => $prev, 'nextImg' => $next); + if (is_array($user_options)) { + $options = array_merge($options, $user_options); + } $this->_dg->buildPaging($options); // Return paging html

Comments

 [2004-05-27 16:15 UTC] asnagy at webitecture dot org
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.