MDL-18375 calendar: only display the YUI2 calendar when the Gregorian type is used

This commit is contained in:
Mark Nelson
2013-09-05 18:30:05 +08:00
parent 2f00e1b245
commit 29cb1e83b0
2 changed files with 20 additions and 10 deletions
+10 -5
View File
@@ -98,8 +98,10 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
}
}
}
// MDL-18375, Multi-Calendar Support
// form_init_date_js();
// The YUI2 calendar only supports the gregorian calendar type.
if (calendar_type_plugin_factory::get_calendar_type() === 'gregorian') {
form_init_date_js();
}
}
/**
@@ -123,10 +125,13 @@ 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'));
// The YUI2 calendar only supports the gregorian calendar type so only display the calendar image if this is being used.
if (calendar_type_plugin_factory::get_calendar_type() === 'gregorian') {
$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']) {
if ($this->_options['optional']) {
$this->_elements[] = @MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
}
foreach ($this->_elements as $element){
+10 -5
View File
@@ -100,8 +100,10 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
}
}
}
// MDL-18375, Multi-Calendar Support
// form_init_date_js();
// The YUI2 calendar only supports the gregorian calendar type.
if (calendar_type_plugin_factory::get_calendar_type() === 'gregorian') {
form_init_date_js();
}
}
/**
@@ -138,10 +140,13 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
$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);
}
$this->_elements[] = @MoodleQuickForm::createElement('image', 'calendar', $OUTPUT->pix_url('i/calendar', 'moodle'),
array('title' => get_string('calendar', 'calendar'), 'class' => 'visibleifjs'));
// The YUI2 calendar only supports the gregorian calendar type so only display the calendar image if this is being used.
if (calendar_type_plugin_factory::get_calendar_type() === 'gregorian') {
$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']) {
if ($this->_options['optional']) {
$this->_elements[] = @MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
}
foreach ($this->_elements as $element){