MDL-50525 mod_assign: Moved preventsubmissionnotingroup
[moodle.git] / mod / assign / settings.php
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/>.
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  */
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) {
34     $menu = array();
35     foreach (core_component::get_plugin_list('assignfeedback') as $type => $notused) {
36         $visible = !get_config('assignfeedback_' . $type, 'disabled');
37         if ($visible) {
38             $menu['assignfeedback_' . $type] = new lang_string('pluginname', 'assignfeedback_' . $type);
39         }
40     }
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',
46                                                   $name,
47                                                   $description,
48                                                   'assignfeedback_comments',
49                                                   $menu));
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',
54                                                     $name,
55                                                     $description,
56                                                     0));
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',
61                                                     $name,
62                                                     $description,
63                                                     1));
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     $settings->add(new admin_setting_configtextarea('assign/submissionstatement',
69                                                     $name,
70                                                     $description,
71                                                     $default));
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));
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);
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);
95     $settings->add($setting);
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);
105     $settings->add($setting);
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);
115     $settings->add($setting);
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,
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);
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,
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);
137     // Constants from "locallib.php".
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);
154     // Constants from "locallib.php".
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
267 $ADMIN->add('modassignfolder', $settings);
268 // Tell core we already added the settings structure.
269 $settings = null;
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'));
278 foreach (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);
283 foreach (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);