Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

   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   * Defines site settings for the user gradebook report
  19   *
  20   * @package gradereport_user
  21   * @copyright 2007 Petr Skoda
  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  
  29      $settings->add(
  30          new admin_setting_configcheckbox(
  31              'grade_report_user_showrank',
  32              get_string('showrank', 'grades'),
  33              get_string('showrank_help', 'grades'),
  34              0
  35          )
  36      );
  37  
  38      $settings->add(
  39          new admin_setting_configcheckbox(
  40              'grade_report_user_showpercentage',
  41              get_string('showpercentage', 'grades'),
  42              get_string('showpercentage_help', 'grades'),
  43              1
  44          )
  45      );
  46  
  47      $settings->add(
  48          new admin_setting_configcheckbox(
  49              'grade_report_user_showgrade',
  50              get_string('showgrade', 'grades'),
  51              get_string('showgrade_help', 'grades'),
  52              1
  53          )
  54      );
  55  
  56      $settings->add(
  57          new admin_setting_configcheckbox(
  58              'grade_report_user_showfeedback',
  59              get_string('showfeedback', 'grades'),
  60              get_string('showfeedback_help', 'grades'),
  61              1
  62          )
  63      );
  64  
  65      $settings->add(
  66          new admin_setting_configcheckbox(
  67              'grade_report_user_showrange',
  68              get_string('showrange', 'grades'),
  69              get_string('showrange_help', 'grades'),
  70              1
  71          )
  72      );
  73  
  74      $settings->add(
  75          new admin_setting_configcheckbox(
  76          'grade_report_user_showweight',
  77          get_string('showweight', 'grades'),
  78          get_string('showweight_help', 'grades'),
  79          1
  80          )
  81      );
  82  
  83      $settings->add(
  84          new admin_setting_configcheckbox(
  85              'grade_report_user_showaverage',
  86              get_string('showaverage', 'grades'),
  87              get_string('showaverage_help', 'grades'),
  88              0
  89          )
  90      );
  91  
  92      $settings->add(
  93          new admin_setting_configcheckbox(
  94              'grade_report_user_showlettergrade',
  95              get_string('showlettergrade', 'grades'),
  96              get_string('showlettergrade_help', 'grades'),
  97              0
  98          )
  99      );
 100  
 101      $settings->add(
 102          new admin_setting_configselect(
 103              'grade_report_user_rangedecimals',
 104              get_string('rangedecimals', 'grades'),
 105              get_string('rangedecimals_help', 'grades'),
 106              0,
 107              [
 108                  0 => 0,
 109                  1 => 1,
 110                  2 => 2,
 111                  3 => 3,
 112                  4 => 4,
 113                  5 => 5
 114              ]
 115          )
 116      );
 117  
 118      $options = [
 119          0 => get_string('shownohidden', 'grades'),
 120          1 => get_string('showhiddenuntilonly', 'grades'),
 121          2 => get_string('showallhidden', 'grades')
 122      ];
 123      $settings->add(
 124          new admin_setting_configselect(
 125              'grade_report_user_showhiddenitems',
 126              get_string('showhiddenitems', 'grades'),
 127              get_string('showhiddenitems_help', 'grades'),
 128              1,
 129              $options
 130          )
 131      );
 132  
 133      $settings->add(
 134          new admin_setting_configselect(
 135              'grade_report_user_showtotalsifcontainhidden',
 136              get_string('hidetotalifhiddenitems', 'grades'),
 137              get_string('hidetotalifhiddenitems_help', 'grades'),
 138              GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN,
 139              [
 140                  GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN => get_string('hide'),
 141                  GRADE_REPORT_SHOW_TOTAL_IF_CONTAINS_HIDDEN => get_string('hidetotalshowexhiddenitems', 'grades'),
 142                  GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN => get_string('hidetotalshowinchiddenitems', 'grades')
 143              ]
 144          )
 145      );
 146  
 147      $settings->add(
 148          new admin_setting_configcheckbox(
 149              'grade_report_user_showcontributiontocoursetotal', get_string('showcontributiontocoursetotal', 'grades'),
 150              get_string('showcontributiontocoursetotal_help', 'grades'),
 151              1
 152          )
 153      );
 154  }