cvs: pear /HTML_QuickForm/QuickForm date.php
| From: | Alexey Borzov | Date: | Wed, 25 Jun 2003 19:35:39 +0000 |
| Subject: | cvs: pear /HTML_QuickForm/QuickForm date.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-11170@lists.php.net to get a copy of this message | ||
avb Wed Jun 25 15:35:39 2003 EDT
Modified files:
/pear/HTML_QuickForm/QuickForm date.php
Log:
* Fix: selects for minutes and seconds now start from 0, not 1 (reported by Arthur van Dam)
* implemented setValue(), getValue() and exportValue() methods
Index: pear/HTML_QuickForm/QuickForm/date.php
diff -u pear/HTML_QuickForm/QuickForm/date.php:1.24 pear/HTML_QuickForm/QuickForm/date.php:1.25
--- pear/HTML_QuickForm/QuickForm/date.php:1.24 Fri May 23 14:00:26 2003
+++ pear/HTML_QuickForm/QuickForm/date.php Wed Jun 25 15:35:39 2003
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: date.php,v 1.24 2003/05/23 18:00:26 jrust Exp $
+// $Id: date.php,v 1.25 2003/06/25 19:35:39 avb Exp $
require_once('HTML/QuickForm/element.php');
require_once('HTML/QuickForm/select.php');
@@ -356,10 +356,10 @@
$options = $this->_createNumericOptionList(0, 23);
break;
case 'i':
- $options = $this->_createNumericOptionList(1, 59);
+ $options = $this->_createNumericOptionList(0, 59);
break;
case 's':
- $options = $this->_createNumericOptionList(1, 59);
+ $options = $this->_createNumericOptionList(0, 59);
break;
case 'a':
$options = array('am' => 'am', 'pm' =>
'pm');
@@ -504,6 +504,48 @@
}
return true;
} // end func onQuickFormEvent
+
+ // }}}
+ // {{{ setValue()
+
+ function setValue($value)
+ {
+ $this->setSelectedDate($value);
+ }
+
+ // }}}
+ // {{{ getValue()
+
+ function getValue()
+ {
+ return $this->_selectedDate;
+ }
+
+ // }}}
+ // {{{ exportValue()
+
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $this->_createSelects();
+ $value = null;
+ foreach (array_keys($this->dateSelect) as $key) {
+ // selects have string keys, separators have numeric ones
+ if (is_string($key)) {
+ $v = $this->dateSelect[$key]->exportValue($submitValues, $assoc);
+ if (null !== $v) {
+ if (null === $value) {
+ $value = array();
+ }
+ if ($assoc) {
+ $value = @array_merge_recursive($value, $v);
+ } else {
+ $value[$key] = $v;
+ }
+ }
+ }
+ }
+ return $value;
+ }
// }}}
} // end class HTML_QuickForm_date