Skip to content

Commit 65892a5

Browse files
committed
add keeplocalcopy setting element to forms
1 parent ec00528 commit 65892a5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

mod_form.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ public function definition() {
6666
$mform->addElement('select', 'deliveryoption', get_string('deliveryoptions', 'customcert'), $deliveryoptions);
6767
$mform->setDefault('deliveryoption', certificate::DELIVERY_OPTION_INLINE);
6868

69+
if (has_capability('mod/customcert:managekeeplocalcopy', $this->get_context())) {
70+
$mform->addElement('selectyesno', 'keeplocalcopy', get_string('keeplocalcopy', 'customcert'));
71+
$mform->setDefault('keeplocalcopy', get_config('customcert', 'keeplocalcopy'));
72+
$mform->addHelpButton('keeplocalcopy', 'keeplocalcopy', 'customcert');
73+
$mform->setType('keeplocalcopy', PARAM_INT);
74+
}
75+
6976
if (has_capability('mod/customcert:manageemailstudents', $this->get_context())) {
7077
$mform->addElement('selectyesno', 'emailstudents', get_string('emailstudents', 'customcert'));
7178
$mform->setDefault('emailstudents', get_config('customcert', 'emailstudents'));
@@ -207,6 +214,7 @@ public function validation($data, $files) {
207214
*/
208215
protected function get_options_elements_with_required_caps() {
209216
return [
217+
'keeplocalcopy' => 'mod/customcert:managekeeplocalcopy',
210218
'emailstudents' => 'mod/customcert:manageemailstudents',
211219
'emailteachers' => 'mod/customcert:manageemailteachers',
212220
'emailothers' => 'mod/customcert:manageemailothers',

settings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
1 => get_string('yes'),
6060
];
6161

62+
$settings->add(new admin_setting_configselect('customcert/keeplocalcopy',
63+
get_string('keeplocalcopy', 'customcert'), get_string('keeplocalcopy_help', 'customcert'), 0, $yesnooptions));
6264
$settings->add(new admin_setting_configselect('customcert/emailstudents',
6365
get_string('emailstudents', 'customcert'), get_string('emailstudents_help', 'customcert'), 0, $yesnooptions));
6466
$settings->add(new admin_setting_configselect('customcert/emailteachers',

0 commit comments

Comments
 (0)