X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/8117acde82b62ec80191c2bcfbd7df5045345d21..6afa6384d2745cdd3de0d3a00c7b3ef06c2b9f98:/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 b4927fa..e454287 100644 --- a/lib/MECON/HTML/QuickForm/mdate.php +++ b/lib/MECON/HTML/QuickForm/mdate.php @@ -47,7 +47,7 @@ class MECON_HTML_QuickForm_mdate extends HTML_QuickForm_date { * @return void */ function MECON_HTML_QuickForm_mdate($elementName=null, $elementLabel=null, $options=array(), $attributes=null) { - $this->_options = array ('es' => array ( + $this->_locale = 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'), @@ -58,37 +58,26 @@ class MECON_HTML_QuickForm_mdate extends HTML_QuickForm_date { 'Octubre', 'Noviembre', 'Diciembre') ) ); - parent::HTML_QuickForm_date($elementName, $elementLabel, array_merge(array('language'=>'es','format'=>'d F Y'), $options), $attributes); } //end constructor - // }}} - // {{{ _createNumericOptionList() - - /** - * Creates a numeric option list based on a start number and end number - * - * @param int $start The start number - * @param int $end The end number - * - * @access public - * @return array An array of numeric options. - */ - function _createNumericOptionList($start, $end) { - $options = array(); - //TODO - //Verificar que esto este funcionando bien. - $options[''] = '--'; - //Hasta aca - for ($i = $start; $i <= $end; $i++) { + /** + * Creates an option list containing the numbers from the start number to the end, inclusive + * + * @param int The start number + * @param int The end number + * @param int Increment by this value + * @access private + * @return array An array of numeric options. + */ + function _createOptionList($start, $end, $step = 1) { + for ($i = $start, $options = array('' => '--'); $start > $end? $i >= $end: $i <= $end; $i += $step) { $options[$i] = sprintf('%02d', $i); } - return $options; - - } // end func _createNumericOptionList + } // end func _createOptionList /** * Devuelve un objeto date @@ -98,8 +87,14 @@ class MECON_HTML_QuickForm_mdate extends HTML_QuickForm_date { * @return object Date. */ 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'])); + + $date = parent::getValue(); + + if ($date['Y']) { + return new Date (@sprintf("%04d-%02d-%02d %02d:%02d:00", + $date['Y'], $date['F'], + $date['d'], $date['H'], + $date['i'])); } else { return null; }