Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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  defined('MOODLE_INTERNAL') || die;
  26  
  27  if ($ADMIN->fulltree) {
  28  
  29      $settings->add(new admin_setting_heading('enrol_lti_settings', '', get_string('pluginname_desc', 'enrol_lti')));
  30  
  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)));
  35      }
  36  
  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)));
  41      }
  42  
  43      $settings->add(new admin_setting_heading('enrol_lti_user_default_values',
  44          get_string('userdefaultvalues', 'enrol_lti'), ''));
  45  
  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));
  52  
  53      $city = '';
  54      if (!empty($CFG->defaultcity)) {
  55          $city = $CFG->defaultcity;
  56      }
  57      $settings->add(new admin_setting_configtext('enrol_lti/city', get_string('city'), '', $city));
  58  
  59      $country = '';
  60      if (!empty($CFG->country)) {
  61          $country = $CFG->country;
  62      }
  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));
  66  
  67      $settings->add(new admin_setting_configselect('enrol_lti/timezone', get_string('timezone'), '', 99,
  68          core_date::get_list_of_timezones(null, true)));
  69  
  70      $settings->add(new admin_setting_configselect('enrol_lti/lang', get_string('preferredlanguage'), '', $CFG->lang,
  71          get_string_manager()->get_list_of_translations()));
  72  
  73      $settings->add(new admin_setting_configtext('enrol_lti/institution', get_string('institution'), '', ''));
  74  }