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.

Differences Between: [Versions 401 and 403]

   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   * Resource module admin settings and defaults
  20   *
  21   * @package    mod_resource
  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_DOWNLOAD,
  35                                                             RESOURCELIB_DISPLAY_OPEN,
  36                                                             RESOURCELIB_DISPLAY_NEW,
  37                                                             RESOURCELIB_DISPLAY_POPUP,
  38                                                            ));
  39      $defaultdisplayoptions = array(RESOURCELIB_DISPLAY_AUTO,
  40                                     RESOURCELIB_DISPLAY_EMBED,
  41                                     RESOURCELIB_DISPLAY_DOWNLOAD,
  42                                     RESOURCELIB_DISPLAY_OPEN,
  43                                     RESOURCELIB_DISPLAY_POPUP,
  44                                    );
  45  
  46      //--- general settings -----------------------------------------------------------------------------------
  47      $settings->add(new admin_setting_configtext('resource/framesize',
  48          get_string('framesize', 'resource'), get_string('configframesize', 'resource'), 130, PARAM_INT));
  49      $settings->add(new admin_setting_configmultiselect('resource/displayoptions',
  50          get_string('displayoptions', 'resource'), get_string('configdisplayoptions', 'resource'),
  51          $defaultdisplayoptions, $displayoptions));
  52  
  53      //--- modedit defaults -----------------------------------------------------------------------------------
  54      $settings->add(new admin_setting_heading('resourcemodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
  55  
  56      $settings->add(new admin_setting_configcheckbox('resource/printintro',
  57          get_string('printintro', 'resource'), get_string('printintroexplain', 'resource'), 1));
  58      $settings->add(new admin_setting_configselect('resource/display',
  59          get_string('displayselect', 'resource'), get_string('displayselectexplain', 'resource'), RESOURCELIB_DISPLAY_AUTO,
  60          $displayoptions));
  61      $settings->add(new admin_setting_configcheckbox('resource/showsize',
  62          get_string('showsize', 'resource'), get_string('showsize_desc', 'resource'), 0));
  63      $settings->add(new admin_setting_configcheckbox('resource/showtype',
  64          get_string('showtype', 'resource'), get_string('showtype_desc', 'resource'), 0));
  65      $settings->add(new admin_setting_configcheckbox('resource/showdate',
  66          get_string('showdate', 'resource'), get_string('showdate_desc', 'resource'), 0));
  67      $settings->add(new admin_setting_configtext('resource/popupwidth',
  68          get_string('popupwidth', 'resource'), get_string('popupwidthexplain', 'resource'), 620, PARAM_INT, 7));
  69      $settings->add(new admin_setting_configtext('resource/popupheight',
  70          get_string('popupheight', 'resource'), get_string('popupheightexplain', 'resource'), 450, PARAM_INT, 7));
  71      $options = array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly'));
  72      $settings->add(new admin_setting_configselect('resource/filterfiles',
  73          get_string('filterfiles', 'resource'), get_string('filterfilesexplain', 'resource'), 0, $options));
  74  }