2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * List of custom reports
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
25 declare(strict_types
=1);
27 use core_reportbuilder\permission
;
28 use core_reportbuilder\system_report_factory
;
29 use core_reportbuilder\local\systemreports\reports_list
;
31 require_once(__DIR__
. '/../config.php');
32 require_once("{$CFG->libdir}/adminlib.php");
34 admin_externalpage_setup('customreports');
36 $PAGE->requires
->js_call_amd('core_reportbuilder/reports_list', 'init');
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'));
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();
48 echo html_writer
::end_div();
50 $report = system_report_factory
::create(reports_list
::class, context_system
::instance());
51 echo $report->output();
53 echo $OUTPUT->footer();