From: Gonzalo Merayo Date: Wed, 2 Jul 2003 19:54:00 +0000 (+0000) Subject: Se hace que MECON_HTML_QuickForm use por defecto el Renderer de Tabla. X-Git-Tag: svn_import~413 X-Git-Url: https://git.llucax.com/mecon/meconlib.git/commitdiff_plain/84f4d19441dd0a757010a623b50cfe1b0c553f3b?ds=sidebyside Se hace que MECON_HTML_QuickForm use por defecto el Renderer de Tabla. --- diff --git a/lib/MECON/HTML/QuickForm.php b/lib/MECON/HTML/QuickForm.php index 560ad60..7258df1 100644 --- a/lib/MECON/HTML/QuickForm.php +++ b/lib/MECON/HTML/QuickForm.php @@ -28,11 +28,13 @@ // require_once 'HTML/QuickForm.php'; +require_once 'MECON/HTML/QuickForm/Renderer/Tabla.php'; /** * QuickForm de uso general del MECON. */ class MECON_HTML_QuickForm extends HTML_QuickForm { + var $_rendererOpts = array(); function MECON_HTML_QuickForm($formName='', $method='post', $action='', $target='_self', $attributes=null) { parent::HTML_QuickForm($formName, $method, $action, $target, $attributes); @@ -48,6 +50,20 @@ class MECON_HTML_QuickForm extends HTML_QuickForm { { parent::addGroupRule($group, $arg1, $type, $format, $howmany, $validation); } + function toHtml() { + $renderer =& new MECON_HTML_QuickForm_Renderer_Tabla($this->_rendererOpts); + $this->accept($renderer); + return $renderer->toHtml(); + } + function setRendererOpts($opts) { + $this->_rendererOpts = $opts; + } + function getRendererOpts($opts) { + return $this->_rendererOpts;; + } + function updateRendererOpts($opts) { + $this->_rendererOpts = array_merge($this->_rendererOpts, $opts); + } } ?> diff --git a/lib/MECON/HTML/QuickForm/Renderer/Tabla.php b/lib/MECON/HTML/QuickForm/Renderer/Tabla.php index ee3083c..2a82680 100644 --- a/lib/MECON/HTML/QuickForm/Renderer/Tabla.php +++ b/lib/MECON/HTML/QuickForm/Renderer/Tabla.php @@ -29,7 +29,7 @@ require_once 'MECON/HTML/Tabla.php'; * * @access public */ -class HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer { +class MECON_HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer { /** * Tabla usada para dibujar el formulario. @@ -88,7 +88,7 @@ class HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer { * * @access public */ - function HTML_QuickForm_Renderer_Tabla($style = array('width' => '100%')) + function MECON_HTML_QuickForm_Renderer_Tabla($style = array()) { $this->HTML_QuickForm_Renderer(); $this->_tabla =& new Tabla($style); diff --git a/lib/MECON/HTML/Tabla.php b/lib/MECON/HTML/Tabla.php index 3f31b1b..f764ba9 100644 --- a/lib/MECON/HTML/Tabla.php +++ b/lib/MECON/HTML/Tabla.php @@ -260,8 +260,7 @@ class Tabla extends HTML_Table { // Agregar la tabla de fondo. if ($simple == 0) { $tmp = $this->_parseAttributes($this->_conf['atributos']['tabla_contenedora']); - $tmp['width'] = $this->_attrs['width']; - $tabla_externa = new HTML_Table($tmp); + $tabla_externa = new HTML_Table(array('width' => '100%')); $tabla_externa->setCellContents(0, 0, parent::toHtml()); $tabla_externa->setCellAttributes(0, 0, $this->_conf['atributos']['celda_contenedora']); $result = $tabla_externa->toHtml(); diff --git a/test/HTML/prueba_html_quickform_renderer_tabla.php b/test/HTML/prueba_html_quickform_renderer_tabla.php index e6e5117..7707dc0 100644 --- a/test/HTML/prueba_html_quickform_renderer_tabla.php +++ b/test/HTML/prueba_html_quickform_renderer_tabla.php @@ -1,13 +1,12 @@ Prueba de renderer - + accept($renderer); - echo $renderer->toHtml(); + echo $form->toHtml(); ?>