3 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
19 * Resource module admin settings and defaults
22 * @subpackage resource
23 * @copyright 2009 Petr Skoda {@link http://skodak.org}
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') ||
die;
29 if ($ADMIN->fulltree
) {
30 require_once("$CFG->libdir/resourcelib.php");
32 $displayoptions = resourcelib_get_displayoptions(array(RESOURCELIB_DISPLAY_AUTO
,
33 RESOURCELIB_DISPLAY_EMBED
,
34 RESOURCELIB_DISPLAY_FRAME
,
35 RESOURCELIB_DISPLAY_DOWNLOAD
,
36 RESOURCELIB_DISPLAY_OPEN
,
37 RESOURCELIB_DISPLAY_NEW
,
38 RESOURCELIB_DISPLAY_POPUP
,
40 $defaultdisplayoptions = array(RESOURCELIB_DISPLAY_AUTO
,
41 RESOURCELIB_DISPLAY_EMBED
,
42 RESOURCELIB_DISPLAY_DOWNLOAD
,
43 RESOURCELIB_DISPLAY_OPEN
,
44 RESOURCELIB_DISPLAY_POPUP
,
47 //--- general settings -----------------------------------------------------------------------------------
48 $settings->add(new admin_setting_configtext('resource/framesize',
49 get_string('framesize', 'resource'), get_string('configframesize', 'resource'), 130, PARAM_INT
));
50 $settings->add(new admin_setting_configcheckbox('resource/requiremodintro',
51 get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1));
52 $settings->add(new admin_setting_configmultiselect('resource/displayoptions',
53 get_string('displayoptions', 'resource'), get_string('configdisplayoptions', 'resource'),
54 $defaultdisplayoptions, $displayoptions));
56 //--- modedit defaults -----------------------------------------------------------------------------------
57 $settings->add(new admin_setting_heading('resourcemodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
59 $settings->add(new admin_setting_configcheckbox_with_advanced('resource/printheading',
60 get_string('printheading', 'resource'), get_string('printheadingexplain', 'resource'),
61 array('value'=>0, 'adv'=>false)));
62 $settings->add(new admin_setting_configcheckbox_with_advanced('resource/printintro',
63 get_string('printintro', 'resource'), get_string('printintroexplain', 'resource'),
64 array('value'=>1, 'adv'=>false)));
65 $settings->add(new admin_setting_configselect_with_advanced('resource/display',
66 get_string('displayselect', 'resource'), get_string('displayselectexplain', 'resource'),
67 array('value'=>RESOURCELIB_DISPLAY_AUTO
, 'adv'=>false), $displayoptions));
68 $settings->add(new admin_setting_configcheckbox_with_advanced('resource/showsize',
69 get_string('showsize', 'resource'), get_string('showsize_desc', 'resource'),
70 array('value'=>0, 'adv'=>false)));
71 $settings->add(new admin_setting_configcheckbox_with_advanced('resource/showtype',
72 get_string('showtype', 'resource'), get_string('showtype_desc', 'resource'),
73 array('value'=>0, 'adv'=>false)));
74 $settings->add(new admin_setting_configtext_with_advanced('resource/popupwidth',
75 get_string('popupwidth', 'resource'), get_string('popupwidthexplain', 'resource'),
76 array('value'=>620, 'adv'=>true), PARAM_INT
, 7));
77 $settings->add(new admin_setting_configtext_with_advanced('resource/popupheight',
78 get_string('popupheight', 'resource'), get_string('popupheightexplain', 'resource'),
79 array('value'=>450, 'adv'=>true), PARAM_INT
, 7));
80 $options = array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly'));
81 $settings->add(new admin_setting_configselect_with_advanced('resource/filterfiles',
82 get_string('filterfiles', 'resource'), get_string('filterfilesexplain', 'resource'),
83 array('value'=>0, 'adv'=>true), $options));