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 * This file adds the settings pages to the navigation menu
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') ||
die;
27 require_once($CFG->dirroot
. '/mod/assign/adminlib.php');
29 $ADMIN->add('modsettings', new admin_category('modassignfolder', new lang_string('pluginname', 'mod_assign'), $module->is_enabled() === false));
31 $settings = new admin_settingpage($section, get_string('settings', 'mod_assign'), 'moodle/site:config', $module->is_enabled() === false);
33 if ($ADMIN->fulltree
) {
35 foreach (core_component
::get_plugin_list('assignfeedback') as $type => $notused) {
36 $visible = !get_config('assignfeedback_' . $type, 'disabled');
38 $menu['assignfeedback_' . $type] = new lang_string('pluginname', 'assignfeedback_' . $type);
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');
45 $settings->add(new admin_setting_configselect('assign/feedback_plugin_for_gradebook',
48 'assignfeedback_comments',
51 $name = new lang_string('showrecentsubmissions', 'mod_assign');
52 $description = new lang_string('configshowrecentsubmissions', 'mod_assign');
53 $settings->add(new admin_setting_configcheckbox('assign/showrecentsubmissions',
58 $name = new lang_string('sendsubmissionreceipts', 'mod_assign');
59 $description = new lang_string('sendsubmissionreceipts_help', 'mod_assign');
60 $settings->add(new admin_setting_configcheckbox('assign/submissionreceipts',
65 $name = new lang_string('submissionstatement', 'mod_assign');
66 $description = new lang_string('submissionstatement_help', 'mod_assign');
67 $default = get_string('submissionstatementdefault', 'mod_assign');
68 $setting = new admin_setting_configtextarea('assign/submissionstatement',
72 $setting->set_force_ltr(false);
73 $settings->add($setting);
75 $name = new lang_string('submissionstatementteamsubmission', 'mod_assign');
76 $description = new lang_string('submissionstatement_help', 'mod_assign');
77 $default = get_string('submissionstatementteamsubmissiondefault', 'mod_assign');
78 $setting = new admin_setting_configtextarea('assign/submissionstatementteamsubmission',
82 $setting->set_force_ltr(false);
83 $settings->add($setting);
85 $name = new lang_string('submissionstatementteamsubmissionallsubmit', 'mod_assign');
86 $description = new lang_string('submissionstatement_help', 'mod_assign');
87 $default = get_string('submissionstatementteamsubmissionallsubmitdefault', 'mod_assign');
88 $setting = new admin_setting_configtextarea('assign/submissionstatementteamsubmissionallsubmit',
92 $setting->set_force_ltr(false);
93 $settings->add($setting);
95 $name = new lang_string('maxperpage', 'mod_assign');
97 -1 => get_string('unlimitedpages', 'mod_assign'),
103 $description = new lang_string('maxperpage_help', 'mod_assign');
104 $settings->add(new admin_setting_configselect('assign/maxperpage',
110 $name = new lang_string('defaultsettings', 'mod_assign');
111 $description = new lang_string('defaultsettings_help', 'mod_assign');
112 $settings->add(new admin_setting_heading('defaultsettings', $name, $description));
114 $name = new lang_string('alwaysshowdescription', 'mod_assign');
115 $description = new lang_string('alwaysshowdescription_help', 'mod_assign');
116 $setting = new admin_setting_configcheckbox('assign/alwaysshowdescription',
120 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
121 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
122 $settings->add($setting);
124 $name = new lang_string('allowsubmissionsfromdate', 'mod_assign');
125 $description = new lang_string('allowsubmissionsfromdate_help', 'mod_assign');
126 $setting = new admin_setting_configduration('assign/allowsubmissionsfromdate',
130 $setting->set_enabled_flag_options(admin_setting_flag
::ENABLED
, true);
131 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
132 $settings->add($setting);
134 $name = new lang_string('duedate', 'mod_assign');
135 $description = new lang_string('duedate_help', 'mod_assign');
136 $setting = new admin_setting_configduration('assign/duedate',
140 $setting->set_enabled_flag_options(admin_setting_flag
::ENABLED
, true);
141 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
142 $settings->add($setting);
144 $name = new lang_string('cutoffdate', 'mod_assign');
145 $description = new lang_string('cutoffdate_help', 'mod_assign');
146 $setting = new admin_setting_configduration('assign/cutoffdate',
150 $setting->set_enabled_flag_options(admin_setting_flag
::ENABLED
, false);
151 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
152 $settings->add($setting);
154 $name = new lang_string('gradingduedate', 'mod_assign');
155 $description = new lang_string('gradingduedate_help', 'mod_assign');
156 $setting = new admin_setting_configduration('assign/gradingduedate',
160 $setting->set_enabled_flag_options(admin_setting_flag
::ENABLED
, true);
161 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
162 $settings->add($setting);
164 $name = new lang_string('submissiondrafts', 'mod_assign');
165 $description = new lang_string('submissiondrafts_help', 'mod_assign');
166 $setting = new admin_setting_configcheckbox('assign/submissiondrafts',
170 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
171 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
172 $settings->add($setting);
174 $name = new lang_string('requiresubmissionstatement', 'mod_assign');
175 $description = new lang_string('requiresubmissionstatement_help', 'mod_assign');
176 $setting = new admin_setting_configcheckbox('assign/requiresubmissionstatement',
180 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
181 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
182 $settings->add($setting);
184 // Constants from "locallib.php".
186 'none' => get_string('attemptreopenmethod_none', 'mod_assign'),
187 'manual' => get_string('attemptreopenmethod_manual', 'mod_assign'),
188 'untilpass' => get_string('attemptreopenmethod_untilpass', 'mod_assign')
190 $name = new lang_string('attemptreopenmethod', 'mod_assign');
191 $description = new lang_string('attemptreopenmethod_help', 'mod_assign');
192 $setting = new admin_setting_configselect('assign/attemptreopenmethod',
197 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
198 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
199 $settings->add($setting);
201 // Constants from "locallib.php".
202 $options = array(-1 => get_string('unlimitedattempts', 'mod_assign'));
203 $options +
= array_combine(range(1, 30), range(1, 30));
204 $name = new lang_string('maxattempts', 'mod_assign');
205 $description = new lang_string('maxattempts_help', 'mod_assign');
206 $setting = new admin_setting_configselect('assign/maxattempts',
211 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
212 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
213 $settings->add($setting);
215 $name = new lang_string('teamsubmission', 'mod_assign');
216 $description = new lang_string('teamsubmission_help', 'mod_assign');
217 $setting = new admin_setting_configcheckbox('assign/teamsubmission',
221 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
222 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
223 $settings->add($setting);
225 $name = new lang_string('preventsubmissionnotingroup', 'mod_assign');
226 $description = new lang_string('preventsubmissionnotingroup_help', 'mod_assign');
227 $setting = new admin_setting_configcheckbox('assign/preventsubmissionnotingroup',
231 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
232 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
233 $settings->add($setting);
235 $name = new lang_string('requireallteammemberssubmit', 'mod_assign');
236 $description = new lang_string('requireallteammemberssubmit_help', 'mod_assign');
237 $setting = new admin_setting_configcheckbox('assign/requireallteammemberssubmit',
241 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
242 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
243 $settings->add($setting);
245 $name = new lang_string('teamsubmissiongroupingid', 'mod_assign');
246 $description = new lang_string('teamsubmissiongroupingid_help', 'mod_assign');
247 $setting = new admin_setting_configempty('assign/teamsubmissiongroupingid',
250 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
251 $settings->add($setting);
253 $name = new lang_string('sendnotifications', 'mod_assign');
254 $description = new lang_string('sendnotifications_help', 'mod_assign');
255 $setting = new admin_setting_configcheckbox('assign/sendnotifications',
259 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
260 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
261 $settings->add($setting);
263 $name = new lang_string('sendlatenotifications', 'mod_assign');
264 $description = new lang_string('sendlatenotifications_help', 'mod_assign');
265 $setting = new admin_setting_configcheckbox('assign/sendlatenotifications',
269 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
270 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
271 $settings->add($setting);
273 $name = new lang_string('sendstudentnotificationsdefault', 'mod_assign');
274 $description = new lang_string('sendstudentnotificationsdefault_help', 'mod_assign');
275 $setting = new admin_setting_configcheckbox('assign/sendstudentnotifications',
279 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
280 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
281 $settings->add($setting);
283 $name = new lang_string('blindmarking', 'mod_assign');
284 $description = new lang_string('blindmarking_help', 'mod_assign');
285 $setting = new admin_setting_configcheckbox('assign/blindmarking',
289 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
290 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
291 $settings->add($setting);
293 $name = new lang_string('hidegrader', 'mod_assign');
294 $description = new lang_string('hidegrader_help', 'mod_assign');
295 $setting = new admin_setting_configcheckbox('assign/hidegrader',
299 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
300 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
301 $settings->add($setting);
303 $name = new lang_string('markingworkflow', 'mod_assign');
304 $description = new lang_string('markingworkflow_help', 'mod_assign');
305 $setting = new admin_setting_configcheckbox('assign/markingworkflow',
309 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
310 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
311 $settings->add($setting);
313 $name = new lang_string('markingallocation', 'mod_assign');
314 $description = new lang_string('markingallocation_help', 'mod_assign');
315 $setting = new admin_setting_configcheckbox('assign/markingallocation',
319 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
320 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
321 $settings->add($setting);
324 $ADMIN->add('modassignfolder', $settings);
325 // Tell core we already added the settings structure.
328 $ADMIN->add('modassignfolder', new admin_category('assignsubmissionplugins',
329 new lang_string('submissionplugins', 'assign'), !$module->is_enabled()));
330 $ADMIN->add('assignsubmissionplugins', new assign_admin_page_manage_assign_plugins('assignsubmission'));
331 $ADMIN->add('modassignfolder', new admin_category('assignfeedbackplugins',
332 new lang_string('feedbackplugins', 'assign'), !$module->is_enabled()));
333 $ADMIN->add('assignfeedbackplugins', new assign_admin_page_manage_assign_plugins('assignfeedback'));
335 foreach (core_plugin_manager
::instance()->get_plugins_of_type('assignsubmission') as $plugin) {
336 /** @var \mod_assign\plugininfo\assignsubmission $plugin */
337 $plugin->load_settings($ADMIN, 'assignsubmissionplugins', $hassiteconfig);
340 foreach (core_plugin_manager
::instance()->get_plugins_of_type('assignfeedback') as $plugin) {
341 /** @var \mod_assign\plugininfo\assignfeedback $plugin */
342 $plugin->load_settings($ADMIN, 'assignfeedbackplugins', $hassiteconfig);