X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/7f336c0bd2baf96080346d3ed06812cf45948f3a..d8d1303e69f2b5f4a495c128cc70ca0b78d7d3ce:/lib/MECON/HTML/QuickForm.php diff --git a/lib/MECON/HTML/QuickForm.php b/lib/MECON/HTML/QuickForm.php index 407e5c9..a6310db 100644 --- a/lib/MECON/HTML/QuickForm.php +++ b/lib/MECON/HTML/QuickForm.php @@ -1,45 +1,86 @@ - | -// +--------------------------------------------------------------------+ -// -// $Id$ -// + +------------------------------------------------------------------------------- +$Id$ +-----------------------------------------------------------------------------*/ require_once 'HTML/QuickForm.php'; +require_once 'MECON/HTML/QuickForm/Renderer/Tabla.php'; +require_once 'MECON/HTML/QuickForm/Renderer/Tabla_Servicios.php'; /** * QuickForm de uso general del MECON. */ class MECON_HTML_QuickForm extends HTML_QuickForm { + var $_rendererOpts = array(); + var $_renderer = 'MECON_HTML_QuickForm_Renderer_Tabla'; function MECON_HTML_QuickForm($formName='', $method='post', $action='', $target='_self', $attributes=null) { parent::HTML_QuickForm($formName, $method, $action, $target, $attributes); $this->registerElementType('mdate', 'MECON/HTML/QuickForm/mdate.php', 'HTML_QuickForm_mdate'); $this->registerRule('fecha', 'function', 'validate', 'HTML_QuickForm_mdate'); $this->setRequiredNote('* indica un campo obligatorio'); + $this->setJsWarnings('Hay errores en el formulario:', 'Por favor corríjalos antes de continuar.'); + } + function addRule($element, $message, $type, $format='', $validation='client', $reset = false, $force = false) + { + parent::addRule($element, $message, $type, $format, $validation, $reset, $force); } + function addGroupRule($group, $arg1, $type='', $format='', $howmany=0, $validation = 'client') + { + parent::addGroupRule($group, $arg1, $type, $format, $howmany, $validation); + } + function toHtml() { + + switch ($this->_renderer) { + case 'MECON_HTML_QuickForm_Renderer_Tabla': + $renderer =& new MECON_HTML_QuickForm_Renderer_Tabla($this->_rendererOpts); + break; + case 'MECON_HTML_QuickForm_Renderer_Tabla_Servicios': + $renderer =& new MECON_HTML_QuickForm_Renderer_Tabla_Servicios($this->_rendererOpts); + break; + } + + $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); + } + + //AGREGADO POR mmarre PARA PODER DECIDIR CUAL DE NUESTROS RENDERES UTILIZAR + //Por defecto utiliza el renderer que deja las tablas como estaban en un + //principio. + function setRenderer($renderer = 'MECON_HTML_QuickForm_Renderer_Tabla') { + $this->_renderer = $renderer; + } + } -?> +?> \ No newline at end of file