2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Plugin administration pages are defined here.
20 * @package tool_brickfield
22 * @copyright 2020 Brickfield Education Labs, https://www.brickfield.ie - Author: Karen Holland
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 use tool_brickfield\accessibility
;
27 use tool_brickfield\manager
;
28 use tool_brickfield\analysis
;
29 use tool_brickfield\output\renderer
;
30 use tool_brickfield\registration
;
32 defined('MOODLE_INTERNAL') ||
die();
34 $accessibilitydisabled = !accessibility
::is_accessibility_enabled();
37 // Add an enable subsystem setting to the "Advanced features" settings page.
38 $optionalsubsystems = $ADMIN->locate('optionalsubsystems');
39 $optionalsubsystems->add(new admin_setting_configcheckbox(
40 'enableaccessibilitytools',
41 new lang_string('enableaccessibilitytools', manager
::PLUGINNAME
),
42 new lang_string('enableaccessibilitytools_desc', manager
::PLUGINNAME
),
49 $moodleurl = accessibility
::get_plugin_url();
53 new admin_category('brickfieldfolder', get_string('accessibility', manager
::PLUGINNAME
), $accessibilitydisabled)
58 new admin_externalpage(
59 'tool_brickfield_activation',
60 get_string('activationform', manager
::PLUGINNAME
),
61 manager
::registration_url(),
66 $settings = new admin_settingpage(manager
::PLUGINNAME
, get_string('settings', manager
::PLUGINNAME
));
68 $settings->add(new admin_setting_configcheckbox(
69 manager
::PLUGINNAME
. '/analysistype',
70 get_string('analysistype', manager
::PLUGINNAME
),
71 get_string('analysistype_desc', manager
::PLUGINNAME
),
72 analysis
::ANALYSISDISABLED
,
73 analysis
::ANALYSISBYREQUEST
,
74 analysis
::ANALYSISDISABLED
77 $settings->add(new admin_setting_configcheckbox(
78 manager
::PLUGINNAME
. '/deletehistoricaldata',
79 get_string('deletehistoricaldata', manager
::PLUGINNAME
),
84 $settings->add(new admin_setting_configtext(
85 manager
::PLUGINNAME
. '/batch',
86 get_string('batch', manager
::PLUGINNAME
),
92 $settings->add(new admin_setting_configtext(
93 manager
::PLUGINNAME
. '/perpage',
94 get_string('perpage', manager
::PLUGINNAME
),
99 $ADMIN->add('brickfieldfolder', $settings);
101 $ADMIN->add('brickfieldfolder', new admin_externalpage('tool_brickfield_tool',
102 get_string('tools', manager
::PLUGINNAME
),
104 accessibility
::get_capability_name('viewsystemtools')
108 // Add the reports link if the toolkit is enabled, and is either registered, or the user has the ability to register it.
109 $showreports = has_capability('moodle/site:config', \context_system
::instance());
110 $showreports = $showreports ||
(new registration())->toolkit_is_active();
112 // Create a link to the main page in the reports menu.
115 new admin_externalpage(
116 'tool_brickfield_reports',
117 get_string('pluginname', manager
::PLUGINNAME
),
119 accessibility
::get_capability_name('viewsystemtools'),
120 $accessibilitydisabled ||
!$showreports