Merge branch 'MDL-46714-31-nadav' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE

This commit is contained in:
Andrew Nicols
2016-12-12 13:27:26 +08:00
2 changed files with 17 additions and 6 deletions
+4
View File
@@ -128,6 +128,10 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
$this->_elements = array();
$dateformat = $calendartype->get_date_order($this->_options['startyear'], $this->_options['stopyear']);
// Reverse date element (Day, Month, Year), in RTL mode.
if (right_to_left()) {
$dateformat = array_reverse($dateformat);
}
foreach ($dateformat as $key => $value) {
// E_STRICT creating elements without forms is nasty because it internally uses $this
$this->_elements[] = @MoodleQuickForm::createElement('select', $key, get_string($key, 'form'), $value, $this->getAttributes(), true);
+13 -6
View File
@@ -137,16 +137,23 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
$this->_elements = array();
$dateformat = $calendartype->get_date_order($this->_options['startyear'], $this->_options['stopyear']);
if (right_to_left()) { // Display time to the right of date, in RTL mode.
$this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'),
$minutes, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'),
$hours, $this->getAttributes(), true);
// Reverse date element (Should be: Day, Month, Year), in RTL mode.
$dateformat = array_reverse($dateformat);
}
foreach ($dateformat as $key => $date) {
// E_STRICT creating elements without forms is nasty because it internally uses $this
$this->_elements[] = @MoodleQuickForm::createElement('select', $key, get_string($key, 'form'), $date, $this->getAttributes(), true);
}
if (right_to_left()) { // Switch order of elements for Right-to-Left
$this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
} else {
$this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
if (!right_to_left()) { // Display time to the left of date, in LTR mode.
$this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours,
$this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes,
$this->getAttributes(), true);
}
// The YUI2 calendar only supports the gregorian calendar type so only display the calendar image if this is being used.
if ($calendartype->get_name() === 'gregorian') {