Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * The workshop module configuration variables
  20   *
  21   * The values defined here are often used as defaults for all module instances.
  22   *
  23   * @package    mod_workshop
  24   * @copyright  2009 David Mudrak <david.mudrak@gmail.com>
  25   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  
  28  defined('MOODLE_INTERNAL') || die();
  29  
  30  if ($ADMIN->fulltree) {
  31      require_once($CFG->dirroot.'/mod/workshop/locallib.php');
  32  
  33      $grades = workshop::available_maxgrades_list();
  34  
  35      $settings->add(new admin_setting_configselect('workshop/grade', get_string('submissiongrade', 'workshop'),
  36                          get_string('configgrade', 'workshop'), 80, $grades));
  37  
  38      $settings->add(new admin_setting_configselect('workshop/gradinggrade', get_string('gradinggrade', 'workshop'),
  39                          get_string('configgradinggrade', 'workshop'), 20, $grades));
  40  
  41      $options = array();
  42      for ($i = 5; $i >= 0; $i--) {
  43          $options[$i] = $i;
  44      }
  45      $settings->add(new admin_setting_configselect('workshop/gradedecimals', get_string('gradedecimals', 'workshop'),
  46                          get_string('configgradedecimals', 'workshop'), 0, $options));
  47  
  48      if (isset($CFG->maxbytes)) {
  49          $maxbytes = get_config('workshop', 'maxbytes');
  50          $options = get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes);
  51          $settings->add(new admin_setting_configselect('workshop/maxbytes', get_string('maxbytes', 'workshop'),
  52                              get_string('configmaxbytes', 'workshop'), 0, $options));
  53      }
  54  
  55      $settings->add(new admin_setting_configselect('workshop/strategy', get_string('strategy', 'workshop'),
  56                          get_string('configstrategy', 'workshop'), 'accumulative', workshop::available_strategies_list()));
  57  
  58      $options = workshop::available_example_modes_list();
  59      $settings->add(new admin_setting_configselect('workshop/examplesmode', get_string('examplesmode', 'workshop'),
  60                          get_string('configexamplesmode', 'workshop'), workshop::EXAMPLES_VOLUNTARY, $options));
  61  
  62      // include the settings of allocation subplugins
  63      $allocators = core_component::get_plugin_list('workshopallocation');
  64      foreach ($allocators as $allocator => $path) {
  65          if (file_exists($settingsfile = $path . '/settings.php')) {
  66              $settings->add(new admin_setting_heading('workshopallocationsetting'.$allocator,
  67                      get_string('allocation', 'workshop') . ' - ' . get_string('pluginname', 'workshopallocation_' . $allocator), ''));
  68              include($settingsfile);
  69          }
  70      }
  71  
  72      // include the settings of grading strategy subplugins
  73      $strategies = core_component::get_plugin_list('workshopform');
  74      foreach ($strategies as $strategy => $path) {
  75          if (file_exists($settingsfile = $path . '/settings.php')) {
  76              $settings->add(new admin_setting_heading('workshopformsetting'.$strategy,
  77                      get_string('strategy', 'workshop') . ' - ' . get_string('pluginname', 'workshopform_' . $strategy), ''));
  78              include($settingsfile);
  79          }
  80      }
  81  
  82      // include the settings of grading evaluation subplugins
  83      $evaluations = core_component::get_plugin_list('workshopeval');
  84      foreach ($evaluations as $evaluation => $path) {
  85          if (file_exists($settingsfile = $path . '/settings.php')) {
  86              $settings->add(new admin_setting_heading('workshopevalsetting'.$evaluation,
  87                      get_string('evaluation', 'workshop') . ' - ' . get_string('pluginname', 'workshopeval_' . $evaluation), ''));
  88              include($settingsfile);
  89          }
  90      }
  91  
  92  }