-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.php
150 lines (132 loc) · 6.45 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Local plugin "Site statistics" - Settings
*
* @package local_sitestats
* @copyright 2019 Alexander Bias, Ulm University <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
// New settings page.
$page = new admin_settingpage('sitestats', get_string('pluginname', 'local_sitestats', null, true));
if ($ADMIN->fulltree) {
// Create crawl sites heading.
$page->add(new admin_setting_heading('local_sitestats/crawlsitesheading',
get_string('setting_crawlsites', 'local_sitestats', null, true),
''));
// Create crawl sites widget.
$page->add(new admin_setting_configtextarea('local_sitestats/crawlsites',
get_string('setting_crawlsites', 'local_sitestats', null, true),
get_string('setting_crawlsites_desc', 'local_sitestats', null, true),
'https://sandbox.moodledemo.net|Moodle demo instance
https://qa.moodledemo.net|Moodle QA instance',
PARAM_RAW));
// Create crawl plugins heading.
$page->add(new admin_setting_heading('local_sitestats/crawlpluginsheading',
get_string('setting_crawlplugins', 'local_sitestats', null, true),
''));
// Create enable crawl plugins widget.
$page->add(new admin_setting_configcheckbox('local_sitestats/crawlplugins',
get_string('setting_crawlplugins', 'local_sitestats', null, true),
get_string('setting_crawlplugins_desc', 'local_sitestats', null, true),
true));
// Create crawl plugins cURL timeout widget.
$page->add(new admin_setting_configtext('local_sitestats/plugincurltimeout',
get_string('setting_plugincurltimeout', 'local_sitestats', null, true),
get_string('setting_plugincurltimeout_desc', 'local_sitestats', null, true),
10));
$page->hide_if('local_sitestats/plugincurltimeout',
'local_sitestats/crawlplugins', 'notchecked');
// Create pluginlist widget.
$page->add(new admin_setting_configtext('local_sitestats/pluginlist',
get_string('setting_pluginlist', 'local_sitestats', null, true),
get_string('setting_pluginlist_desc', 'local_sitestats', null, true),
'https://download.moodle.org/api/1.3/pluglist.php',
PARAM_URL));
$page->hide_if('local_sitestats/pluginlist',
'local_sitestats/crawlplugins', 'notchecked');
// Create plugin blacklist widget.
$page->add(new admin_setting_configtextarea('local_sitestats/pluginblacklist',
get_string('setting_pluginblacklist', 'local_sitestats', null, true),
get_string('setting_pluginblacklist_desc', 'local_sitestats', null, true),
'atto_recordrtc
block_calendar_month
block_course_overview
format_singleactivity
gradereport_history
message_airnotifier
mod_book
qtype_ddimageortext
qtype_ddmarker
qtype_ddwtos
qtype_gapselect
quizaccess_offlineattempts
repository_areafiles
repository_skydrive
theme_classic
tinymce_managefiles
tool_dataprivacy
tool_lpimportcsv
tool_policy',
PARAM_RAW));
$page->hide_if('local_sitestats/pluginblacklist',
'local_sitestats/crawlplugins', 'notchecked');
// Create crawl plugins crawl again delay widget.
$page->add(new admin_setting_configtext('local_sitestats/plugincrawlagaindelay',
get_string('setting_plugincrawlagaindelay', 'local_sitestats', null, true),
get_string('setting_plugincrawlagaindelay_desc', 'local_sitestats', null, true),
5,
PARAM_INT));
$page->hide_if('local_sitestats/plugincrawlagaindelay',
'local_sitestats/crawlplugins', 'notchecked');
// Create crawl plugins chart number widget.
$page->add(new admin_setting_configtext('local_sitestats/pluginchartnumber',
get_string('setting_pluginchartnumber', 'local_sitestats', null, true),
get_string('setting_pluginchartnumber_desc', 'local_sitestats', null, true),
10,
PARAM_INT));
$page->hide_if('local_sitestats/pluginchartnumber',
'local_sitestats/crawlplugins', 'notchecked');
// Create crawl core heading.
$page->add(new admin_setting_heading('local_sitestats/crawlcoreheading',
get_string('setting_crawlcore', 'local_sitestats', null, true),
''));
// Create enable crawl core widget.
$page->add(new admin_setting_configcheckbox('local_sitestats/crawlcore',
get_string('setting_crawlcore', 'local_sitestats', null, true),
get_string('setting_crawlcore_desc', 'local_sitestats', null, true),
true));
// Create crawl core cURL timeout widget.
$page->add(new admin_setting_configtext('local_sitestats/corecurltimeout',
get_string('setting_corecurltimeout', 'local_sitestats', null, true),
get_string('setting_corecurltimeout_desc', 'local_sitestats', null, true),
10));
$page->hide_if('local_sitestats/corecurltimeout',
'local_sitestats/crawlcore', 'notchecked');
// Create crawl core crawl again delay widget.
$page->add(new admin_setting_configtext('local_sitestats/corecrawlagaindelay',
get_string('setting_corecrawlagaindelay', 'local_sitestats', null, true),
get_string('setting_corecrawlagaindelay_desc', 'local_sitestats', null, true),
5,
PARAM_INT));
$page->hide_if('local_sitestats/corecrawlagaindelay',
'local_sitestats/crawlcore', 'notchecked');
}
// Add settings page to navigation tree.
$ADMIN->add('localplugins', $page);
}