protected function add_event_duration_elements($mform) {
        $group = [];
        $group[] = $mform->createElement('radio', 'duration', null, get_string('durationnone', 'calendar'), 0);
        $group[] = $mform->createElement('radio', 'duration', null, get_string('durationuntil', 'calendar'), 1);
        $group[] = $mform->createElement('date_time_selector', 'timedurationuntil', '');
        $group[] = $mform->createElement('radio', 'duration', null, get_string('durationminutes', 'calendar'), 2);
        $group[] = $mform->createElement('text', 'timedurationminutes', get_string('durationminutes', 'calendar'));

        $mform->addGroup($group, 'durationgroup', get_string('eventduration', 'calendar'), '<br />', false);
        $mform->setAdvanced('durationgroup');

        $mform->disabledIf('timedurationuntil',         'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[day]',    'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[month]',  'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[year]',   'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[hour]',   'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[minute]', 'duration', 'noteq', 1);

        $mform->setType('timedurationminutes', PARAM_INT);
        $mform->disabledIf('timedurationminutes', 'duration', 'noteq', 2);

        $mform->setDefault('duration', 0);
    }
protected function add_event_duration_elements($mform) {
        $group = [];
        $group[] = $mform->createElement('radio', 'duration', null, get_string('durationnone', 'calendar'), 0);
        $group[] = $mform->createElement('radio', 'duration', null, get_string('durationuntil', 'calendar'), 1);
        $group[] = $mform->createElement('date_time_selector', 'timedurationuntil', '');
        $group[] = $mform->createElement('radio', 'duration', null, get_string('durationminutes', 'calendar'), 2);
        $group[] = $mform->createElement('text', 'timedurationminutes', get_string('durationminutes', 'calendar'));

        $mform->addGroup($group, 'durationgroup', get_string('eventduration', 'calendar'), '<br />', false);
        $mform->setAdvanced('durationgroup');

        $mform->disabledIf('timedurationuntil',         'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[day]',    'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[month]',  'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[year]',   'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[hour]',   'duration', 'noteq', 1);
        $mform->disabledIf('timedurationuntil[minute]', 'duration', 'noteq', 1);

        $mform->setType('timedurationminutes', PARAM_INT);
        $mform->disabledIf('timedurationminutes', 'duration', 'noteq', 2);

        $mform->setDefault('duration', 0);
    }
protected function add_event_duration_elements ( $ mform ) { $ group = [ ] ; $ group [ ] = $ mform -> createElement ( 'radio' , 'duration' , null , get_string ( 'durationnone' , 'calendar' ) , 0 ) ; $ group [ ] = $ mform -> createElement ( 'radio' , 'duration' , null , get_string ( 'durationuntil' , 'calendar' ) , 1 ) ; $ group [ ] = $ mform -> createElement ( 'date_time_selector' , 'timedurationuntil' , '' ) ; $ group [ ] = $ mform -> createElement ( 'radio' , 'duration' , null , get_string ( 'durationminutes' , 'calendar' ) , 2 ) ; $ group [ ] = $ mform -> createElement ( 'text' , 'timedurationminutes' , get_string ( 'durationminutes' , 'calendar' ) ) ; $ mform -> addGroup ( $ group , 'durationgroup' , get_string ( 'eventduration' , 'calendar' ) , '<br />' , false ) ; $ mform -> setAdvanced ( 'durationgroup' ) ; $ mform -> disabledIf ( 'timedurationuntil' , 'duration' , 'noteq' , 1 ) ; $ mform -> disabledIf ( 'timedurationuntil[day]' , 'duration' , 'noteq' , 1 ) ; $ mform -> disabledIf ( 'timedurationuntil[month]' , 'duration' , 'noteq' , 1 ) ; $ mform -> disabledIf ( 'timedurationuntil[year]' , 'duration' , 'noteq' , 1 ) ; $ mform -> disabledIf ( 'timedurationuntil[hour]' , 'duration' , 'noteq' , 1 ) ; $ mform -> disabledIf ( 'timedurationuntil[minute]' , 'duration' , 'noteq' , 1 ) ; $ mform -> setType ( 'timedurationminutes' , PARAM_INT ) ; $ mform -> disabledIf ( 'timedurationminutes' , 'duration' , 'noteq' , 2 ) ; $ mform -> setDefault ( 'duration' , 0 ) ; }
Add the various elements to express the duration options available
for an event.

@param MoodleQuickForm $mform
Add the various elements to express the duration options available for an event .