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 $settings->add(new admin_setting_configtextarea('assign/submissionstatement',
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',
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',
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',
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',
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',
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',
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".
139 'none' => get_string('attemptreopenmethod_none', 'mod_assign'),
140 'manual' => get_string('attemptreopenmethod_manual', 'mod_assign'),
141 'untilpass' => get_string('attemptreopenmethod_untilpass', 'mod_assign')
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',
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',
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',
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('requireallteammemberssubmit', 'mod_assign');
179 $description = new lang_string('requireallteammemberssubmit_help', 'mod_assign');
180 $setting = new admin_setting_configcheckbox('assign/requireallteammemberssubmit',
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('teamsubmissiongroupingid', 'mod_assign');
189 $description = new lang_string('teamsubmissiongroupingid_help', 'mod_assign');
190 $setting = new admin_setting_configempty('assign/teamsubmissiongroupingid',
193 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
194 $settings->add($setting);
196 $name = new lang_string('sendnotifications', 'mod_assign');
197 $description = new lang_string('sendnotifications_help', 'mod_assign');
198 $setting = new admin_setting_configcheckbox('assign/sendnotifications',
202 $setting->set_advanced_flag_options(admin_setting_flag
::ENABLED
, false);
203 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
204 $settings->add($setting);
206 $name = new lang_string('sendlatenotifications', 'mod_assign');
207 $description = new lang_string('sendlatenotifications_help', 'mod_assign');
208 $setting = new admin_setting_configcheckbox('assign/sendlatenotifications',
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('blindmarking', 'mod_assign');
217 $description = new lang_string('blindmarking_help', 'mod_assign');
218 $setting = new admin_setting_configcheckbox('assign/blindmarking',
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('markingworkflow', 'mod_assign');
227 $description = new lang_string('markingworkflow_help', 'mod_assign');
228 $setting = new admin_setting_configcheckbox('assign/markingworkflow',
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('markingallocation', 'mod_assign');
237 $description = new lang_string('markingallocation_help', 'mod_assign');
238 $setting = new admin_setting_configcheckbox('assign/markingallocation',
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);
247 $ADMIN->add('modassignfolder', $settings);
248 // Tell core we already added the settings structure.
251 $ADMIN->add('modassignfolder', new admin_category('assignsubmissionplugins',
252 new lang_string('submissionplugins', 'assign'), !$module->is_enabled()));
253 $ADMIN->add('assignsubmissionplugins', new assign_admin_page_manage_assign_plugins('assignsubmission'));
254 $ADMIN->add('modassignfolder', new admin_category('assignfeedbackplugins',
255 new lang_string('feedbackplugins', 'assign'), !$module->is_enabled()));
256 $ADMIN->add('assignfeedbackplugins', new assign_admin_page_manage_assign_plugins('assignfeedback'));
258 foreach (core_plugin_manager
::instance()->get_plugins_of_type('assignsubmission') as $plugin) {
259 /** @var \mod_assign\plugininfo\assignsubmission $plugin */
260 $plugin->load_settings($ADMIN, 'assignsubmissionplugins', $hassiteconfig);
263 foreach (core_plugin_manager
::instance()->get_plugins_of_type('assignfeedback') as $plugin) {
264 /** @var \mod_assign\plugininfo\assignfeedback $plugin */
265 $plugin->load_settings($ADMIN, 'assignfeedbackplugins', $hassiteconfig);