MDL-56839 upgrade.txt: Fix incorrect information in lib/upgrade.txt
[moodle.git] / enrol / imsenterprise / settings.php
blobd55b8ee5499f5d3ea4baab3459ad5268bf5521cb
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 * IMS Enterprise enrolments plugin settings and presets.
20 * @package enrol_imsenterprise
21 * @copyright 2010 Eugene Venter
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') || die();
27 if ($ADMIN->fulltree) {
28 require_once($CFG->dirroot.'/enrol/imsenterprise/locallib.php');
30 $settings->add(new admin_setting_heading('enrol_imsenterprise_settings', '',
31 get_string('pluginname_desc', 'enrol_imsenterprise')));
33 // General settings.
34 $settings->add(new admin_setting_heading('enrol_imsenterprise_basicsettings',
35 get_string('basicsettings', 'enrol_imsenterprise'), ''));
37 $settings->add(new admin_setting_configtext('enrol_imsenterprise/imsfilelocation',
38 get_string('location', 'enrol_imsenterprise'), '', ''));
40 $settings->add(new admin_setting_configtext('enrol_imsenterprise/logtolocation',
41 get_string('logtolocation', 'enrol_imsenterprise'), '', ''));
43 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/mailadmins',
44 get_string('mailadmins', 'enrol_imsenterprise'), '', 0));
46 // User data options.
47 $settings->add(new admin_setting_heading('enrol_imsenterprise_usersettings',
48 get_string('usersettings', 'enrol_imsenterprise'), ''));
50 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/createnewusers',
51 get_string('createnewusers', 'enrol_imsenterprise'), get_string('createnewusers_desc', 'enrol_imsenterprise'), 0));
53 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/imsupdateusers',
54 get_string('updateusers', 'enrol_imsenterprise'), get_string('updateusers_desc', 'enrol_imsenterprise'), 0));
56 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/imsdeleteusers',
57 get_string('deleteusers', 'enrol_imsenterprise'), get_string('deleteusers_desc', 'enrol_imsenterprise'), 0));
59 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/fixcaseusernames',
60 get_string('fixcaseusernames', 'enrol_imsenterprise'), '', 0));
62 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/fixcasepersonalnames',
63 get_string('fixcasepersonalnames', 'enrol_imsenterprise'), '', 0));
65 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/imssourcedidfallback',
66 get_string('sourcedidfallback', 'enrol_imsenterprise'), get_string('sourcedidfallback_desc', 'enrol_imsenterprise'), 0));
68 $settings->add(new admin_setting_heading('enrol_imsenterprise_usersettings_roles',
69 get_string('roles', 'enrol_imsenterprise'), get_string('imsrolesdescription', 'enrol_imsenterprise')));
71 if (!during_initial_install()) {
72 $coursecontext = context_course::instance(SITEID);
73 $assignableroles = get_assignable_roles($coursecontext);
74 $assignableroles = array('0' => get_string('ignore', 'enrol_imsenterprise')) + $assignableroles;
75 $imsroles = new imsenterprise_roles();
76 foreach ($imsroles->get_imsroles() as $imsrolenum => $imsrolename) {
77 $settings->add(new admin_setting_configselect('enrol_imsenterprise/imsrolemap'.$imsrolenum,
78 format_string('"'.$imsrolename.'" ('.$imsrolenum.')'), '',
79 (int)$imsroles->determine_default_rolemapping($imsrolenum), $assignableroles));
83 // Course data options.
84 $settings->add(new admin_setting_heading('enrol_imsenterprise_coursesettings',
85 get_string('coursesettings', 'enrol_imsenterprise'), ''));
87 $settings->add(new admin_setting_configtext('enrol_imsenterprise/truncatecoursecodes',
88 get_string('truncatecoursecodes', 'enrol_imsenterprise'), get_string('truncatecoursecodes_desc', 'enrol_imsenterprise'),
89 0, PARAM_INT, 2));
91 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/createnewcourses',
92 get_string('createnewcourses', 'enrol_imsenterprise'), get_string('createnewcourses_desc', 'enrol_imsenterprise'), 0));
94 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/updatecourses',
95 get_string('updatecourses', 'enrol_imsenterprise'), get_string('updatecourses_desc', 'enrol_imsenterprise'), 0));
97 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/createnewcategories',
98 get_string('createnewcategories', 'enrol_imsenterprise'), get_string('createnewcategories_desc', 'enrol_imsenterprise'),
99 0));
101 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/nestedcategories',
102 get_string('nestedcategories', 'enrol_imsenterprise'), get_string('nestedcategories_desc', 'enrol_imsenterprise'), 0));
104 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/categoryidnumber',
105 get_string('categoryidnumber', 'enrol_imsenterprise'), get_string('categoryidnumber_desc', 'enrol_imsenterprise'), 0));
107 $settings->add(new admin_setting_configtext('enrol_imsenterprise/categoryseparator',
108 get_string('categoryseparator', 'enrol_imsenterprise'), get_string('categoryseparator_desc', 'enrol_imsenterprise'), '',
109 PARAM_TEXT, 3));
111 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/imsunenrol',
112 get_string('allowunenrol', 'enrol_imsenterprise'), get_string('allowunenrol_desc', 'enrol_imsenterprise'), 0));
114 if (!during_initial_install()) {
115 $imscourses = new imsenterprise_courses();
116 foreach ($imscourses->get_courseattrs() as $courseattr) {
118 // The assignable values of this course attribute.
119 $assignablevalues = $imscourses->get_imsnames($courseattr);
120 $name = get_string('setting' . $courseattr, 'enrol_imsenterprise');
121 $description = get_string('setting' . $courseattr . 'description', 'enrol_imsenterprise');
122 $defaultvalue = (string) $imscourses->determine_default_coursemapping($courseattr);
123 $settings->add(new admin_setting_configselect('enrol_imsenterprise/imscoursemap' . $courseattr, $name,
124 $description, $defaultvalue, $assignablevalues));
128 // Miscellaneous.
129 $settings->add(new admin_setting_heading('enrol_imsenterprise_miscsettings',
130 get_string('miscsettings', 'enrol_imsenterprise'), ''));
132 $settings->add(new admin_setting_configtext('enrol_imsenterprise/imsrestricttarget',
133 get_string('restricttarget', 'enrol_imsenterprise'), get_string('restricttarget_desc', 'enrol_imsenterprise'), ''));
135 $settings->add(new admin_setting_configcheckbox('enrol_imsenterprise/imscapitafix',
136 get_string('usecapitafix', 'enrol_imsenterprise'), get_string('usecapitafix_desc', 'enrol_imsenterprise'), 0));
138 $importurl = new moodle_url('/enrol/imsenterprise/importnow.php', array('sesskey' => sesskey()));
139 $importnowstring = get_string('aftersaving...', 'enrol_imsenterprise').' ';
140 $importnowstring .= html_writer::link($importurl, get_string('doitnow', 'enrol_imsenterprise'));
141 $settings->add(new admin_setting_heading('enrol_imsenterprise_doitnowmessage', '', $importnowstring));