Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   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   * List of custom reports
  19   *
  20   * @package   core_reportbuilder
  21   * @copyright 2021 David Matamoros <davidmc@moodle.com>
  22   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  declare(strict_types=1);
  26  
  27  use core_reportbuilder\permission;
  28  use core_reportbuilder\system_report_factory;
  29  use core_reportbuilder\local\systemreports\reports_list;
  30  
  31  require_once(__DIR__ . '/../config.php');
  32  require_once("{$CFG->libdir}/adminlib.php");
  33  
  34  admin_externalpage_setup('customreports');
  35  
  36  $PAGE->requires->js_call_amd('core_reportbuilder/reports_list', 'init');
  37  
  38  echo $OUTPUT->header();
  39  echo html_writer::start_div('d-flex justify-content-between mb-2');
  40  echo $OUTPUT->heading(get_string('customreports', 'core_reportbuilder'));
  41  
  42  if (permission::can_create_report()) {
  43      /** @var \core_reportbuilder\output\renderer $renderer */
  44      $renderer = $PAGE->get_renderer('core_reportbuilder');
  45      echo $renderer->render_new_report_button();
  46  }
  47  
  48  echo html_writer::end_div();
  49  
  50  $report = system_report_factory::create(reports_list::class, context_system::instance());
  51  echo $report->output();
  52  
  53  echo $OUTPUT->footer();