MDL-50525 mod_assign: Moved preventsubmissionnotingroup
[moodle.git] / mod / assign / settings.php
CommitLineData
bbd0e548
DW
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
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.
8//
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.
13//
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/>.
16
17/**
18 * This file adds the settings pages to the navigation menu
19 *
20 * @package mod_assign
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die;
26
27require_once($CFG->dirroot . '/mod/assign/adminlib.php');
28
e87214bd 29$ADMIN->add('modsettings', new admin_category('modassignfolder', new lang_string('pluginname', 'mod_assign'), $module->is_enabled() === false));
bbd0e548 30
e87214bd 31$settings = new admin_settingpage($section, get_string('settings', 'mod_assign'), 'moodle/site:config', $module->is_enabled() === false);
0047693f 32
bbd0e548 33if ($ADMIN->fulltree) {
755bfeca 34 $menu = array();
bd3b3bba 35 foreach (core_component::get_plugin_list('assignfeedback') as $type => $notused) {
bbd0e548
DW
36 $visible = !get_config('assignfeedback_' . $type, 'disabled');
37 if ($visible) {
38 $menu['assignfeedback_' . $type] = new lang_string('pluginname', 'assignfeedback_' . $type);
39 }
40 }
cfc81f03 41
e5403f8c
DW
42 // The default here is feedback_comments (if it exists).
43 $name = new lang_string('feedbackplugin', 'mod_assign');
44 $description = new lang_string('feedbackpluginforgradebook', 'mod_assign');
cfc81f03 45 $settings->add(new admin_setting_configselect('assign/feedback_plugin_for_gradebook',
e5403f8c
DW
46 $name,
47 $description,
48 'assignfeedback_comments',
49 $menu));
50
51 $name = new lang_string('showrecentsubmissions', 'mod_assign');
52 $description = new lang_string('configshowrecentsubmissions', 'mod_assign');
cfc81f03 53 $settings->add(new admin_setting_configcheckbox('assign/showrecentsubmissions',
e5403f8c
DW
54 $name,
55 $description,
56 0));
57
58 $name = new lang_string('sendsubmissionreceipts', 'mod_assign');
59 $description = new lang_string('sendsubmissionreceipts_help', 'mod_assign');
75f87a57 60 $settings->add(new admin_setting_configcheckbox('assign/submissionreceipts',
e5403f8c
DW
61 $name,
62 $description,
63 1));
64
65 $name = new lang_string('submissionstatement', 'mod_assign');
66 $description = new lang_string('submissionstatement_help', 'mod_assign');
67 $default = get_string('submissionstatementdefault', 'mod_assign');
94f26900 68 $settings->add(new admin_setting_configtextarea('assign/submissionstatement',
e5403f8c
DW
69 $name,
70 $description,
71 $default));
72
a8fe74e9
DW
73 $name = new lang_string('defaultsettings', 'mod_assign');
74 $description = new lang_string('defaultsettings_help', 'mod_assign');
75 $settings->add(new admin_setting_heading('defaultsettings', $name, $description));
76
77 $name = new lang_string('alwaysshowdescription', 'mod_assign');
78 $description = new lang_string('alwaysshowdescription_help', 'mod_assign');
79 $setting = new admin_setting_configcheckbox('assign/alwaysshowdescription',
80 $name,
81 $description,
82 1);
83 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
84 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
85 $settings->add($setting);
86
87 $name = new lang_string('allowsubmissionsfromdate', 'mod_assign');
88 $description = new lang_string('allowsubmissionsfromdate_help', 'mod_assign');
89 $setting = new admin_setting_configduration('assign/allowsubmissionsfromdate',
90 $name,
91 $description,
92 0);
93 $setting->set_enabled_flag_options(admin_setting_flag::ENABLED, true);
94 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
a8fe74e9
DW
95 $settings->add($setting);
96
97 $name = new lang_string('duedate', 'mod_assign');
98 $description = new lang_string('duedate_help', 'mod_assign');
99 $setting = new admin_setting_configduration('assign/duedate',
100 $name,
101 $description,
102 604800);
103 $setting->set_enabled_flag_options(admin_setting_flag::ENABLED, true);
104 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
a8fe74e9
DW
105 $settings->add($setting);
106
107 $name = new lang_string('cutoffdate', 'mod_assign');
108 $description = new lang_string('cutoffdate_help', 'mod_assign');
109 $setting = new admin_setting_configduration('assign/cutoffdate',
110 $name,
111 $description,
112 1209600);
113 $setting->set_enabled_flag_options(admin_setting_flag::ENABLED, false);
114 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
a8fe74e9
DW
115 $settings->add($setting);
116
117 $name = new lang_string('submissiondrafts', 'mod_assign');
118 $description = new lang_string('submissiondrafts_help', 'mod_assign');
119 $setting = new admin_setting_configcheckbox('assign/submissiondrafts',
120 $name,
de6a0a39
DW
121 $description,
122 0);
123 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
124 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
125 $settings->add($setting);
126
127 $name = new lang_string('requiresubmissionstatement', 'mod_assign');
128 $description = new lang_string('requiresubmissionstatement_help', 'mod_assign');
129 $setting = new admin_setting_configcheckbox('assign/requiresubmissionstatement',
130 $name,
a8fe74e9
DW
131 $description,
132 0);
133 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
134 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
135 $settings->add($setting);
136
13e82f1c 137 // Constants from "locallib.php".
a8fe74e9
DW
138 $options = array(
139 'none' => get_string('attemptreopenmethod_none', 'mod_assign'),
140 'manual' => get_string('attemptreopenmethod_manual', 'mod_assign'),
141 'untilpass' => get_string('attemptreopenmethod_untilpass', 'mod_assign')
142 );
143 $name = new lang_string('attemptreopenmethod', 'mod_assign');
144 $description = new lang_string('attemptreopenmethod_help', 'mod_assign');
145 $setting = new admin_setting_configselect('assign/attemptreopenmethod',
146 $name,
147 $description,
148 'none',
149 $options);
150 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
151 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
152 $settings->add($setting);
153
13e82f1c 154 // Constants from "locallib.php".
a8fe74e9
DW
155 $options = array(-1 => get_string('unlimitedattempts', 'mod_assign'));
156 $options += array_combine(range(1, 30), range(1, 30));
157 $name = new lang_string('maxattempts', 'mod_assign');
158 $description = new lang_string('maxattempts_help', 'mod_assign');
159 $setting = new admin_setting_configselect('assign/maxattempts',
160 $name,
161 $description,
162 -1,
163 $options);
164 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
165 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
166 $settings->add($setting);
167
168 $name = new lang_string('teamsubmission', 'mod_assign');
169 $description = new lang_string('teamsubmission_help', 'mod_assign');
170 $setting = new admin_setting_configcheckbox('assign/teamsubmission',
171 $name,
172 $description,
173 0);
174 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
175 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
176 $settings->add($setting);
177
b11e24ba
AH
178 $name = new lang_string('preventsubmissionnotingroup', 'mod_assign');
179 $description = new lang_string('preventsubmissionnotingroup_help', 'mod_assign');
180 $setting = new admin_setting_configcheckbox('assign/preventsubmissionnotingroup',
181 $name,
182 $description,
183 0);
184 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
185 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
186 $settings->add($setting);
187
a8fe74e9
DW
188 $name = new lang_string('requireallteammemberssubmit', 'mod_assign');
189 $description = new lang_string('requireallteammemberssubmit_help', 'mod_assign');
190 $setting = new admin_setting_configcheckbox('assign/requireallteammemberssubmit',
191 $name,
192 $description,
193 0);
194 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
195 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
196 $settings->add($setting);
197
c7cd8d9c
DW
198 $name = new lang_string('teamsubmissiongroupingid', 'mod_assign');
199 $description = new lang_string('teamsubmissiongroupingid_help', 'mod_assign');
200 $setting = new admin_setting_configempty('assign/teamsubmissiongroupingid',
201 $name,
202 $description);
203 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
204 $settings->add($setting);
205
a8fe74e9
DW
206 $name = new lang_string('sendnotifications', 'mod_assign');
207 $description = new lang_string('sendnotifications_help', 'mod_assign');
208 $setting = new admin_setting_configcheckbox('assign/sendnotifications',
209 $name,
210 $description,
211 0);
212 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
213 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
214 $settings->add($setting);
215
216 $name = new lang_string('sendlatenotifications', 'mod_assign');
217 $description = new lang_string('sendlatenotifications_help', 'mod_assign');
218 $setting = new admin_setting_configcheckbox('assign/sendlatenotifications',
219 $name,
220 $description,
221 0);
222 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
223 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
224 $settings->add($setting);
225
8e1266bf
DW
226 $name = new lang_string('sendstudentnotificationsdefault', 'mod_assign');
227 $description = new lang_string('sendstudentnotificationsdefault_help', 'mod_assign');
228 $setting = new admin_setting_configcheckbox('assign/sendstudentnotifications',
229 $name,
230 $description,
231 1);
232 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
233 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
234 $settings->add($setting);
235
a8fe74e9
DW
236 $name = new lang_string('blindmarking', 'mod_assign');
237 $description = new lang_string('blindmarking_help', 'mod_assign');
238 $setting = new admin_setting_configcheckbox('assign/blindmarking',
239 $name,
240 $description,
241 0);
242 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
243 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
244 $settings->add($setting);
245
bb6471aa
DW
246 $name = new lang_string('markingworkflow', 'mod_assign');
247 $description = new lang_string('markingworkflow_help', 'mod_assign');
248 $setting = new admin_setting_configcheckbox('assign/markingworkflow',
249 $name,
250 $description,
251 0);
252 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
253 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
254 $settings->add($setting);
255
256 $name = new lang_string('markingallocation', 'mod_assign');
257 $description = new lang_string('markingallocation_help', 'mod_assign');
258 $setting = new admin_setting_configcheckbox('assign/markingallocation',
259 $name,
260 $description,
261 0);
262 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
263 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
264 $settings->add($setting);
0047693f 265}
e87214bd
PS
266
267$ADMIN->add('modassignfolder', $settings);
268// Tell core we already added the settings structure.
269$settings = null;
270
271$ADMIN->add('modassignfolder', new admin_category('assignsubmissionplugins',
272 new lang_string('submissionplugins', 'assign'), !$module->is_enabled()));
273$ADMIN->add('assignsubmissionplugins', new assign_admin_page_manage_assign_plugins('assignsubmission'));
274$ADMIN->add('modassignfolder', new admin_category('assignfeedbackplugins',
275 new lang_string('feedbackplugins', 'assign'), !$module->is_enabled()));
276$ADMIN->add('assignfeedbackplugins', new assign_admin_page_manage_assign_plugins('assignfeedback'));
277
278foreach (core_plugin_manager::instance()->get_plugins_of_type('assignsubmission') as $plugin) {
279 /** @var \mod_assign\plugininfo\assignsubmission $plugin */
280 $plugin->load_settings($ADMIN, 'assignsubmissionplugins', $hassiteconfig);
281}
282
283foreach (core_plugin_manager::instance()->get_plugins_of_type('assignfeedback') as $plugin) {
284 /** @var \mod_assign\plugininfo\assignfeedback $plugin */
285 $plugin->load_settings($ADMIN, 'assignfeedbackplugins', $hassiteconfig);
286}