Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   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   * Settings for the myoverview block
  19   *
  20   * @package    block_myoverview
  21   * @copyright  2019 Tom Dickman <tomdickman@catalyst-au.net>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die;
  26  
  27  if ($ADMIN->fulltree) {
  28      require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
  29  
  30      // Presentation options heading.
  31      $settings->add(new admin_setting_heading('block_myoverview/appearance',
  32              get_string('appearance', 'admin'),
  33              ''));
  34  
  35      // Display Course Categories on Dashboard course items (cards, lists, summary items).
  36      $settings->add(new admin_setting_configcheckbox(
  37              'block_myoverview/displaycategories',
  38              get_string('displaycategories', 'block_myoverview'),
  39              get_string('displaycategories_help', 'block_myoverview'),
  40              1));
  41  
  42      // Enable / Disable available layouts.
  43      $choices = array(BLOCK_MYOVERVIEW_VIEW_CARD => get_string('card', 'block_myoverview'),
  44              BLOCK_MYOVERVIEW_VIEW_LIST => get_string('list', 'block_myoverview'),
  45              BLOCK_MYOVERVIEW_VIEW_SUMMARY => get_string('summary', 'block_myoverview'));
  46      $settings->add(new admin_setting_configmulticheckbox(
  47              'block_myoverview/layouts',
  48              get_string('layouts', 'block_myoverview'),
  49              get_string('layouts_help', 'block_myoverview'),
  50              $choices,
  51              $choices));
  52      unset ($choices);
  53  
  54      // Enable / Disable course filter items.
  55      $settings->add(new admin_setting_heading('block_myoverview/availablegroupings',
  56              get_string('availablegroupings', 'block_myoverview'),
  57              get_string('availablegroupings_desc', 'block_myoverview')));
  58  
  59      $settings->add(new admin_setting_configcheckbox(
  60              'block_myoverview/displaygroupingallincludinghidden',
  61              get_string('allincludinghidden', 'block_myoverview'),
  62              '',
  63              0));
  64  
  65      $settings->add(new admin_setting_configcheckbox(
  66              'block_myoverview/displaygroupingall',
  67              get_string('all', 'block_myoverview'),
  68              '',
  69              1));
  70  
  71      $settings->add(new admin_setting_configcheckbox(
  72              'block_myoverview/displaygroupinginprogress',
  73              get_string('inprogress', 'block_myoverview'),
  74              '',
  75              1));
  76  
  77      $settings->add(new admin_setting_configcheckbox(
  78              'block_myoverview/displaygroupingpast',
  79              get_string('past', 'block_myoverview'),
  80              '',
  81              1));
  82  
  83      $settings->add(new admin_setting_configcheckbox(
  84              'block_myoverview/displaygroupingfuture',
  85              get_string('future', 'block_myoverview'),
  86              '',
  87              1));
  88  
  89      $settings->add(new admin_setting_configcheckbox(
  90              'block_myoverview/displaygroupingcustomfield',
  91              get_string('customfield', 'block_myoverview'),
  92              '',
  93              0));
  94  
  95      $choices = \core_customfield\api::get_fields_supporting_course_grouping();
  96      if ($choices) {
  97          $choices  = ['' => get_string('choosedots')] + $choices;
  98          $settings->add(new admin_setting_configselect(
  99                  'block_myoverview/customfiltergrouping',
 100                  get_string('customfiltergrouping', 'block_myoverview'),
 101                  '',
 102                  '',
 103                  $choices));
 104      } else {
 105          $settings->add(new admin_setting_configempty(
 106                  'block_myoverview/customfiltergrouping',
 107                  get_string('customfiltergrouping', 'block_myoverview'),
 108                  get_string('customfiltergrouping_nofields', 'block_myoverview')));
 109      }
 110      $settings->hide_if('block_myoverview/customfiltergrouping', 'block_myoverview/displaygroupingcustomfield');
 111  
 112      $settings->add(new admin_setting_configcheckbox(
 113              'block_myoverview/displaygroupingfavourites',
 114              get_string('favourites', 'block_myoverview'),
 115              '',
 116              1));
 117  
 118      $settings->add(new admin_setting_configcheckbox(
 119              'block_myoverview/displaygroupinghidden',
 120              get_string('hiddencourses', 'block_myoverview'),
 121              '',
 122              1));
 123  }