Bumped to 1.7.6
[moodle.git] / admin / enrol_config.php
blob6d131527b5618ca36844109b3235bb5ee52a0127
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 target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
48 echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
49 echo "<div align=\"center\"><p><b>";
52 /// Choose an enrolment method
53 echo get_string('chooseenrolmethod').': ';
54 choose_from_menu ($options, "enrol", $enrol, "",
55 "document.location='enrol_config.php?enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
57 echo "</b></p></div>";
59 /// Print current enrolment type description
60 print_simple_box_start("center", "80%");
61 print_heading($options[$enrol]);
63 print_simple_box_start("center", "60%", '', 5, 'informationbox');
64 print_string("description", "enrol_$enrol");
65 print_simple_box_end();
67 echo "<hr />";
69 $enrolment->config_form($frm);
71 echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\"></p></center>\n";
72 echo "</form>";
74 print_simple_box_end();
76 admin_externalpage_print_footer($adminroot);
78 exit;