X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/b7813682506abf93255b3cbd925cf09b3c241fe2..8ae80b160316912d9ad8b1e286a452144be5f814:/HTML/php/QuickForm/mdate.php diff --git a/HTML/php/QuickForm/mdate.php b/HTML/php/QuickForm/mdate.php index d5a3999..9a54ae8 100644 --- a/HTML/php/QuickForm/mdate.php +++ b/HTML/php/QuickForm/mdate.php @@ -28,6 +28,8 @@ require_once('HTML/QuickForm/date.php'); +require_once('Date.php'); +require_once('Validate.php'); /** * Class to dynamically create HTML Select elements from a date @@ -87,5 +89,36 @@ class HTML_QuickForm_mdate extends HTML_QuickForm_date return $options; } // end func _createNumericOptionList + + /** + * Devuelve un objeto date + * + * + * @access public + * @return object Date. + */ + function &getValue() + { + if ($this->_selectedDate['Y'] != 00) { + 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 + + /** + * Verifica que una fecha sea valida. + * + * Verifica que una fecha sea valida. El formato siempre debe ser + * '%Y-%m-%d' + * + * @access public + * @return bool + */ + function validate($nombre, $valor, $formato = '') + { + return Validate::date($valor['F'].'-'.$valor['d'].'-'.$valor['Y'],array('format' => '%Y-%m-%d')); + } // end func validate } ?>