2 // enrol_config.php - allows admin to edit all enrollment variables
3 // Yes, enrol is correct English spelling.
5 require_once("../config.php");
6 require_once($CFG->libdir
.'/adminlib.php');
8 $adminroot = admin_get_root();
9 admin_externalpage_setup('enrolment', $adminroot);
11 $enrol = required_param('enrol', PARAM_ALPHA
);
12 $CFG->pagepath
= 'enrol/' . $enrol;
15 require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
17 $enrolment = enrolment_factory
::factory($enrol);
19 /// If data submitted, then process and store.
21 if ($frm = data_submitted()) {
22 if (!confirm_sesskey()) {
23 error(get_string('confirmsesskeybad', 'error'));
25 if ($enrolment->process_config($frm)) {
26 redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
32 /// Otherwise fill and print the form.
34 /// get language strings
35 $str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
39 $modules = get_list_of_plugins("enrol");
40 foreach ($modules as $module) {
41 $options[$module] = get_string("enrolname", "enrol_$module");
45 admin_externalpage_print_header($adminroot);
47 echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
48 echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey
."\" />";
49 echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";
51 /// Print current enrolment type description
52 print_simple_box_start("center", "80%");
53 print_heading($options[$enrol]);
55 print_simple_box_start("center", "60%", '', 5, 'informationbox');
56 print_string("description", "enrol_$enrol");
57 print_simple_box_end();
61 $enrolment->config_form($frm);
63 echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p></center>\n";
64 print_simple_box_end();
69 admin_externalpage_print_footer($adminroot);