| 1 | efrain | 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;
 | 
        
           | 1441 | ariadna | 30 | use core_reportbuilder\output\report_action;
 | 
        
           | 1 | efrain | 31 |   | 
        
           |  |  | 32 | require_once(__DIR__ . '/../config.php');
 | 
        
           |  |  | 33 | require_once("{$CFG->libdir}/adminlib.php");
 | 
        
           |  |  | 34 |   | 
        
           |  |  | 35 | admin_externalpage_setup('customreports');
 | 
        
           |  |  | 36 |   | 
        
           |  |  | 37 | $PAGE->requires->js_call_amd('core_reportbuilder/reports_list', 'init');
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 | echo $OUTPUT->header();
 | 
        
           |  |  | 40 | echo $OUTPUT->heading(get_string('customreports', 'core_reportbuilder'));
 | 
        
           |  |  | 41 |   | 
        
           | 1441 | ariadna | 42 | $report = system_report_factory::create(reports_list::class, context_system::instance());
 | 
        
           | 1 | efrain | 43 | if (permission::can_create_report()) {
 | 
        
           | 1441 | ariadna | 44 |     $report->set_report_action(new report_action(
 | 
        
           |  |  | 45 |         get_string('newreport', 'core_reportbuilder'),
 | 
        
           |  |  | 46 |         ['class' => 'btn btn-primary my-auto', 'data-action' => 'report-create'],
 | 
        
           |  |  | 47 |     ));
 | 
        
           | 1 | efrain | 48 | }
 | 
        
           |  |  | 49 |   | 
        
           |  |  | 50 | echo $report->output();
 | 
        
           |  |  | 51 |   | 
        
           |  |  | 52 | echo $OUTPUT->footer();
 |