Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403]
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. 13 // 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/>. 16 17 /** 18 * General plugin functions. 19 * 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 23 */ 24 25 use enrol_lti\local\ltiadvantage\admin\admin_setting_registeredplatforms; 26 27 defined('MOODLE_INTERNAL') || die; 28 // The 'Publish as LTI tool' node is a category. 29 $ADMIN->add('enrolments', new admin_category('enrolltifolder', new lang_string('pluginname', 'enrol_lti'), 30 $this->is_enabled() === false)); 31 32 $settings = new admin_settingpage($section, "User default values", 'moodle/site:config', $this->is_enabled() === false); 33 // Add all the user default values settings to the first page. 34 if ($ADMIN->fulltree) { 35 $settings->add(new admin_setting_heading('enrol_lti_settings', '', get_string('pluginname_desc', 'enrol_lti'))); 36 37 if (!is_enabled_auth('lti')) { 38 $notify = new \core\output\notification(get_string('authltimustbeenabled', 'enrol_lti'), 39 \core\output\notification::NOTIFY_WARNING); 40 $settings->add(new admin_setting_heading('enrol_lti_enable_auth_lti', '', $OUTPUT->render($notify))); 41 } 42 43 if (empty($CFG->allowframembedding)) { 44 $notify = new \core\output\notification(get_string('allowframeembedding', 'enrol_lti'), 45 \core\output\notification::NOTIFY_WARNING); 46 $settings->add(new admin_setting_heading('enrol_lti_enable_embedding', '', $OUTPUT->render($notify))); 47 } 48 49 $settings->add(new admin_setting_heading('enrol_lti_user_default_values', 50 get_string('userdefaultvalues', 'enrol_lti'), '')); 51 52 $choices = array(0 => get_string('emaildisplayno'), 53 1 => get_string('emaildisplayyes'), 54 2 => get_string('emaildisplaycourse')); 55 $maildisplay = isset($CFG->defaultpreference_maildisplay) ? $CFG->defaultpreference_maildisplay : 2; 56 $settings->add(new admin_setting_configselect('enrol_lti/emaildisplay', get_string('emaildisplay'), 57 get_string('emaildisplay_help'), $maildisplay, $choices)); 58 59 $city = ''; 60 if (!empty($CFG->defaultcity)) { 61 $city = $CFG->defaultcity; 62 } 63 $settings->add(new admin_setting_configtext('enrol_lti/city', get_string('city'), '', $city)); 64 65 $country = ''; 66 if (!empty($CFG->country)) { 67 $country = $CFG->country; 68 } 69 $countries = array('' => get_string('selectacountry') . '...') + get_string_manager()->get_list_of_countries(); 70 $settings->add(new admin_setting_configselect('enrol_lti/country', get_string('selectacountry'), '', $country, 71 $countries)); 72 73 $settings->add(new admin_setting_configselect('enrol_lti/timezone', get_string('timezone'), '', 99, 74 core_date::get_list_of_timezones(null, true))); 75 76 $settings->add(new admin_setting_configselect('enrol_lti/lang', get_string('preferredlanguage'), '', $CFG->lang, 77 get_string_manager()->get_list_of_translations())); 78 79 $settings->add(new admin_setting_configtext('enrol_lti/institution', get_string('institution'), '', '')); 80 } 81 $ADMIN->add('enrolltifolder', $settings); 82 83 // Now, create a tool registrations settings page. 84 $settings = new admin_settingpage('enrolsettingslti_registrations', "Tool registration", 'moodle/site:config', 85 $this->is_enabled() === false); 86 87 $settings->add(new admin_setting_heading('enrol_lti_tool_registrations_heading', 88 get_string('registeredplatforms', 'enrol_lti'), '')); 89 $settings->add(new admin_setting_registeredplatforms()); 90 91 $ADMIN->add('enrolltifolder', $settings); 92 93 // This adds a settings page to the 'publish as LTI tool' folder, hidden. 94 // On this page, we'll override the active node to force a match on enrolsettingslti_registrations settings page. 95 $ADMIN->add('enrolltifolder', new admin_externalpage('enrolsettingslti_registrations_edit', 96 get_string('registerplatformadd', 'enrol_lti'), "$CFG->wwwroot/$CFG->admin/enrol/lti/register_platform.php", 97 'moodle/site:config', true)); 98 99 // And deployments add/edit. 100 $ADMIN->add('enrolltifolder', new admin_externalpage('enrolsettingslti_deployment_manage', 101 get_string('deployments', 'enrol_lti'), "$CFG->wwwroot/$CFG->admin/enrol/lti/manage_deployment.php", 102 'moodle/site:config', true)); 103 104 // Tell core we're finished. 105 $settings = null;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body