forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enrol.php
75 lines (51 loc) · 1.96 KB
/
enrol.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?PHP // $Id$
// enrol.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
include("../config.php");
require_login();
if (!$site = get_site()) {
redirect("index.php");
}
if (!isadmin()) {
error("Only the admin can use this page");
}
if (isset($_GET['enrolment'])) {
$enrolname = $_GET['enrol'];
} else {
$enrolname = $CFG->enrol;
}
require_once("$CFG->dirroot/enrol/$enrolname/enrol.php"); /// Open the class
$enrolment = new enrolment_plugin();
/// If data submitted, then process and store.
if ($config = data_submitted()) {
if ($enrolment->process_config($config)) {
redirect("enrol.php", get_string("changessaved"), 1);
}
}
/// Otherwise fill and print the form.
$str = get_strings(array('enrolments', 'users', 'administration'));
if (empty($config)) {
$page->config = $CFG;
} else {
$page->config = $config;
}
$modules = get_list_of_plugins("enrol");
foreach ($modules as $module) {
$page->options[$module] = get_string("enrolname", "enrol_$module");
}
asort($page->options);
$form = $enrolment->config_form($page);
print_header("$site->shortname: $str->enrolments", "$site->fullname",
"<a href=\"index.php\">$str->administration</a> ->
<a href=\"users.php\">$str->users</a> -> $str->enrolments");
print_heading($page->options[$CFG->enrol]);
echo "<CENTER><P><B>";
echo "NOT COMPLETE";
echo "<P><B>";
echo "<form TARGET=\"{$CFG->framename}\" NAME=\"authmenu\" method=\"post\" action=\"auth.php\">";
print_string("chooseauthmethod","auth");
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
echo "</B></P></CENTER>";
print_footer();
exit;
?>