X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/71acf4950362871b3ad6bc168d08db422edf0509..b371ffddb6dbdf292f496845e4b27d83bd70fa3f:/lib/MECON/HTML/QuickForm/mdate.php?ds=sidebyside diff --git a/lib/MECON/HTML/QuickForm/mdate.php b/lib/MECON/HTML/QuickForm/mdate.php index 6e5a8d3..a261647 100644 --- a/lib/MECON/HTML/QuickForm/mdate.php +++ b/lib/MECON/HTML/QuickForm/mdate.php @@ -4,12 +4,12 @@ meconlib ------------------------------------------------------------------------------- This file is part of meconlib. - + meconlib 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. - + meconlib 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. @@ -33,8 +33,7 @@ require_once 'Validate.php'; * Modificado para que cumpla con los requisitos de mecon * */ -class HTML_QuickForm_mdate extends HTML_QuickForm_date -{ +class MECON_HTML_QuickForm_mdate extends HTML_QuickForm_date { // {{{ constructor /** @@ -47,19 +46,22 @@ class HTML_QuickForm_mdate extends HTML_QuickForm_date * @access public * @return void */ - function HTML_QuickForm_mdate($elementName=null, $elementLabel=null, $options=array(), $attributes=null) - { + function MECON_HTML_QuickForm_mdate($elementName=null, $elementLabel=null, $options=array(), $attributes=null) { $this->_options = array ('es' => array ( - 'weekdays_short'=> array ('' => '--', 'Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'), - 'weekdays_long' => array ('' => '--', 'Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'), - 'months_short' => array ('' => '--', 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'), - 'months_long' => array ('' => '--', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septimbre', 'Octubre', 'Noviembre', 'Diciembre') - ) - ); - + 'weekdays_short'=> array ('' => '--', 'Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'), + 'weekdays_long' => array ('' => '--', 'Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'), + 'months_short' => array ('' => '--', 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'), + 'months_long' => array ('' => '--', + 'Enero', 'Febrero', 'Marzo', + 'Abril', 'Mayo', 'Junio', + 'Julio', 'Agosto', 'Septiembre', + 'Octubre', 'Noviembre', 'Diciembre') + ) + ); + parent::HTML_QuickForm_date($elementName, $elementLabel, - array_merge(array('language'=>'es','format'=>'d F Y'), $options), - $attributes); + array_merge(array('language'=>'es','format'=>'d F Y'), $options), + $attributes); } //end constructor // }}} @@ -74,19 +76,18 @@ class HTML_QuickForm_mdate extends HTML_QuickForm_date * @access public * @return array An array of numeric options. */ - function _createNumericOptionList($start, $end) - { + function _createNumericOptionList($start, $end) { $options = array(); - //TODO + //TODO //Verificar que esto este funcionando bien. $options[''] = '--'; //Hasta aca for ($i = $start; $i <= $end; $i++) { $options[$i] = sprintf('%02d', $i); } - + return $options; - + } // end func _createNumericOptionList /** @@ -96,12 +97,10 @@ class HTML_QuickForm_mdate extends HTML_QuickForm_date * @access public * @return object Date. */ - function &getValue() - { + function &getValue() { if ($this->_selectedDate['Y']) { - return new Date (sprintf("%04d-%02d-%02d 00:00:00",$this->_selectedDate['Y'],$this->_selectedDate['F'],$this->_selectedDate['d'])); - } - else { + return new Date (@sprintf("%04d-%02d-%02d 00:00:00", $this->_selectedDate['Y'], $this->_selectedDate['F'], $this->_selectedDate['d'])); + } else { return null; } } // end func getValue @@ -115,17 +114,18 @@ class HTML_QuickForm_mdate extends HTML_QuickForm_date * @access public * @return bool */ - function validate($valor, $nombre, $formato = '') - { + function validate($valor, $nombre, $formato = '') { // Si viene completamente lleno, se valida con el paquete Validate. if ($valor['Y'] and $valor['d'] and $valor['F']) { $str = sprintf('%4d-%02d-%02d', $valor['Y'], $valor['F'], $valor['d']); return Validate::date($str, array('format' => '%Y-%m-%d')); - // Si viene completamente vacio, es valido. - } elseif (!$valor['Y'] and !$valor['d'] and !$valor['F']) { + // Si viene completamente vacio, es valido. + } + elseif (!$valor['Y'] and !$valor['d'] and !$valor['F']) { return true; - // Si viene a medio completar, es invalido. - } else { + // Si viene a medio completar, es invalido. + } + else { return false; } } // end func validate