cvs: pear /Structures_DataGrid/DataGrid Column.php /Structures_DataGrid/DataGrid/Renderer Common.php HTMLTable.php

From: Date: Thu, 19 Jan 2006 00:26:30 +0000
Subject: cvs: pear /Structures_DataGrid/DataGrid Column.php /Structures_DataGrid/DataGrid/Renderer Common.php HTMLTable.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-37645@lists.php.net to get a copy of this message
olivierg Thu Jan 19 00:26:30 2006 UTC Modified files: /pear/Structures_DataGrid/DataGrid Column.php /pear/Structures_DataGrid/DataGrid/Renderer Common.php HTMLTable.php Log: Fixed some CS issues

http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Column.php?r1=1.19&r2=1.20&diff_format=u Index: pear/Structures_DataGrid/DataGrid/Column.php diff -u pear/Structures_DataGrid/DataGrid/Column.php:1.19 pear/Structures_DataGrid/DataGrid/Column.php:1.20 --- pear/Structures_DataGrid/DataGrid/Column.php:1.19 Sat Dec 31 00:34:04 2005 +++ pear/Structures_DataGrid/DataGrid/Column.php Thu Jan 19 00:26:30 2006 @@ -16,14 +16,14 @@ // | Author: Andrew Nagy <asnagy@webitecture.org> | // +----------------------------------------------------------------------+ // -// $Id: Column.php,v 1.19 2005/12/31 00:34:04 olivierg Exp $ +// $Id: Column.php,v 1.20 2006/01/19 00:26:30 olivierg Exp $ /** * Structures_DataGrid_Column Class * * This class represents a single column for the DataGrid. * - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ * @author Andrew S. Nagy <asnagy@webitecture.org> * @access public * @package Structures_DataGrid @@ -206,16 +206,16 @@ return $result; } - function recordToValue ($record) + function recordToValue($record) { $value = ''; - if (isset ($this->formatter) and !empty ($this->formatter)) { - $value = $this->formatter ($record); - } else if (isset ($this->fieldName) and isset ($record[$this->fieldName])) { + if (isset($this->formatter) and !empty($this->formatter)) { + $value = $this->formatter($record); + } else if (isset($this->fieldName) and isset($record[$this->fieldName])) { $value = $record[$this->fieldName]; } - if (empty ($value) and !is_null($this->autoFillValue)) + if (empty($value) and !is_null($this->autoFillValue)) { $content = $this->autoFillValue; } http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Common.php?r1=1.4&r2=1.5&diff_format=u Index: pear/Structures_DataGrid/DataGrid/Renderer/Common.php diff -u pear/Structures_DataGrid/DataGrid/Renderer/Common.php:1.4 pear/Structures_DataGrid/DataGrid/Renderer/Common.php:1.5 --- pear/Structures_DataGrid/DataGrid/Renderer/Common.php:1.4 Mon Jan 2 18:39:28 2006 +++ pear/Structures_DataGrid/DataGrid/Renderer/Common.php Thu Jan 19 00:26:30 2006 @@ -17,7 +17,7 @@ // | Olivier Guilyardi <olivier@samalyse.com> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.4 2006/01/02 18:39:28 olivierg Exp $ +// $Id: Common.php,v 1.5 2006/01/19 00:26:30 olivierg Exp $ /** * Structures_DataGrid_Renderer_Common Class @@ -55,7 +55,7 @@ * added * * - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @author Olivier Guilyardi <olivier@samalyse.com> * @access public * @package Structures_DataGrid @@ -229,7 +229,7 @@ $this->_records = &$records; } - function setCurrentSorting ($field, $direction) + function setCurrentSorting($field, $direction) { $this->_currentSortField = $field; $this->_currentSortDirection = $direction; @@ -241,27 +241,27 @@ $this->_totalRecordsNum = $totalRowNum; } - function init () + function init() { } - function buildHeader () + function buildHeader() { } - function buildBody () + function buildBody() { } - function buildFooter () + function buildFooter() { } - function finalize () + function finalize() { } - function build () + function build() { $this->_columns = array(); foreach ($this->_columnObjects as $index => $column) @@ -277,9 +277,9 @@ $label = $column->columnName; if (isset($this->_options['defaultColumnValues'][$field])) { - $column->setAutoFillValue ($this->_options['defaultColumnValues'][$field]); - } else if (!is_null ($this->_options['defaultCellValue'])) { - $column->setAutoFillValue ($this->_options['defaultCellValue']); + $column->setAutoFillValue($this->_options['defaultColumnValues'][$field]); + } else if (!is_null($this->_options['defaultCellValue'])) { + $column->setAutoFillValue($this->_options['defaultCellValue']); } if (isset($column->attribs) @@ -293,42 +293,39 @@ $this->_columns[$index] = compact('field','label'); } - if ($this->_records) - { - if (is_null ($this->_pageLimit)) { - $this->_pageLimit = count ($this->_records); - } - - for ($i = 0; isset($this->_records[$i]) and $i < $this->_pageLimit; $i++) { - $content = array (); - foreach ($this->_columnObjects as $column) { - $content[] = $column->recordToValue ($this->_records[$i]); - } - $this->_records[$i] = $content; + $this->_columnsNum = count($this->_columns); + $this->_recordsNum = count($this->_records); + + $this->init(); + + if (is_null($this->_pageLimit)) { + $this->_pageLimit = $this->_recordsNum; + } + + for ($rec = 0; $rec < $this->_recordsNum; $rec++) { + $content = array(); + foreach ($this->_columnObjects as $column) { + $content[] = $column->recordToValue($this->_records[$rec]); } + $this->_records[$rec] = $content; } - $this->_columnsNum = count ($this->_columns); - $this->_recordsNum = count ($this->_records); - - $this->init(); - if ($this->_options['buildHeader']) { - $this->buildHeader (); + $this->buildHeader(); } - $this->buildBody (); + $this->buildBody(); if ($this->_options['buildFooter']) { - $this->buildFooter (); + $this->buildFooter(); } - $this->finalize (); + $this->finalize(); $this->_isBuilt = true; } - function getOutput () + function getOutput() { $this->_isBuilt or $this->build(); @@ -337,7 +334,7 @@ function render() { - echo $this->getOutput (); + echo $this->getOutput(); } /** http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php?r1=1.68&r2=1.69&diff_format=u Index: pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php diff -u pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.68 pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.69 --- pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php:1.68 Mon Jan 2 18:39:28 2006 +++ pear/Structures_DataGrid/DataGrid/Renderer/HTMLTable.php Thu Jan 19 00:26:30 2006 @@ -18,7 +18,7 @@ // | Mark Wiesemann <wiesemann@php.net> | // +----------------------------------------------------------------------+ // -// $Id: HTMLTable.php,v 1.68 2006/01/02 18:39:28 olivierg Exp $ +// $Id: HTMLTable.php,v 1.69 2006/01/19 00:26:30 olivierg Exp $ require_once 'Structures/DataGrid/Renderer/Common.php'; require_once 'HTML/Table.php'; @@ -49,7 +49,7 @@ * array(fieldName => array(attribute => value, ...) ... ) * * - * @version $Revision: 1.68 $ + * @version $Revision: 1.69 $ * @author Andrew S. Nagy <asnagy@webitecture.org> * @author Olivier Guilyardi <olivier@samalyse.com> * @author Mark Wiesemann <wiesemann@php.net> @@ -365,11 +365,11 @@ * @access private * @return void */ - function buildBody () + function buildBody() { for ($row = 0; $row < $this->_recordsNum; $row++) { for ($col = 0; $col < $this->_columnsNum; $col++) { - $value = htmlspecialchars ($this->_records[$row][$col]); + $value = htmlspecialchars($this->_records[$row][$col]); /* Right-align the content if it is numeric */ $attributes = ($this->_options['autoAlign'] and is_numeric ($value))
« previous php.pear.cvs (#37645) next »