-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_form.php
More file actions
44 lines (31 loc) · 1.5 KB
/
edit_form.php
File metadata and controls
44 lines (31 loc) · 1.5 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
defined('MOODLE_INTERNAL') || die();
require_once("$CFG->libdir/formslib.php");
class enrol_backuptest_edit_form extends moodleform {
function definition() {
global $CFG, $DB;
$mform = $this->_form;
list($instance, $plugin, $course) = $this->_customdata;
$coursecontext = context_course::instance($course->id);
$options = array(ENROL_INSTANCE_ENABLED => 'Enabled',
ENROL_INSTANCE_DISABLED => 'Disabled');
$mform->addElement('select', 'status', 'status', $options);
$mform->setDefault('status', ENROL_INSTANCE_ENABLED);
$mform->addElement('text', 'term', 'Term. This is stored in the enrol_backuptest_termmap table and should backup and restore with the course.');
$mform->setType('term', PARAM_TEXT);
$roles = get_assignable_roles($coursecontext);
$roles[0] = get_string('none');
$roles = array_reverse($roles, true);
$mform->addElement('select', 'customint1', 'Role. This is stored in customint1 and should be annotated on backup and restored with the course.', $roles);
$mform->addElement('hidden', 'courseid', null);
$mform->setType('courseid', PARAM_INT);
$mform->addElement('hidden', 'id', null);
$mform->setType('id', PARAM_INT);
if ($instance->id) {
$this->add_action_buttons(true);
} else {
$this->add_action_buttons(true, get_string('addinstance', 'enrol'));
}
$this->set_data($instance);
}
}