-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsettings.php
More file actions
142 lines (126 loc) · 5.8 KB
/
Copy pathsettings.php
File metadata and controls
142 lines (126 loc) · 5.8 KB
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
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Plugin administration pages are defined here.
*
* @package block_coursefeedback
* @copyright 2025 innoCampus, Technische Universität Berlin
* @copyright 2025 IT.Services, Ruhr-Universität Bochum
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use block_coursefeedback\local\course_organization_mapping\course_organization_mapping;
use block_coursefeedback\local\course_semester_mapping\course_semester_mapping;
use block_coursefeedback\local\default_survey_creation_method\default_survey_creation_method;
use block_coursefeedback\local\hook_callbacks;
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$ADMIN->add('blocksettings', new admin_category(
'block_coursefeedback_category',
new lang_string('pluginname', 'block_coursefeedback'),
));
$settings = new admin_settingpage(
'block_coursefeedback_settings',
new lang_string('settings:general_settings', 'block_coursefeedback'),
);
if ($ADMIN->fulltree) {
$setting = new admin_setting_configcheckbox(
'block_coursefeedback/add_block',
get_string('add_block', 'block_coursefeedback'),
'',
0
);
$setting->set_updatedcallback(hook_callbacks::add_block_changed_callback(...));
$settings->add($setting);
$settings->add(
new admin_setting_configselect(
'block_coursefeedback/course_organization_method',
new lang_string('settings:course_organization_method', 'block_coursefeedback'),
'',
course_organization_mapping::MAP_BY_COURSECAT,
[
course_organization_mapping::MAP_BY_COURSECAT =>
new lang_string('settings:course_organization_method:coursecat', 'block_coursefeedback'),
],
)
);
$semester_mapping_setting = new admin_setting_configselect(
'block_coursefeedback/course_semester_method',
new lang_string('settings:course_semester_method', 'block_coursefeedback'),
'',
course_semester_mapping::MAP_MATCH_ALL,
[
course_semester_mapping::MAP_MATCH_ALL =>
new lang_string('settings:course_semester_method:match_all', 'block_coursefeedback'),
course_semester_mapping::MAP_BY_CUSTOMFIELD =>
new lang_string('settings:course_semester_method:customfield', 'block_coursefeedback'),
course_semester_mapping::MAP_MOSES =>
new lang_string('settings:course_semester_method:moses', 'block_coursefeedback'),
],
);
$semester_mapping_setting->set_validate_function(course_semester_mapping::validate_method(...));
$settings->add($semester_mapping_setting);
$settings->add(
new admin_setting_configselect(
'block_coursefeedback/default_survey_creation_method',
new lang_string('settings:default_survey_creation_method', 'block_coursefeedback'),
'',
default_survey_creation_method::METHOD_CREATE_EMPTY,
[
default_survey_creation_method::METHOD_CREATE_EMPTY =>
new lang_string('settings:default_survey_creation_method:create_empty', 'block_coursefeedback'),
default_survey_creation_method::METHOD_RUB =>
new lang_string('settings:default_survey_creation_method:rub', 'block_coursefeedback'),
]
)
);
$settings->add(
new admin_setting_configtext(
'block_coursefeedback/report_min_responses_overall',
new lang_string('settings:report_min_responses_overall', 'block_coursefeedback'),
'',
3,
PARAM_INT,
)
);
$settings->add(
new admin_setting_configtext(
'block_coursefeedback/report_min_responses_per_item',
new lang_string('settings:report_min_responses_per_item', 'block_coursefeedback'),
'',
3,
PARAM_INT,
)
);
}
$ADMIN->add('block_coursefeedback_category', $settings);
$ADMIN->add('block_coursefeedback_category', new admin_externalpage(
'block_coursefeedback_category_organization',
get_string('organizations', 'block_coursefeedback'),
new moodle_url('/blocks/coursefeedback/organizations.php'),
'block/coursefeedback:manageorganizations',
));
$ADMIN->add('block_coursefeedback_category', new admin_externalpage(
'block_coursefeedback_category_survey',
get_string('questionnaires', 'block_coursefeedback'),
new moodle_url('/blocks/coursefeedback/surveyparts.php'),
'block/coursefeedback:managesurveysglobally',
));
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf
if ($ADMIN->fulltree) {
// TO-DO: Define actual plugin settings page and add it to the tree - {@link https://docs.moodle.org/dev/Admin_settings}.
}
}
$settings = null;