1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
2 -------------------------------------------------------------------------------
5 -------------------------------------------------------------------------------
6 This file is part of meconlib.
8 meconlib is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2 of the License, or (at your option)
13 meconlib is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License; if not,
18 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 Boston, MA 02111-1307 USA
20 -------------------------------------------------------------------------------
21 Creado: mié jun 18 15:08:05 ART 2003
22 Autor: Leandro Lucarella <llucar@mecon.gov.ar>
23 -------------------------------------------------------------------------------
25 -----------------------------------------------------------------------------*/
27 require_once 'HTML/QuickForm.php';
28 require_once 'MECON/HTML/QuickForm/Renderer/Tabla.php';
29 require_once 'MECON/HTML/QuickForm/Renderer/Tabla_Servicios.php';
32 * QuickForm de uso general del MECON.
34 class MECON_HTML_QuickForm extends HTML_QuickForm {
35 var $_rendererOpts = array();
36 var $_renderer = 'MECON_HTML_QuickForm_Renderer_Tabla';
37 // var $_renderer = 'MECON_HTML_QuickForm_Renderer_Tabla()';
38 function MECON_HTML_QuickForm($formName='', $method='post', $action='', $target='_self', $attributes=null)
40 parent::HTML_QuickForm($formName, $method, $action, $target, $attributes);
41 $this->registerElementType('mdate', 'MECON/HTML/QuickForm/mdate.php', 'HTML_QuickForm_mdate');
42 $this->registerRule('fecha', 'function', 'validate', 'HTML_QuickForm_mdate');
43 $this->setRequiredNote('<FONT color="red">*</FONT> indica un campo obligatorio');
44 $this->setJsWarnings('Hay errores en el formulario:', 'Por favor corríjalos antes de continuar.');
46 function addRule($element, $message, $type, $format='', $validation='client', $reset = false, $force = false)
48 parent::addRule($element, $message, $type, $format, $validation, $reset, $force);
50 function addGroupRule($group, $arg1, $type='', $format='', $howmany=0, $validation = 'client')
52 parent::addGroupRule($group, $arg1, $type, $format, $howmany, $validation);
57 //TODO ver porque no puedo utilizar $this->_renderer en el new -> es lo
59 switch ($this->_renderer) {
60 case 'MECON_HTML_QuickForm_Renderer_Tabla':
61 $renderer =& new MECON_HTML_QuickForm_Renderer_Tabla($this->_rendererOpts);
63 case 'MECON_HTML_QuickForm_Renderer_Tabla_Servicios':
64 $renderer =& new MECON_HTML_QuickForm_Renderer_Tabla_Servicios($this->_rendererOpts);
67 // $renderer =& new $this->_renderer ($this->_rendererOpts);
69 $this->accept($renderer);
70 return $renderer->toHtml();
72 function setRendererOpts($opts) {
73 $this->_rendererOpts = $opts;
75 function getRendererOpts($opts) {
76 return $this->_rendererOpts;;
78 function updateRendererOpts($opts) {
79 $this->_rendererOpts = array_merge($this->_rendererOpts, $opts);
82 //AGREGADO POR mmarre PARA PODER DECIDIR CUAL DE NUESTROS RENDERES UTILIZAR
83 //Por defecto utiliza el renderer que deja las tablas como estaban en un
85 function setRenderer($renderer = 'MECON_HTML_QuickForm_Renderer_Tabla') {
86 $this->_renderer = $renderer;
87 // $this->_renderer = $renderer.'()';