--- /dev/null
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4:
+// +--------------------------------------------------------------------+
+// | Ministerio de Economía |
+// | QuickForm Tabla Renderer |
+// +--------------------------------------------------------------------+
+// | This file is part of AI. |
+// | |
+// | This program is free software; you can redistribute it and/or |
+// | modify it under the terms of the GNU General Public License as |
+// | published by the Free Software Foundation; either version 2 of the |
+// | License, or (at your option) any later version. |
+// | |
+// | This program is distributed in the hope that it will be useful, |
+// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with Hooks; if not, write to the Free Software Foundation, |
+// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+// +--------------------------------------------------------------------+
+// | Creado: Tue Jun 24 16:22:07 2003 |
+// | Autor: Leandro Lucarella <llucar@mecon.gov.ar> |
+// +--------------------------------------------------------------------+
+//
+// $Id$
+//
+
+require_once 'HTML/QuickForm.php';
+
+/**
+ * QuickForm de uso general del MECON.
+ */
+class MECON_HTML_QuickForm extends HTML_QuickForm {
+ 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('<FONT color="red">*</FONT> indica un campo obligatorio');
+ }
+}
+
+?>
<BODY>
<?
- require_once 'HTML/QuickForm.php';
- require_once 'HTML/QuickForm/Renderer/Tabla.php';
+ require_once 'MECON/HTML/QuickForm.php';
+ require_once 'MECON/HTML/QuickForm/Renderer/Tabla.php';
- $form = new HTML_QuickForm ('test', 'POST', $_SERVER['PHP_SELF']);
-
- $form->setRequiredNote('<FONT color="red">*</FONT> indica un campo obligatorio');
+ $form = new MECON_HTML_QuickForm('test');
//Agrega los elementos comunes a todas las opciones
$form->addElement('header','cabecera', 'Título del formulario');
- $form->addElement('text', 'nombre_sistema', 'Nombre',array('size' => '30'));
- $form->addElement('textarea', 'desc_sistema', 'Descripción',array('rows' => '2','cols'=>'50'));
- $form->addElement('textarea', 'contacto', 'Contacto',array('rows' => '2','cols'=>'50'));
- $form->addElement('date', 'fecha_implementacion', 'Fecha Implementación', array('language'=>'es','format'=>'d F Y'));
+ $form->addElement('text', 'nombre_sistema', 'Nombre', array('size' => '30'));
+ $form->addElement('textarea', 'desc_sistema', 'Descripción', array('rows' => '2','cols'=>'50'));
+ $form->addElement('textarea', 'contacto', 'Contacto', array('rows' => '2','cols'=>'50'));
+ $form->addElement('mdate', 'fecha', 'Fecha Implementación', array('language'=>'es','format'=>'d F Y'));
// Agrego un grupo de prueba separado por <BR>s.
$grupo = array();
- $grupo[] =& HTML_QuickForm::createElement('date', 'desde', 'Desde', array('language'=>'es','format'=>'d F Y'));
- $grupo[] =& HTML_QuickForm::createElement('date', 'hasta', 'Hasta', array('language'=>'es','format'=>'d F Y'));
+ $grupo[] =& HTML_QuickForm::createElement('mdate', 'desde', 'Desde', array('language'=>'es','format'=>'d F Y'));
+ $grupo[] =& HTML_QuickForm::createElement('mdate', 'hasta', 'Hasta', array('language'=>'es','format'=>'d F Y'));
$form->addGroup($grupo, 'fecha', 'Intervalo', '<BR>', true);
// Agrega otro groupo de prueba, separado por un espacio.
$grupo = array();
$form->addRule('nombre_sistema', 'El campo nombre debe ser numerico', 'numeric', '', 'client');
$form->addRule('desc_sistema', 'El campo descripcion es obligatorio', 'required', '', 'client');
$form->addRule('contacto', 'El campo contacto es obligatorio', 'required', '', 'client');
+ $form->addRule('fecha', 'El campo desde no es obligatorio', 'fecha', '', 'client');
+ $form->addRule('desde', 'El campo desde no es obligatorio', 'fecha', '', 'client');
+ $form->addRule('hasta', 'El campo desde no es obligatorio', 'fecha', '', 'client');
+ $form->addRule('fecha', 'El campo desde no es obligatorio', 'required', '', 'client');
// Cambia el formulario dependiendo de la accion que se quiera tomar.
if (@$_REQUEST['accion']) {