MDL-40008 forms: fixed ordering of the calendar icon and enable checkbox for the date selector element

This commit is contained in:
Mark Nelson 2013-06-04 11:55:48 +08:00
parent b6f8a93642
commit 85c402a89d

View File

@ -119,12 +119,12 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group
$this->_elements[] = @MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('image', 'calendar', $OUTPUT->pix_url('i/calendar', 'moodle'),
array('title' => get_string('calendar', 'calendar'), 'class' => 'visibleifjs'));
// If optional we add a checkbox which the user can use to turn if on
if($this->_options['optional']) {
$this->_elements[] = @MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
}
$this->_elements[] = @MoodleQuickForm::createElement('image', 'calendar', $OUTPUT->pix_url('i/calendar', 'moodle'),
array('title' => get_string('calendar', 'calendar'), 'class' => 'visibleifjs'));
foreach ($this->_elements as $element){
if (method_exists($element, 'setHiddenLabel')){
$element->setHiddenLabel(true);