Merge branch 'MDL-72036-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE
[moodle.git] / enrol / lti / settings.php
blobb839f76942d60999a42824c194b998b348c93194
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 * General plugin functions.
20 * @package enrol_lti
21 * @copyright 2016 Mark Nelson <markn@moodle.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') || die;
27 if ($ADMIN->fulltree) {
29 $settings->add(new admin_setting_heading('enrol_lti_settings', '', get_string('pluginname_desc', 'enrol_lti')));
31 if (!is_enabled_auth('lti')) {
32 $notify = new \core\output\notification(get_string('authltimustbeenabled', 'enrol_lti'),
33 \core\output\notification::NOTIFY_WARNING);
34 $settings->add(new admin_setting_heading('enrol_lti_enable_auth_lti', '', $OUTPUT->render($notify)));
37 if (empty($CFG->allowframembedding)) {
38 $notify = new \core\output\notification(get_string('allowframeembedding', 'enrol_lti'),
39 \core\output\notification::NOTIFY_WARNING);
40 $settings->add(new admin_setting_heading('enrol_lti_enable_embedding', '', $OUTPUT->render($notify)));
43 $settings->add(new admin_setting_heading('enrol_lti_user_default_values',
44 get_string('userdefaultvalues', 'enrol_lti'), ''));
46 $choices = array(0 => get_string('emaildisplayno'),
47 1 => get_string('emaildisplayyes'),
48 2 => get_string('emaildisplaycourse'));
49 $maildisplay = isset($CFG->defaultpreference_maildisplay) ? $CFG->defaultpreference_maildisplay : 2;
50 $settings->add(new admin_setting_configselect('enrol_lti/emaildisplay', get_string('emaildisplay'),
51 get_string('emaildisplay_help'), $maildisplay, $choices));
53 $city = '';
54 if (!empty($CFG->defaultcity)) {
55 $city = $CFG->defaultcity;
57 $settings->add(new admin_setting_configtext('enrol_lti/city', get_string('city'), '', $city));
59 $country = '';
60 if (!empty($CFG->country)) {
61 $country = $CFG->country;
63 $countries = array('' => get_string('selectacountry') . '...') + get_string_manager()->get_list_of_countries();
64 $settings->add(new admin_setting_configselect('enrol_lti/country', get_string('selectacountry'), '', $country,
65 $countries));
67 $settings->add(new admin_setting_configselect('enrol_lti/timezone', get_string('timezone'), '', 99,
68 core_date::get_list_of_timezones(null, true)));
70 $settings->add(new admin_setting_configselect('enrol_lti/lang', get_string('preferredlanguage'), '', $CFG->lang,
71 get_string_manager()->get_list_of_translations()));
73 $settings->add(new admin_setting_configtext('enrol_lti/institution', get_string('institution'), '', ''));