Merge branch 'MDL-61578-master' of git://github.com/mickhawkins/moodle
[moodle.git] / enrol / flatfile / settings.php
blob5b7d345a7577500f98d8c35ed5da0e220cc949aa
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Flatfile enrolments plugin settings and presets.
20 * @package enrol_flatfile
21 * @copyright 2010 Eugene Venter
22 * @author Eugene Venter - based on code by Petr Skoda and others
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 defined('MOODLE_INTERNAL') || die();
28 require_once(__DIR__.'/adminlib.php');
30 if ($ADMIN->fulltree) {
32 //--- general settings -----------------------------------------------------------------------------------
33 $settings->add(new admin_setting_heading('enrol_flatfile_settings', '', get_string('pluginname_desc', 'enrol_flatfile')));
35 $settings->add(new admin_setting_configfile('enrol_flatfile/location', get_string('location', 'enrol_flatfile'), get_string('location_desc', 'enrol_flatfile'), ''));
37 $options = core_text::get_encodings();
38 $settings->add(new admin_setting_configselect('enrol_flatfile/encoding', get_string('encoding', 'enrol_flatfile'), '', 'UTF-8', $options));
40 $settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailstudents', get_string('notifyenrolled', 'enrol_flatfile'), '', 0));
42 $settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailteachers', get_string('notifyenroller', 'enrol_flatfile'), '', 0));
44 $settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailadmins', get_string('notifyadmin', 'enrol_flatfile'), '', 0));
46 $options = array(ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'),
47 ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'),
48 ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'));
49 $settings->add(new admin_setting_configselect('enrol_flatfile/unenrolaction', get_string('extremovedaction', 'enrol'), get_string('extremovedaction_help', 'enrol'), ENROL_EXT_REMOVED_SUSPENDNOROLES, $options));
51 // Note: let's reuse the ext sync constants and strings here, internally it is very similar,
52 // it describes what should happen when users are not supposed to be enrolled any more.
53 $options = array(
54 ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'),
55 ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'),
56 ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'),
58 $settings->add(new admin_setting_configselect('enrol_flatfile/expiredaction', get_string('expiredaction', 'enrol_flatfile'), get_string('expiredaction_help', 'enrol_flatfile'), ENROL_EXT_REMOVED_SUSPENDNOROLES, $options));
60 //--- mapping -------------------------------------------------------------------------------------------
61 if (!during_initial_install()) {
62 $settings->add(new admin_setting_heading('enrol_flatfile_mapping', get_string('mapping', 'enrol_flatfile'), ''));
64 $roles = role_fix_names(get_all_roles());
66 foreach ($roles as $role) {
67 $settings->add(new enrol_flatfile_role_setting($role));
69 unset($roles);