Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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  namespace gradereport_singleview\local\screen;
  18  
  19  /**
  20   * The grade search screen.
  21   *
  22   * @package   gradereport_singleview
  23   * @copyright 2022 Mathew May <mathew.solutions>
  24   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  class grade_select extends screen {
  27      public function init($selfitemisempty = false) {
  28      }
  29      /**
  30       * Return the HTML for the page.
  31       *
  32       * @return string
  33       */
  34      public function html(): string {
  35          global $OUTPUT, $COURSE, $USER;
  36  
  37          $userlink = new \moodle_url('/grade/report/singleview/index.php', ['id' => $COURSE->id, 'item' => 'user_select']);
  38          $gradelink = new \moodle_url('/grade/report/singleview/index.php', ['id' => $COURSE->id, 'item' => 'grade_select']);
  39          $gpr = new \grade_plugin_return(['type' => 'report', 'plugin' => 'singleview', 'courseid' => $COURSE->id,
  40              'userid' => $USER->id]);
  41          $context = [
  42              'courseid' => $gpr->courseid,
  43              'imglink' => $OUTPUT->image_url('zero_state_grade', 'gradereport_singleview'),
  44              'userzerolink' => $userlink->out(false),
  45              'userselectactive' => false,
  46              'gradezerolink' => $gradelink->out(false),
  47              'gradeselectactive' => true,
  48              'displaylabel' => true,
  49              'groupmodeenabled' => $COURSE->groupmode,
  50              'groupactionbaseurl' => 'index.php?item=grade_select',
  51              'groupid' => $gpr->groupid
  52          ];
  53          return $OUTPUT->render_from_template('gradereport_singleview/zero_state_grade', $context);
  54      }
  55  
  56      public function item_type(): ?string {
  57          return false;
  58      }
  59  
  60      /**
  61       * Should we show the base singlereport group selector?
  62       * @return bool
  63       */
  64      public function display_group_selector(): bool {
  65          return false;
  66      }
  67  
  68      /**
  69       * Get the heading for the screen.
  70       *
  71       * @return string
  72       */
  73      public function heading(): string {
  74          return ' ';
  75      }
  76  
  77      /**
  78       * Does this screen support paging?
  79       *
  80       * @return bool
  81       */
  82      public function supports_paging(): bool {
  83          return false;
  84      }
  85  }