[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-cvs
Subject: [PEAR-CVS] cvs: pear /Structures_DataGrid package2-r-smarty.xml package2.xml /Structures_DataGrid/D
From: "Olivier Guilyardi" <olivierg () php ! net>
Date: 2007-10-31 16:56:26
Message-ID: cvsolivierg1193849786 () cvsserver
[Download RAW message or body]
olivierg Wed Oct 31 16:56:26 2007 UTC
Added files:
/pear/Structures_DataGrid/tests ObjectRecordTest.php
Modified files:
/pear/Structures_DataGrid package2-r-smarty.xml package2.xml
/pear/Structures_DataGrid/DataGrid Renderer.php
/pear/Structures_DataGrid/DataGrid/Renderer CSV.php
CheckableHTMLTable.php
Console.php
HTMLEditForm.php
HTMLSortForm.php
HTMLTable.php Pager.php
Smarty.php XLS.php
XML.php XUL.php
/pear/Structures_DataGrid/tests AllTests.php
/pear/Structures_DataGrid/tools/manual-gen add-revision-tags.php
parse-options.php
Log:
add Object Preserving rendering feature, unit tests, and specific support for Smarty
["olivierg-20071031165626.txt" (text/plain)]
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/package2-r-smarty.xml?r1=1.19&r2=1.20&diff_format=u
Index: pear/Structures_DataGrid/package2-r-smarty.xml
diff -u pear/Structures_DataGrid/package2-r-smarty.xml:1.19 \
pear/Structures_DataGrid/package2-r-smarty.xml:1.20
--- pear/Structures_DataGrid/package2-r-smarty.xml:1.19 Wed Oct 24 11:37:49 2007
+++ pear/Structures_DataGrid/package2-r-smarty.xml Wed Oct 31 16:56:24 2007
@@ -44,6 +44,7 @@
- add support for the jsHandler option
- new columnSet item members: direction and onclick
- Request #9994: add support for URL mapping, by Sascha Grossenbacher
+- add "Object Preserving" feature
</notes>
<contents>
<dir name="/">
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/package2.xml?r1=1.51&r2=1.52&diff_format=u
Index: pear/Structures_DataGrid/package2.xml
diff -u pear/Structures_DataGrid/package2.xml:1.51 \
pear/Structures_DataGrid/package2.xml:1.52
--- pear/Structures_DataGrid/package2.xml:1.51 Wed Oct 24 11:55:07 2007
+++ pear/Structures_DataGrid/package2.xml Wed Oct 31 16:56:25 2007
@@ -51,6 +51,9 @@
- new URL mapping feature by Sascha Grossenbacher,
- Request #9994 :new setUrlFormat() method providing clean URL mapping,
by Sascha Grossenbacher
+- add ability to use objects of any class instead of associative arrays as
+ records (not all datasources support that, and renderers handle such objects
+ differently whether they support "Object Preserving" or not)
</notes>
<contents>
<dir name="/">
@@ -95,6 +98,7 @@
<file baseinstalldir="Structures" name="DataSourceSQLTest.php" role="test" />
<file baseinstalldir="Structures" name="DataSourceXMLTest.php" role="test" />
<file baseinstalldir="Structures" name="URLMappingTest.php" role="test" />
+ <file baseinstalldir="Structures" name="ObjectRecordTest.php" role="test" />
</dir> <!-- /tests -->
</dir> <!-- / -->
</contents>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer.php?r1=1.78&r2=1.79&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer.php:1.78 \
pear/Structures_DataGrid/DataGrid/Renderer.php:1.79
--- pear/Structures_DataGrid/DataGrid/Renderer.php:1.78 Wed Oct 31 15:12:43 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer.php Wed Oct 31 16:56:25 2007
@@ -36,9 +36,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: Renderer.php,v 1.78 2007/10/31 15:12:43 olivierg Exp $
+ * CSV file id: $Id: Renderer.php,v 1.79 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.78 $
+ * @version $Revision: 1.79 $
* @package Structures_DataGrid
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -132,7 +132,7 @@
* - extraVars
* - excludeVars
*
- * @version $Revision: 1.78 $
+ * @version $Revision: 1.79 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
* @author Sascha Grossenbacher <saschagros@bluewin.ch>
@@ -393,7 +393,8 @@
$this->_features = array(
'streaming' => false,
- 'outputBuffering' => false,
+ 'outputBuffering' => false,
+ 'objectPreserving' => false,
);
if (function_exists('mb_internal_encoding')) {
@@ -781,7 +782,6 @@
*/
function build($chunk, $startRow, $eof = false)
{
- print_r($chunk);
// on first call of build(): initialize the columns and prepare the header
if (empty($this->_columns)) {
$this->_columns = array();
@@ -841,14 +841,19 @@
$row = 0;
for ($rec = 0; $rec < $chunkSize; $rec++) {
- $content = array();
- $col = 0;
- foreach ($this->_columnObjects as $column) {
- $content[] = $this->recordToCell($column, $chunk[$rec],
- $row + $startRow, $col);
- $col++;
+ // Currently, no formatting is performed on object records.
+ // These are not converted to indexed arrays, so that some
+ // renderer drivers might fail to process them.
+ if (is_array($rec) or !$this->hasFeature('objectPreserving')) {
+ $content = array();
+ $col = 0;
+ foreach ($this->_columnObjects as $column) {
+ $content[] = $this->recordToCell($column, $chunk[$rec],
+ $row + $startRow, $col);
+ $col++;
+ }
+ $chunk[$rec] = $content;
}
- $chunk[$rec] = $content;
$row++;
}
@@ -1008,8 +1013,11 @@
$value = '';
if (isset($column->formatter) and !empty($column->formatter)) {
$value = $column->formatter($record, $row, $col);
- } else if (isset($column->fieldName) and isset($record[$column->fieldName])) \
{
- $value = $this->defaultCellFormatter($record[$column->fieldName]);
+ } else if (isset($column->fieldName)) {
+ $record = (array) $record; // record might be an object
+ if (isset($record[$column->fieldName])) {
+ $value = $this->defaultCellFormatter($record[$column->fieldName]);
+ }
}
if (empty($value) and !is_null($column->autoFillValue)) {
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/CSV.php?r1=1.33&r2=1.34&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/CSV.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/CSV.php:1.33 \
pear/Structures_DataGrid/DataGrid/Renderer/CSV.php:1.34
--- pear/Structures_DataGrid/DataGrid/Renderer/CSV.php:1.33 Sat Apr 21 14:05:23 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/CSV.php Wed Oct 31 16:56:25 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: CSV.php,v 1.33 2007/04/21 14:05:23 wiesemann Exp $
+ * CSV file id: $Id: CSV.php,v 1.34 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.33 $
+ * @version $Revision: 1.34 $
* @package Structures_DataGrid_Renderer_CSV
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -72,8 +72,9 @@
* - Output Buffering: yes
* - Direct Rendering: yes
* - Streaming: yes
+ * - Object Preserving: no
*
- * @version $Revision: 1.33 $
+ * @version $Revision: 1.34 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/CheckableHTMLTable.php?r1=1.2&r2=1.3&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/CheckableHTMLTable.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/CheckableHTMLTable.php:1.2 \
pear/Structures_DataGrid/DataGrid/Renderer/CheckableHTMLTable.php:1.3
--- pear/Structures_DataGrid/DataGrid/Renderer/CheckableHTMLTable.php:1.2 Wed Jun 13 \
20:26:46 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/CheckableHTMLTable.php Wed Oct 31 \
16:56:25 2007 @@ -34,9 +34,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: CheckableHTMLTable.php,v 1.2 2007/06/13 20:26:46 olivierg Exp $
+ * CSV file id: $Id: CheckableHTMLTable.php,v 1.3 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @package Structures_DataGrid_Renderer_CheckableHTMLTable
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -66,6 +66,7 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
* GENERAL NOTES:
*
@@ -75,7 +76,7 @@
* column yourself as it is shown in the example.
*
* @example checkablehtmltable.php Basic usage
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
* @access public
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Console.php?r1=1.21&r2=1.22&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/Console.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/Console.php:1.21 \
pear/Structures_DataGrid/DataGrid/Renderer/Console.php:1.22
--- pear/Structures_DataGrid/DataGrid/Renderer/Console.php:1.21 Tue Jun 19 13:53:57 \
2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/Console.php Wed Oct 31 16:56:25 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: Console.php,v 1.21 2007/06/19 13:53:57 olivierg Exp $
+ * CSV file id: $Id: Console.php,v 1.22 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.21 $
+ * @version $Revision: 1.22 $
* @package Structures_DataGrid_Renderer_Console
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -63,8 +63,9 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
- * @version $Revision: 1.21 $
+ * @version $Revision: 1.22 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/HTMLEditForm.php?r1=1.6&r2=1.7&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/HTMLEditForm.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/HTMLEditForm.php:1.6 \
pear/Structures_DataGrid/DataGrid/Renderer/HTMLEditForm.php:1.7
--- pear/Structures_DataGrid/DataGrid/Renderer/HTMLEditForm.php:1.6 Mon Jan 1 \
10:31:18 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/HTMLEditForm.php Wed Oct 31 16:56:25 \
2007 @@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: HTMLEditForm.php,v 1.6 2007/01/01 10:31:18 wiesemann Exp $
+ * CSV file id: $Id: HTMLEditForm.php,v 1.7 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @package Structures_DataGrid_Renderer_HTMLEditForm
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -60,10 +60,11 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
* @example htmleditform-basic.php Basic usage
* @example htmleditform-tableless.php Usage with tableless renderer and DHTMLRules
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @access public
* @package Structures_DataGrid_Renderer_HTMLEditForm
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/HTMLSortForm.php?r1=1.13&r2=1.14&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/HTMLSortForm.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/HTMLSortForm.php:1.13 \
pear/Structures_DataGrid/DataGrid/Renderer/HTMLSortForm.php:1.14
--- pear/Structures_DataGrid/DataGrid/Renderer/HTMLSortForm.php:1.13 Tue Jun 19 \
13:52:40 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/HTMLSortForm.php Wed Oct 31 16:56:25 \
2007 @@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: HTMLSortForm.php,v 1.13 2007/06/19 13:52:40 olivierg Exp $
+ * CSV file id: $Id: HTMLSortForm.php,v 1.14 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
* @package Structures_DataGrid_Renderer_HTMLSortForm
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -74,8 +74,9 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @access public
* @package Structures_DataGrid_Renderer_HTMLSortForm
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php?r1=1.127&r2=1.128&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.127 \
pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.128
--- pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.127 Wed Oct 24 \
11:32:49 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php Wed Oct 31 16:56:25 2007
@@ -36,9 +36,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: HTMLTable.php,v 1.127 2007/10/24 11:32:49 olivierg Exp $
+ * CSV file id: $Id: HTMLTable.php,v 1.128 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.127 $
+ * @version $Revision: 1.128 $
* @package Structures_DataGrid_Renderer_HTMLTable
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -78,8 +78,9 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
- * @version $Revision: 1.127 $
+ * @version $Revision: 1.128 $
* @example ajax-simple.php Simple AJAX support using the Prototype framework
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Pager.php?r1=1.25&r2=1.26&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/Pager.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/Pager.php:1.25 \
pear/Structures_DataGrid/DataGrid/Renderer/Pager.php:1.26
--- pear/Structures_DataGrid/DataGrid/Renderer/Pager.php:1.25 Wed Oct 24 11:32:49 \
2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/Pager.php Wed Oct 31 16:56:25 2007
@@ -36,9 +36,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: Pager.php,v 1.25 2007/10/24 11:32:49 olivierg Exp $
+ * CSV file id: $Id: Pager.php,v 1.26 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
* @package Structures_DataGrid_Renderer_Pager
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -81,8 +81,9 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
* @author Andrew S. Nagy <asnagy@webitecture.org>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php?r1=1.50&r2=1.51&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.50 \
pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.51
--- pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.50 Wed Oct 24 11:32:49 \
2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php Wed Oct 31 16:56:25 2007
@@ -36,9 +36,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CVS file id: $Id: Smarty.php,v 1.50 2007/10/24 11:32:49 olivierg Exp $
+ * CVS file id: $Id: Smarty.php,v 1.51 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.50 $
+ * @version $Revision: 1.51 $
* @package Structures_DataGrid_Renderer_Smarty
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -68,6 +68,7 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: yes
*
* GENERAL NOTES:
*
@@ -112,16 +113,21 @@
* - $datagrid: a reference that you can pass to {getPaging}
* </code>
*
- * This driver also registers a Smarty custom function named getPaging
+ * This driver registers a Smarty custom function named getPaging
* that can be called from Smarty templates with {getPaging} in order
* to print paging links. This function accepts the same parameters as the
* pagerOptions option of Structures_DataGrid_Renderer_Pager.
*
- * {getPaging} also accepts an optional "datagrid" parameter
+ * {getPaging} accepts an optional "datagrid" parameter
* which you can pass the $datagrid variable, to display paging for an
* arbitrary datagrid (useful with multiple dynamic datagrids on a single page).
*
- * @version $Revision: 1.50 $
+ * Object Records : this drivers preserves object records if provided. This means
+ * that if your datasource provides objects instead of associative arrays as
+ * records, you can access their properties and methods in your smarty template,
+ * with something like: {$recordSet[col]->getSomeInformation()}.
+ *
+ * @version $Revision: 1.51 $
* @example smarty-simple.php Using the Smarty renderer
* @example smarty-simple.tpl Smarty template with sorting and paging \
(smarty-simple.tpl)
* @author Andrew S. Nagy <asnagy@webitecture.org>
@@ -166,6 +172,7 @@
$this->_setFeatures(
array(
'outputBuffering' => true,
+ 'objectPreserving' => true,
)
);
}
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/XLS.php?r1=1.47&r2=1.48&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/XLS.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/XLS.php:1.47 \
pear/Structures_DataGrid/DataGrid/Renderer/XLS.php:1.48
--- pear/Structures_DataGrid/DataGrid/Renderer/XLS.php:1.47 Tue Jun 19 13:53:57 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/XLS.php Wed Oct 31 16:56:25 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: XLS.php,v 1.47 2007/06/19 13:53:57 olivierg Exp $
+ * CSV file id: $Id: XLS.php,v 1.48 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.47 $
+ * @version $Revision: 1.48 $
* @package Structures_DataGrid_Renderer_XLS
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -86,6 +86,7 @@
* - Output Buffering: no
* - Direct Rendering: not really, see below
* - Streaming: no
+ * - Object Preserving: no
*
* GENERAL NOTES:
*
@@ -132,7 +133,7 @@
* $datagrid->fill($workbook, $options);
* </code>
*
- * @version $Revision: 1.47 $
+ * @version $Revision: 1.48 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/XML.php?r1=1.41&r2=1.42&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/XML.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/XML.php:1.41 \
pear/Structures_DataGrid/DataGrid/Renderer/XML.php:1.42
--- pear/Structures_DataGrid/DataGrid/Renderer/XML.php:1.41 Tue Jun 19 13:53:57 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/XML.php Wed Oct 31 16:56:25 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: XML.php,v 1.41 2007/06/19 13:53:57 olivierg Exp $
+ * CSV file id: $Id: XML.php,v 1.42 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.41 $
+ * @version $Revision: 1.42 $
* @category Structures
* @package Structures_DataGrid_Renderer_XML
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -84,8 +84,9 @@
* - Output Buffering: yes
* - Direct Rendering: yes
* - Streaming: yes
+ * - Object Preserving: no
*
- * @version $Revision: 1.41 $
+ * @version $Revision: 1.42 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/XUL.php?r1=1.38&r2=1.39&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/XUL.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/XUL.php:1.38 \
pear/Structures_DataGrid/DataGrid/Renderer/XUL.php:1.39
--- pear/Structures_DataGrid/DataGrid/Renderer/XUL.php:1.38 Tue Jun 19 17:20:47 2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/XUL.php Wed Oct 31 16:56:25 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: XUL.php,v 1.38 2007/06/19 17:20:47 olivierg Exp $
+ * CSV file id: $Id: XUL.php,v 1.39 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.38 $
+ * @version $Revision: 1.39 $
* @category Structures
* @package Structures_DataGrid_Renderer_XUL
* @license http://opensource.org/licenses/bsd-license.php New BSD License
@@ -61,6 +61,7 @@
* - Output Buffering: yes
* - Direct Rendering: no
* - Streaming: no
+ * - Object Preserving: no
*
* GENERAL NOTES:
*
@@ -72,7 +73,7 @@
* document. This driver will only generated the <listbox> element and
* content.
*
- * @version $Revision: 1.38 $
+ * @version $Revision: 1.39 $
* @example xul.php Using the XUL renderer
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/tests/AllTests.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/Structures_DataGrid/tests/AllTests.php
diff -u pear/Structures_DataGrid/tests/AllTests.php:1.4 \
pear/Structures_DataGrid/tests/AllTests.php:1.5
--- pear/Structures_DataGrid/tests/AllTests.php:1.4 Tue Oct 23 15:52:52 2007
+++ pear/Structures_DataGrid/tests/AllTests.php Wed Oct 31 16:56:25 2007
@@ -34,9 +34,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CVS file id: $Id: AllTests.php,v 1.4 2007/10/23 15:52:52 olivierg Exp $
+ * CVS file id: $Id: AllTests.php,v 1.5 2007/10/31 16:56:25 olivierg Exp $
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package Structures_DataGrid
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
@@ -50,6 +50,7 @@
require_once 'PHPUnit.php';
require_once 'AllDataSourceTests.php';
+require_once 'ObjectRecordTest.php';
/**
* Test (almost ;) everything
@@ -70,6 +71,7 @@
function getSuites()
{
$suites = AllDataSourceTests::getSuites();
+ $suites[] = 'ObjectRecordTest';
// PHP5 only:
if (version_compare(phpversion(), '5', '>=')) {
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/tools/manual-gen/add-revision-tags.php?r1=1.1&r2=1.2&diff_format=u
Index: pear/Structures_DataGrid/tools/manual-gen/add-revision-tags.php
diff -u pear/Structures_DataGrid/tools/manual-gen/add-revision-tags.php:1.1 \
pear/Structures_DataGrid/tools/manual-gen/add-revision-tags.php:1.2
--- pear/Structures_DataGrid/tools/manual-gen/add-revision-tags.php:1.1 Tue Dec 26 \
10:00:22 2006
+++ pear/Structures_DataGrid/tools/manual-gen/add-revision-tags.php Wed Oct 31 \
16:56:25 2007 @@ -47,7 +47,8 @@
$availableRendererModes = array('Container Support',
'Output Buffering',
'Direct Rendering',
- 'Streaming'
+ 'Streaming',
+ 'Object Preserving',
);
$descriptions = array();
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/tools/manual-gen/parse-options.php?r1=1.28&r2=1.29&diff_format=u
Index: pear/Structures_DataGrid/tools/manual-gen/parse-options.php
diff -u pear/Structures_DataGrid/tools/manual-gen/parse-options.php:1.28 \
pear/Structures_DataGrid/tools/manual-gen/parse-options.php:1.29
--- pear/Structures_DataGrid/tools/manual-gen/parse-options.php:1.28 Sun Jul 22 \
14:43:28 2007
+++ pear/Structures_DataGrid/tools/manual-gen/parse-options.php Wed Oct 31 16:56:26 \
2007 @@ -24,7 +24,8 @@
$availableRendererModes = array('Container Support',
'Output Buffering',
'Direct Rendering',
- 'Streaming'
+ 'Streaming',
+ 'Object Preserving',
);
$descriptions = array();
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/tests/ObjectRecordTest.php?view=markup&rev=1.1
Index: pear/Structures_DataGrid/tests/ObjectRecordTest.php
+++ pear/Structures_DataGrid/tests/ObjectRecordTest.php
<?php
/**
* Unit Tests for Structures_DataGrid
*
* PHP versions 4 and 5
*
* LICENSE:
*
* Copyright (c) 1997-2007, Olivier Guilyardi <olivier@samalyse.com>,
* Mark Wiesemann <wiesemann@php.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* CVS file id: $Id: ObjectRecordTest.php,v 1.1 2007/10/31 16:56:25 olivierg Exp $
*
* @version $Revision: 1.1 $
* @package Structures_DataGrid
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php New BSD License
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'ObjectRecordTest::main');
}
require_once 'TestCore.php';
require_once 'Structures/DataGrid.php';
error_reporting(E_ALL);
/**
* Object record support test
*
* This class tests that records which are objects instead of associative
* arrays are properly handled by the datagrid core and by renderers.
*
* There is two rendering scenarios:
*
* If the renderer has the "objectPreserving" feature (such as Smarty) then
* the object records must be "rendered" untouched and references preserved.
*
* If the renderer can't "render" objects (such as CSV, HTMLTable, etc..) then
* it must handle them mostly as if they were associative arrays, except that
* the formatter must receive the objects untouched, so that it can call some
* of their methods, etc...
*/
class ObjectRecordTest extends TestCore
{
function testObjectPreservingWithSmarty()
{
$pear = new ObjectRecordTest_Store('pear');
$doctrine = new ObjectRecordTest_Store('doctrine');
$propel = new ObjectRecordTest_Store('propel');
$datagrid =& new Structures_DataGrid(2);
$datagrid->bind(array(&$pear, &$doctrine, &$propel));
$output = $datagrid->getOutput('Smarty');
$this->assertEquals('pear', $output['recordSet'][0]->name);
$this->assertEquals('pear(tm)', $output['recordSet'][0]->getBrand());
$pear->name = 'pear2';
$this->assertEquals('pear2', $output['recordSet'][0]->name);
}
function testObjectFormattingWithCSV()
{
$pear = new ObjectRecordTest_Store('pear');
$doctrine = new ObjectRecordTest_Store('doctrine');
$propel = new ObjectRecordTest_Store('propel');
$datagrid =& new Structures_DataGrid();
$datagrid->bind(array(&$pear, &$doctrine, &$propel));
$column = new Structures_DataGrid_Column('brand', 'brand');
$column->setFormatter(array($this, '_testCSVBrandFormatter'));
$datagrid->addColumn(new Structures_DataGrid_Column('name', 'name'));
$datagrid->addColumn($column);
$output = explode("\n", $datagrid->getOutput('CSV'));
$this->assertEquals('name,brand', $output[0]);
$this->assertEquals('pear,pear(tm)', $output[1]);
$this->assertEquals('doctrine,doctrine(tm)', $output[2]);
$this->assertEquals('propel,propel(tm)', $output[3]);
}
function _testCSVBrandFormatter($data)
{
return $data['record']->getBrand();
}
}
class ObjectRecordTest_Store
{
var $name;
function ObjectRecordTest_Store($name)
{
$this->name = $name;
}
function getBrand()
{
return "{$this->name}(tm)";
}
}
if (PHPUnit_MAIN_METHOD == 'ObjectRecordTest::main') {
$suite = new PHPUnit_TestSuite('ObjectRecordTest');
$result = PHPUnit::run($suite);
echo $result->toString();
}
?>
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic