Repository navigation
Expand file tree
/
Copy pathusage.php
More file actions
59 lines (50 loc) · 2.13 KB
/
Copy pathusage.php
File metadata and controls
59 lines (50 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/**
* Report-usage overview: how often each published SQL data source has been opened.
*
* Rendered as a Report Builder system report (search / sort / filter / export), sourced from the
* report_sql_queryview audit table. Gated on the viewall capability because view history
* is manager-level data.
*
* @package report_sql
* @copyright 2026 Marcus Green
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/adminlib.php');
use core_reportbuilder\system_report_factory;
use report_sql\reportbuilder\local\systemreports\usage;
// The listing is the active parent, so tabs and the breadcrumb trail run through index.php.
navigation_node::override_active_url(new moodle_url('/report/sql/index.php'));
admin_externalpage_setup('report_sql_usage');
$PAGE->navbar->add(get_string('usage:title', 'report_sql'));
$context = context_system::instance();
require_capability('report/sql:viewall', $context);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('usage:title', 'report_sql'));
echo html_writer::div(get_string('usage:intro', 'report_sql'), 'text-muted mb-3');
$report = system_report_factory::create(usage::class, $context, 'report_sql');
echo $report->output();
echo html_writer::div(
html_writer::link(
new moodle_url('/report/sql/index.php'),
get_string('back'),
['class' => 'btn btn-secondary']
),
'mt-3'
);
echo $OUTPUT->footer();