cvs: pear /Structures_DataGrid/DataGrid/Renderer CSV.php HTMLTable.php

From: Date: Fri, 11 Mar 2005 23:01:06 +0000
Subject: cvs: pear /Structures_DataGrid/DataGrid/Renderer CSV.php HTMLTable.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-30225@lists.php.net to get a copy of this message
asnagy Fri Mar 11 18:01:06 2005 EDT Modified files: /pear/Structures_DataGrid/DataGrid/Renderer CSV.php HTMLTable.php Log: Added additional "" encapsulation logic (Bug 3588) http://cvs.php.net/diff.php/pear/Structures_DataGrid/DataGrid/Renderer/CSV.php?r1=1.5&r2=1.6&ty=u Index: pear/Structures_DataGrid/DataGrid/Renderer/CSV.php diff -u pear/Structures_DataGrid/DataGrid/Renderer/CSV.php:1.5 pear/Structures_DataGrid/DataGrid/Renderer/CSV.php:1.6 --- pear/Structures_DataGrid/DataGrid/Renderer/CSV.php:1.5 Mon Jan 10 10:15:49 2005 +++ pear/Structures_DataGrid/DataGrid/Renderer/CSV.php Fri Mar 11 18:01:05 2005 @@ -16,12 +16,12 @@ // | Author: Andrew Nagy <asnagy@webitecture.org> | // +----------------------------------------------------------------------+ // -// $Id: CSV.php,v 1.5 2005/01/10 15:15:49 asnagy Exp $ +// $Id: CSV.php,v 1.6 2005/03/11 23:01:05 asnagy Exp $ /** * Structures_DataGrid_Renderer_CSV Class * - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @author Andrew S. Nagy <asnagy@webitecture.org> * @access public * @package Structures_DataGrid @@ -146,8 +146,13 @@ // Add content to CSV if ($this->useQuotes) { - $csv .= '"' . $content . '"'; + $content = '"' . str_replace('"', '""', $content) . '"'; } else { + if (strstr($content, '"')) { + $content = '"' . str_replace('"', '""', $content) . '"'; + } elseif (strstr($content, ',')) { + $content = '"' . $content . '"'; + } $csv .= $content; } $i++; @@ -161,4 +166,4 @@ } -?> \ No newline at end of file +?> http://cvs.php.net/diff.php/pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php?r1=1.40&r2=1.41&ty=u Index: pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php diff -u pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.40 pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.41 --- pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.40 Thu Jan 27 15:56:44 2005 +++ pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php Fri Mar 11 18:01:05 2005 @@ -16,14 +16,14 @@ // | Author: Andrew Nagy <asnagy@webitecture.org> | // +----------------------------------------------------------------------+ // -// $Id: HTMLTable.php,v 1.40 2005/01/27 20:56:44 asnagy Exp $ +// $Id: HTMLTable.php,v 1.41 2005/03/11 23:01:05 asnagy Exp $ require_once 'HTML/Table.php'; /** * Structures_DataGrid_Renderer_HTMLTable Class * - * @version $Revision: 1.40 $ + * @version $Revision: 1.41 $ * @author Andrew S. Nagy <asnagy@webitecture.org> * @access public * @package Structures_DataGrid @@ -435,7 +435,7 @@ } } else { // Use Record Data - $content = $row[$column->fieldName]; + $content = htmlentities(stripslashes($row[$column->fieldName])); if (($content == '') && ($column->autoFillValue != '')) { @@ -496,12 +496,36 @@ if (is_array($attrs)) { $options = array_merge($options, $attrs); } - $this->_buildPaging($options); + + if ($mode == 'Alpha') { + $this->_buildAlphaPaging($options); + } else { + $this->_buildNumericPaging($options); + } // Return paging html return $this->pager->links; } + function _buildAlphaPaging($options) + { + // This needs to be defined; + $pagedColumn = 'title'; + + $letters = array(); + foreach ($this->_dg->recordSet as $record) { + $letters[] = substr(trim($record[$pagedColumn]), 0, 1); + } + $letters = array_unique($letters); + + // Build HTML + foreach ($letters as $letter) { + $html .= "<a href=\"?page=$letter\">$letter</a> " . $options['separator'] . ' '; + } + $this->pager = new Pager(); + $this->pager->links = $html; + } + /** * Handles generating the paging object @@ -510,7 +534,7 @@ * @access private * @return void */ - function _buildPaging($options) + function _buildNumericPaging($options) { if ($this->_dg->_dataSource != null) { $count = $this->_dg->_dataSource->count(); @@ -527,4 +551,4 @@ } -?> \ No newline at end of file +?>

« previous php.pear.cvs (#30225) next »