cvs: pear /Structures_DataGrid/DataGrid/Renderer XML.php
| From: | Mark Wiesemann | Date: | Tue, 28 Feb 2006 11:02:10 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid/Renderer XML.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38737@lists.php.net to get a copy of this message | ||
wiesemann Tue Feb 28 11:02:10 2006 UTC
Modified files:
/pear/Structures_DataGrid/DataGrid/Renderer XML.php
Log:
- more flexibility for this renderer
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/Renderer/XML.php?r1=1.20&r2=1.21&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/Renderer/XML.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/XML.php:1.20
pear/Structures_DataGrid/DataGrid/Renderer/XML.php:1.21
--- pear/Structures_DataGrid/DataGrid/Renderer/XML.php:1.20 Tue Feb 28 10:53:25 2006
+++ pear/Structures_DataGrid/DataGrid/Renderer/XML.php Tue Feb 28 11:02:10 2006
@@ -18,7 +18,7 @@
// | Mark Wiesemann <wiesemann@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: XML.php,v 1.20 2006/02/28 10:53:25 wiesemann Exp $
+// $Id: XML.php,v 1.21 2006/02/28 11:02:10 wiesemann Exp $
require_once 'Structures/DataGrid/Renderer/Common.php';
require_once 'XML/Util.php';
@@ -26,13 +26,20 @@
/**
* Structures_DataGrid_Renderer_XML Class
*
- * @version $Revision: 1.20 $
+ * @version $Revision: 1.21 $
* @author Andrew S. Nagy <asnagy@webitecture.org>
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Mark Wiesemann <wiesemann@php.net>
* @access public
* @package Structures_DataGrid
* @category Structures
+ *
+ * Recognized options:
+ *
+ * - outerTag: (string) The name of the tag for the datagrid (without brackets)
+ * (default: 'DataGrid')
+ * - rowTag: (string) The name of the tag for each row (without brackets)
+ * (default: 'Row')
*/
class Structures_DataGrid_Renderer_XML extends Structures_DataGrid_Renderer_Common
{
@@ -47,6 +54,12 @@
function Structures_DataGrid_Renderer_XML()
{
parent::Structures_DataGrid_Renderer_Common();
+ $this->_addDefaultOptions(
+ array(
+ 'outerTag' => 'DataGrid',
+ 'rowTag' => 'Row'
+ )
+ );
}
/**
@@ -82,18 +95,18 @@
{
$xml = XML_Util::getXMLDeclaration() . "\n";
- $xml .= "<DataGrid>\n";
+ $xml .= "<{$this->_options['outerTag']}>\n";
for ($row = 0; $row < $this->_recordsNum; $row++) {
- $xml .= " <Row>\n";
+ $xml .= " <{$this->_options['rowTag']}>\n";
for ($col = 0; $col < $this->_columnsNum; $col++) {
$value = $this->_records[$row][$col];
$field = $this->_columns[$col]['field'];
$xml .= ' ' . XML_Util::createTag($field, null, $value) .
"\n";
}
- $xml .= " </Row>\n";
+ $xml .= " </{$this->_options['rowTag']}>\n";
}
- $xml .= "</DataGrid>\n";
+ $xml .= "</{$this->_options['outerTag']}>\n";
$this->_container .= $xml;
}