cvs: pear /Structures_DataGrid/DataGrid Column.php

From: Date: Fri, 25 Jun 2004 14:20:22 +0000
Subject: cvs: pear /Structures_DataGrid/DataGrid Column.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-21113@lists.php.net to get a copy of this message
asnagy Fri Jun 25 10:20:22 2004 EDT Modified files: /pear/Structures_DataGrid/DataGrid Column.php Log: Formatter now allows OO calls (Bug #1584) http://cvs.php.net/diff.php/pear/Structures_DataGrid/DataGrid/Column.php?r1=1.3&r2=1.4&ty=u Index: pear/Structures_DataGrid/DataGrid/Column.php diff -u pear/Structures_DataGrid/DataGrid/Column.php:1.3 pear/Structures_DataGrid/DataGrid/Column.php:1.4 --- pear/Structures_DataGrid/DataGrid/Column.php:1.3 Wed Apr 14 21:44:15 2004 +++ pear/Structures_DataGrid/DataGrid/Column.php Fri Jun 25 10:20:22 2004 @@ -16,14 +16,14 @@ // | Author: Andrew Nagy <asnagy@webitecture.org> | // +----------------------------------------------------------------------+ // -// $Id: Column.php,v 1.3 2004/04/15 01:44:15 asnagy Exp $ +// $Id: Column.php,v 1.4 2004/06/25 14:20:22 asnagy Exp $ /** * Structures_DataGrid_Column Class * * This class represents a single column for the DataGrid. * - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * @author Andrew S. Nagy <asnagy@webitecture.org> * @access public * @package Structures_DataGrid @@ -152,14 +152,20 @@ * based on the record. * * @access public - * @todo add the record array to the formatter automatically + * @todo This method needs to be intuituve and more flexible, + * possibly a seperate column object? */ function formatter($record) { // Define any parameters if ($size = strpos($this->formatter, '(')) { - // Retrieve the name of the function + // Retrieve the name of the function to call $formatter = substr($this->formatter, 0, $size); + if (strstr($formatter, '->')) { + $formatter = explode('->', $formatter); + } elseif (strstr($formatter, '::')) { + $formatter = explode('::', $formatter); + } // Build the list of parameters $length = strlen($this->formatter) - $size - 2; @@ -175,7 +181,7 @@ $vars = split('=', $param); $paramList[$vars[0]] = $vars[1]; } else { - $paramList[$param] = $result; + $paramList[$param] = $$param; } } } else { @@ -183,11 +189,15 @@ $paramList = null; } + print_r($paramList); + // Call the formatter if (is_callable($formatter)) { - $result = call_user_func_array($formatter, $paramList); + $result = call_user_func($formatter, $paramList); } else { - $result = new PEAR_Error('Unable to process formatter'); + //$result = new PEAR_Error('Unable to process formatter'); + $result = false; + PEAR::raiseError('Unable to process formatter', '1', PEAR_ERROR_TRIGGER); } return $result;

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