Fixes bug MDL-8234, "New groups code & AS keyword"
[moodle-pu.git] / admin / enrol_config.php
blob18d597266320ca83c4dd422d5ac914b1503ad909
1 <?PHP // $Id$
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);
28 } else {
29 $frm = $CFG;
32 /// Otherwise fill and print the form.
34 /// get language strings
35 $str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
37 unset($options);
39 $modules = get_list_of_plugins("enrol");
40 foreach ($modules as $module) {
41 $options[$module] = get_string("enrolname", "enrol_$module");
43 asort($options);
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();
59 echo "<hr />";
61 $enrolment->config_form($frm);
63 echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p></center>\n";
64 print_simple_box_end();
65 echo "</form>";
69 admin_externalpage_print_footer($adminroot);
71 exit;