MDl-36352 Calendar: Poll interval will be disabled for calendar file import

This commit is contained in:
Rajesh Taneja
2012-11-16 15:55:45 +08:00
parent 8ccaa296fa
commit 3e2efe3b05
+5 -3
View File
@@ -63,9 +63,6 @@ class calendar_addsubscription_form extends moodleform {
// Import file
$mform->addElement('filepicker', 'importfile', get_string('importfromfile', 'calendar'));
$mform->disabledIf('url', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_FILE);
$mform->disabledIf('importfile', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_URL);
// Poll interval
$choices = calendar_get_pollinterval_choices();
$mform->addElement('select', 'pollinterval', get_string('pollinterval', 'calendar'), $choices);
@@ -73,6 +70,11 @@ class calendar_addsubscription_form extends moodleform {
$mform->addHelpButton('pollinterval', 'pollinterval', 'calendar');
$mform->setType('pollinterval', PARAM_INT);
// Disable appropriate elements depending on import from value.
$mform->disabledIf('pollinterval', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_FILE);
$mform->disabledIf('url', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_FILE);
$mform->disabledIf('importfile', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_URL);
// Eventtype: 0 = user, 1 = global, anything else = course ID.
list($choices, $groups) = calendar_get_eventtype_choices($courseid);
$mform->addElement('select', 'eventtype', get_string('eventkind', 'calendar'), $choices);