forked from prasathmani/tinyfilemanager
-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.php
91 lines (81 loc) · 4.34 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
// This file is part of Tiny File Manager plugin for Moodle - http://moodle.org/
//
// Tiny File Manager is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tiny File Manager is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Tiny File Manager. If not, see <http://www.gnu.org/licenses/>.
/**
* Add page to admin menu.
*
* @package local_tinyfilemanager
* @author Michael Milette (https://www.tngconsulting.ca)
* @copyright 2020-2024 Consulting Inc.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
$pluginname = get_string('pluginname', 'local_tinyfilemanager');
$ADMIN->add('server', new admin_externalpage('local_tinyfilemanager', $pluginname, new moodle_url('/local/tinyfilemanager/')));
$settings = new admin_settingpage('local_tinyfilemanager_settings', $pluginname);
$ADMIN->add('localplugins', $settings);
// Option to show or hide hidden files.
$default = '0';
$name = 'local_tinyfilemanager/showhidden';
$title = get_string('showhidden', 'local_tinyfilemanager');
$description = get_string('showhidden_desc', 'local_tinyfilemanager');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
// Option to show or hide permissions and owner column.
if (DIRECTORY_SEPARATOR === '/') {
// Only on Unix, Linux, MacOS.
$default = '1';
$name = 'local_tinyfilemanager/showpermowner';
$title = get_string('showpermowner', 'local_tinyfilemanager');
$description = get_string('showpermowner_desc', 'local_tinyfilemanager');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
}
// Option to calculate size of folders.
$default = '0';
$name = 'local_tinyfilemanager/calcfoldersize';
$title = get_string('calcfoldersize', 'local_tinyfilemanager');
$description = get_string('calcfoldersize_desc', 'local_tinyfilemanager');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
// Option to specify the root directory path displayed TinyFileManager.
$default = substr($CFG->dirroot, 1,1) == ':' ? substr($CFG->dirroot, 2) : $CFG->dirroot;
$default = str_replace('\\', '/', $default);
$name = 'local_tinyfilemanager/rootpath';
$title = get_string('rootpath', 'local_tinyfilemanager');
$description = get_string('rootpath_desc', 'local_tinyfilemanager');
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_PATH);
$settings->add($setting);
// Option to select the Office online document viewer.
$default = 'google'; // Default is to use the Google document viewer.
$name = 'local_tinyfilemanager/onlineviewer';
$title = get_string('onlineviewer', 'local_tinyfilemanager');
$description = get_string('onlineviewer_desc', 'local_tinyfilemanager');
$choices = ['false' => get_string('plugindisabled', 'plugin'),
'google' => get_string('google', 'local_tinyfilemanager'),
'microsoft' => get_string('microsoft', 'local_tinyfilemanager')];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$settings->add($setting);
// Option to select the source code highligh theme.
$default = 'vs.css'; // Default is to use the base VSCode theme.
$name = 'local_tinyfilemanager/highlighttheme';
$title = get_string('highlighttheme', 'local_tinyfilemanager');
$description = get_string('highlighttheme_desc', 'local_tinyfilemanager');
$choices = array_diff(scandir(dirname(__FILE__) . '/style/highlight'), array('.', '..', 'base16'));
$choices = array_combine($choices, $choices);
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$settings->add($setting);
}