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