enrol_config.php 2.09 KB
Newer Older
1
2
3
4
<?PHP  // $Id$
       // enrol_config.php - allows admin to edit all enrollment variables
       //                    Yes, enrol is correct English spelling.

skodak's avatar
skodak committed
5
    require_once("../config.php");
6
    require_once($CFG->libdir.'/adminlib.php');
7

8
    admin_externalpage_setup('enrolment');
9
10

    $enrol = required_param('enrol', PARAM_ALPHA);
11
    $PAGE->set_pagetype('admin-enrol-' . $enrol);
12
13
14
15
16
17
18

    require_once("$CFG->dirroot/enrol/enrol.class.php");   /// Open the factory class

    $enrolment = enrolment_factory::factory($enrol);

/// If data submitted, then process and store.

19
    if ($frm = data_submitted()) {
vinkmar's avatar
vinkmar committed
20
        if (!confirm_sesskey()) {
skodak's avatar
skodak committed
21
            print_error('confirmsesskeybad', 'error');
22
        }
23
        if ($enrolment->process_config($frm)) {
skodak's avatar
skodak committed
24
            redirect("enrol.php?sesskey=".sesskey(), get_string("changessaved"), 1);
25
26
27
28
29
30
31
32
33
34
        }
    } else {
        $frm = $CFG;
    }

/// Otherwise fill and print the form.

    /// get language strings
    $str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));

vinkmar's avatar
vinkmar committed
35
    unset($options);
36

37
38
    $modules = get_plugin_list('enrol');
    foreach ($modules as $module => $enroldir) {
39
40
41
42
        $options[$module] = get_string("enrolname", "enrol_$module");
    }
    asort($options);

43
    admin_externalpage_print_header();
44

45
    echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
toyomoyo's avatar
toyomoyo committed
46
    echo "<div>";
skodak's avatar
skodak committed
47
    echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
48
    echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";
49
50

/// Print current enrolment type description
51
    print_simple_box_start("center", "80%");
52
    echo $OUTPUT->heading($options[$enrol]);
53
54
55
56
57
58

    print_simple_box_start("center", "60%", '', 5, 'informationbox');
    print_string("description", "enrol_$enrol");
    print_simple_box_end();

    echo "<hr />";
59

60
61
    $enrolment->config_form($frm);

toyomoyo's avatar
toyomoyo committed
62
    echo "<p class=\"centerpara\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p>\n";
63
    print_simple_box_end();
toyomoyo's avatar
toyomoyo committed
64
    echo "</div>";
65
66
    echo "</form>";

67
    echo $OUTPUT->footer();
68
69
70

    exit;
?>