Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * Url module admin settings and defaults
  20   *
  21   * @package    mod_url
  22   * @copyright  2009 Petr Skoda  {@link http://skodak.org}
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  defined('MOODLE_INTERNAL') || die;
  27  
  28  if ($ADMIN->fulltree) {
  29      require_once("$CFG->libdir/resourcelib.php");
  30  
  31      $displayoptions = resourcelib_get_displayoptions(array(RESOURCELIB_DISPLAY_AUTO,
  32                                                             RESOURCELIB_DISPLAY_EMBED,
  33                                                             RESOURCELIB_DISPLAY_FRAME,
  34                                                             RESOURCELIB_DISPLAY_OPEN,
  35                                                             RESOURCELIB_DISPLAY_NEW,
  36                                                             RESOURCELIB_DISPLAY_POPUP,
  37                                                            ));
  38      $defaultdisplayoptions = array(RESOURCELIB_DISPLAY_AUTO,
  39                                     RESOURCELIB_DISPLAY_EMBED,
  40                                     RESOURCELIB_DISPLAY_OPEN,
  41                                     RESOURCELIB_DISPLAY_POPUP,
  42                                    );
  43  
  44      //--- general settings -----------------------------------------------------------------------------------
  45      $settings->add(new admin_setting_configtext('url/framesize',
  46          get_string('framesize', 'url'), get_string('configframesize', 'url'), 130, PARAM_INT));
  47      $settings->add(new admin_setting_configpasswordunmask('url/secretphrase', get_string('password'),
  48          get_string('configsecretphrase', 'url'), ''));
  49      $settings->add(new admin_setting_configcheckbox('url/rolesinparams',
  50          get_string('rolesinparams', 'url'), get_string('configrolesinparams', 'url'), false));
  51      $settings->add(new admin_setting_configmultiselect('url/displayoptions',
  52          get_string('displayoptions', 'url'), get_string('configdisplayoptions', 'url'),
  53          $defaultdisplayoptions, $displayoptions));
  54  
  55      //--- modedit defaults -----------------------------------------------------------------------------------
  56      $settings->add(new admin_setting_heading('urlmodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
  57  
  58      $settings->add(new admin_setting_configcheckbox('url/printintro',
  59          get_string('printintro', 'url'), get_string('printintroexplain', 'url'), 1));
  60      $settings->add(new admin_setting_configselect('url/display',
  61          get_string('displayselect', 'url'), get_string('displayselectexplain', 'url'), RESOURCELIB_DISPLAY_AUTO, $displayoptions));
  62      $settings->add(new admin_setting_configtext('url/popupwidth',
  63          get_string('popupwidth', 'url'), get_string('popupwidthexplain', 'url'), 620, PARAM_INT, 7));
  64      $settings->add(new admin_setting_configtext('url/popupheight',
  65          get_string('popupheight', 'url'), get_string('popupheightexplain', 'url'), 450, PARAM_INT, 7));
  66  }