-
Notifications
You must be signed in to change notification settings - Fork 6
/
settings.php
executable file
·203 lines (177 loc) · 9.88 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?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/>.
/**
* Settings for plugin Course Manager.
*
* @package report_coursemanager
* @copyright 2022 Olivier VALENTIN
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
// Settings for reports calculation.
$settings->add(new admin_setting_heading('reportssettingsheading',
get_string('reportssettingsheading', 'report_coursemanager'), ''));
// Define which role is defined as teacher in courses to retrieve course list on dashboard.
$rolesoptions = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT, true);
$editingteachers = get_archetype_roles('editingteacher');
$settings->add(
new admin_setting_configselect('report_coursemanager/teacher_role_dashboard',
get_string('teacherroledashboard', 'report_coursemanager'),
get_string('teacherroledashboard_desc', 'report_coursemanager'),
'3',
$rolesoptions
)
);
// Defines other teacher roles to consider when counting the number of teachers in a course.
$rolesoptions = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT, true);
$teachers = get_archetype_roles('teacher');
$settings->add(
new admin_setting_configmultiselect('report_coursemanager/other_teacher_role_dashboard',
get_string('otherteacherroledashboard', 'report_coursemanager'),
get_string('otherteacherroledashboard_desc', 'report_coursemanager'),
[''],
$rolesoptions
)
);
// Define which role is defined as student in courses to calculate reports.
$rolesoptions = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT, true);
$students = get_archetype_roles('student');
$settings->add(
new admin_setting_configselect('report_coursemanager/student_role_report',
get_string('studentrolereport', 'report_coursemanager'),
get_string('studentrolereport_desc', 'report_coursemanager'),
'5',
$rolesoptions
)
);
// Limit for total course files size before warning.
$name = 'report_coursemanager/total_filesize_threshold';
$title = get_string('total_filesize_threshold', 'report_coursemanager');
$description = get_string('total_filesize_threshold_desc', 'report_coursemanager');
$settings->add(new admin_setting_configtext($name, $title, $description, null, PARAM_TEXT, '5'));
// Limit for single file size before warning.
$name = 'report_coursemanager/unique_filesize_threshold';
$title = get_string('unique_filesize_threshold', 'report_coursemanager');
$description = get_string('unique_filesize_threshold_desc', 'report_coursemanager');
$settings->add(new admin_setting_configtext($name, $title, $description, null, PARAM_TEXT, '5'));
// Number of days without teacher visit before warn.
$name = 'report_coursemanager/last_access_teacher';
$title = get_string('last_access_teacher', 'report_coursemanager');
$description = get_string('last_access_teacher_desc', 'report_coursemanager');
$settings->add(new admin_setting_configtext($name, $title, $description, null, PARAM_TEXT, '5'));
// Number of days without student visit before warn.
$name = 'report_coursemanager/last_access_student';
$title = get_string('last_access_student', 'report_coursemanager');
$description = get_string('last_access_student_desc', 'report_coursemanager');
$settings->add(new admin_setting_configtext($name, $title, $description, null, PARAM_TEXT, '5'));
// Settings for trash category.
$settings->add(new admin_setting_heading('trashsettingsheading',
get_string('trashsettingsheading', 'report_coursemanager'), ''));
// Define trash category.
$displaylist = core_course_category::make_categories_list();
$name = 'report_coursemanager/category_bin';
$title = get_string('category_bin', 'report_coursemanager');
$description = get_string('category_bin_desc', 'report_coursemanager');
$settings->add(new admin_setting_configselect($name, $title, $description, null, $displaylist));
// Information text when courses in trash category will be deleted.
$name = 'report_coursemanager/delete_period';
$title = get_string('delete_period', 'report_coursemanager');
$description = get_string('delete_period_desc', 'report_coursemanager');
$settings->add(new admin_setting_configtext($name, $title, $description, null, PARAM_TEXT, '50'));
// Roles that should receive the warning email when deleting a course.
$settings->add(new admin_setting_configmultiselect('report_coursemanager/delete_send_mail',
get_string('delete_send_mail', 'report_coursemanager'),
get_string('delete_send_mail_desc', 'report_coursemanager'),
['3'], $rolesoptions)
);
// Reports displaying and availability.
$settings->add(new admin_setting_heading('reportsheading',
get_string('reportsheading', 'report_coursemanager'), ''));
// Define if reports are displayed in courses and which place to use.
$showreportincoursechoices = [
get_string('show_report_in_course_choices_none', 'report_coursemanager'),
get_string('show_report_in_course_choices_collapse', 'report_coursemanager'),
get_string('show_report_in_course_choices_popover', 'report_coursemanager'),
];
$name = 'report_coursemanager/show_report_in_course';
$title = get_string('show_report_in_course', 'report_coursemanager');
$description = get_string('show_report_in_course_desc', 'report_coursemanager');
$settings->add(new admin_setting_configselect($name, $title, $description, null, $showreportincoursechoices));
// Checkbox for enabling course content task (heavy and empty courses).
$name = 'report_coursemanager/enable_course_content_task';
$title = get_string('enablecoursecontenttask', 'report_coursemanager');
$description = get_string('enablecoursecontenttask_desc', 'report_coursemanager');
$settings->add(new admin_setting_configcheckbox($name, $title, $description, 0));
// Checkbox for enabling teachers task (courses without teachers or without teachers visits).
$name = 'report_coursemanager/enable_teachers_task';
$title = get_string('enableteacherstask', 'report_coursemanager');
$description = get_string('enableteacherstask_desc', 'report_coursemanager');
$settings->add(new admin_setting_configcheckbox($name, $title, $description, 0));
// Checkbox for enabling students task (courses without students or without students visits).
$name = 'report_coursemanager/enable_students_task';
$title = get_string('enablestudentstask', 'report_coursemanager');
$description = get_string('enablestudentstask_desc', 'report_coursemanager');
$settings->add(new admin_setting_configcheckbox($name, $title, $description, 0));
// Checkbox for enabling orphan submissions task.
$name = 'report_coursemanager/enable_orphans_task';
$title = get_string('enableorphanstask', 'report_coursemanager');
$description = get_string('enableorphanstask_desc', 'report_coursemanager');
$settings->add(new admin_setting_configcheckbox($name, $title, $description, 0));
// Settings for teachers mailing.
$settings->add(new admin_setting_heading('mailingheading',
get_string('mailingheading', 'report_coursemanager'), ''));
// Checkbox for enabling reports mailing.
$name = 'report_coursemanager/enable_mailing';
$title = get_string('enablemailing', 'report_coursemanager');
$description = get_string('enablemailing_desc', 'report_coursemanager');
$settings->add(new admin_setting_configcheckbox($name, $title, $description, 0));
// Subject of the email for report mailing.
$name = 'report_coursemanager/mailing_title';
$title = get_string('mailingtitle_setting', 'report_coursemanager');
$description = get_string('mailingtitle_setting_desc', 'report_coursemanager');
$default = get_string('mailingtitle', 'report_coursemanager');
$settings->add(new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT, '50'));
// Introduction for report mailing.
$name = 'report_coursemanager/mailing_introduction';
$title = get_string('mailingintro_setting', 'report_coursemanager');
$description = get_string('mailingintro_setting_desc', 'report_coursemanager');
$settings->add(
new admin_setting_configtextarea(
$name,
$title,
$description,
get_string('mailingintro', 'report_coursemanager'),
PARAM_RAW
)
);
// Outro for report mailing.
$name = 'report_coursemanager/mailing_outro';
$title = get_string('mailingoutro_setting', 'report_coursemanager');
$description = get_string('mailingoutro_setting_desc', 'report_coursemanager');
$settings->add(
new admin_setting_configtextarea(
$name,
$title,
$description,
get_string('mailingoutro', 'report_coursemanager'),
PARAM_RAW
)
);
}
$ADMIN->add('reports', new admin_externalpage('report_coursemanager',
get_string('pluginname', 'report_coursemanager'),
new moodle_url('/report/coursemanager/admin_dashboard/index.php')));