]> git.llucax.com Git - mecon/meconlib.git/blobdiff - HTML/php/QuickForm/mdate.php
(no commit message)
[mecon/meconlib.git] / HTML / php / QuickForm / mdate.php
index 18b3f6c0bd03825790624aa3c57f7bb9594b555d..9a54ae80137c939e095cd93469a6abdc93bfcbb0 100644 (file)
@@ -29,6 +29,7 @@
 
 require_once('HTML/QuickForm/date.php');
 require_once('Date.php');
 
 require_once('HTML/QuickForm/date.php');
 require_once('Date.php');
+require_once('Validate.php');
 
 /**
  * Class to dynamically create HTML Select elements from a date
 
 /**
  * Class to dynamically create HTML Select elements from a date
@@ -98,7 +99,26 @@ class HTML_QuickForm_mdate extends HTML_QuickForm_date
      */
     function &getValue()
     {
      */
     function &getValue()
     {
-        return new Date (sprintf("%04d/%02d/%02d 00:00:00",$this->_selectedDate['y'],$this->_selectedDate['m'],$this->_selectedDate['d']));
-    } // end func _createNumericOptionList
+        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
 }
 ?>
 }
 ?>