Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

   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  
  25  defined('MOODLE_INTERNAL') || die;
  26  
  27  require_once($CFG->dirroot . '/mod/assign/adminlib.php');
  28  
  29  $ADMIN->add('modsettings', new admin_category('modassignfolder', new lang_string('pluginname', 'mod_assign'), $module->is_enabled() === false));
  30  
  31  $settings = new admin_settingpage($section, get_string('settings', 'mod_assign'), 'moodle/site:config', $module->is_enabled() === false);
  32  
  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      }
  41  
  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));
  50  
  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));
  57  
  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));
  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');
  68      $setting = new admin_setting_configtextarea('assign/submissionstatement',
  69                                                      $name,
  70                                                      $description,
  71                                                      $default);
  72      $setting->set_force_ltr(false);
  73      $settings->add($setting);
  74  
  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',
  79          $name,
  80          $description,
  81          $default);
  82      $setting->set_force_ltr(false);
  83      $settings->add($setting);
  84  
  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',
  89          $name,
  90          $description,
  91          $default);
  92      $setting->set_force_ltr(false);
  93      $settings->add($setting);
  94  
  95      $name = new lang_string('maxperpage', 'mod_assign');
  96      $options = array(
  97          -1 => get_string('unlimitedpages', 'mod_assign'),
  98          10 => 10,
  99          20 => 20,
 100          50 => 50,
 101          100 => 100,
 102      );
 103      $description = new lang_string('maxperpage_help', 'mod_assign');
 104      $settings->add(new admin_setting_configselect('assign/maxperpage',
 105                                                      $name,
 106                                                      $description,
 107                                                      -1,
 108                                                      $options));
 109  
 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));
 113  
 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',
 117                                                      $name,
 118                                                      $description,
 119                                                      1);
 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);
 123  
 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',
 127                                                      $name,
 128                                                      $description,
 129                                                      0);
 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);
 133  
 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',
 137                                                      $name,
 138                                                      $description,
 139                                                      604800);
 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);
 143  
 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',
 147                                                      $name,
 148                                                      $description,
 149                                                      1209600);
 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);
 153  
 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',
 157                                                      $name,
 158                                                      $description,
 159                                                      1209600);
 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);
 163  
 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',
 167                                                      $name,
 168                                                      $description,
 169                                                      0);
 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);
 173  
 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',
 177                                                      $name,
 178                                                      $description,
 179                                                      0);
 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);
 183  
 184      // Constants from "locallib.php".
 185      $options = array(
 186          'none' => get_string('attemptreopenmethod_none', 'mod_assign'),
 187          'manual' => get_string('attemptreopenmethod_manual', 'mod_assign'),
 188          'untilpass' => get_string('attemptreopenmethod_untilpass', 'mod_assign')
 189      );
 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',
 193                                                      $name,
 194                                                      $description,
 195                                                      'none',
 196                                                      $options);
 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);
 200  
 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',
 207                                                      $name,
 208                                                      $description,
 209                                                      -1,
 210                                                      $options);
 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);
 214  
 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',
 218                                                      $name,
 219                                                      $description,
 220                                                      0);
 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);
 224  
 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',
 228          $name,
 229          $description,
 230          0);
 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);
 234  
 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',
 238                                                      $name,
 239                                                      $description,
 240                                                      0);
 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);
 244  
 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',
 248                                                      $name,
 249                                                      $description);
 250      $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
 251      $settings->add($setting);
 252  
 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',
 256                                                      $name,
 257                                                      $description,
 258                                                      0);
 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);
 262  
 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',
 266                                                      $name,
 267                                                      $description,
 268                                                      0);
 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);
 272  
 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',
 276                                                      $name,
 277                                                      $description,
 278                                                      1);
 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);
 282  
 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',
 286                                                      $name,
 287                                                      $description,
 288                                                      0);
 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);
 292  
 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',
 296                                                      $name,
 297                                                      $description,
 298                                                      0);
 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);
 302  
 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',
 306                                                      $name,
 307                                                      $description,
 308                                                      0);
 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);
 312  
 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',
 316                                                      $name,
 317                                                      $description,
 318                                                      0);
 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);
 322  }
 323  
 324  $ADMIN->add('modassignfolder', $settings);
 325  // Tell core we already added the settings structure.
 326  $settings = null;
 327  
 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'));
 334  
 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);
 338  }
 339  
 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);
 343  }