-
Notifications
You must be signed in to change notification settings - Fork 2
/
migrate_form.php
27 lines (22 loc) · 915 Bytes
/
migrate_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once("$CFG->libdir/formslib.php");
class migrate_form extends moodleform {
// Define the form elements.
protected function definition() {
$mform = $this->_form;
$context = $this->_customdata['context'];
$options = [
'' => get_string('choosedots'), // Default "Choose..." option.
];
if (!empty($records = \tool_certificate\permission::get_visible_templates($context))) {
foreach ($records as $record) {
$options[$record->id] = format_string($record->name);
}
}
$mform->addElement('select', 'certificate', get_string('selectcertificate', 'local_badgecerts'), $options);
$mform->setType('certificate', PARAM_TEXT);
$mform->addRule('certificate', null, 'required', null, 'client');
// Add submit and cancel buttons.
$this->add_action_buttons();
}
}