MDL-55804 forms: Return exported data through _prepareValue

This commit is contained in:
David Monllao
2016-09-27 08:12:08 +08:00
parent 6aec209125
commit 8b27687b5f
5 changed files with 9 additions and 13 deletions
+3 -5
View File
@@ -285,7 +285,6 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
* @return array
*/
function exportValue(&$submitValues, $assoc = false) {
$value = null;
$valuearray = array();
foreach ($this->_elements as $element){
$thisexport = $element->exportValue($submitValues[$this->getName()], true);
@@ -297,8 +296,7 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
if($this->_options['optional']) {
// If checkbox is on, the value is zero, so go no further
if(empty($valuearray['enabled'])) {
$value[$this->getName()] = 0;
return $value;
return $this->_prepareValue(0, $assoc);
}
}
// Get the calendar type used - see MDL-18375.
@@ -308,7 +306,7 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
$valuearray['day'],
$valuearray['hour'],
$valuearray['minute']);
$value[$this->getName()] = make_timestamp($gregoriandate['year'],
$value = make_timestamp($gregoriandate['year'],
$gregoriandate['month'],
$gregoriandate['day'],
$gregoriandate['hour'],
@@ -317,7 +315,7 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
$this->_options['timezone'],
true);
return $value;
return $this->_prepareValue($value, $assoc);
} else {
return null;
}