1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Course ratings report for the course
|
|
|
19 |
*
|
|
|
20 |
* @package tool_courserating
|
|
|
21 |
* @copyright 2022 Marina Glancy <marina.glancy@gmail.com>
|
|
|
22 |
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
require('../../../config.php');
|
|
|
26 |
|
|
|
27 |
$courseid = required_param('id', PARAM_INT);
|
|
|
28 |
|
|
|
29 |
require_course_login($courseid);
|
|
|
30 |
\tool_courserating\permission::require_can_view_reports($courseid);
|
|
|
31 |
$PAGE->set_url(new moodle_url('/admin/tool/courserating/index.php', ['id' => $courseid]));
|
|
|
32 |
$PAGE->set_title($COURSE->shortname . ': ' . get_string('pluginname', 'tool_courserating'));
|
|
|
33 |
$PAGE->set_heading($COURSE->fullname);
|
|
|
34 |
|
|
|
35 |
echo $OUTPUT->header();
|
|
|
36 |
echo $OUTPUT->heading(get_string('pluginname', 'tool_courserating'));
|
|
|
37 |
|
|
|
38 |
if (core_component::get_component_directory('core_reportbuilder')) {
|
|
|
39 |
$report = \core_reportbuilder\system_report_factory::create(
|
|
|
40 |
\tool_courserating\reportbuilder\local\systemreports\course_ratings_report::class,
|
|
|
41 |
context_course::instance($courseid),
|
|
|
42 |
'', '', 0, ['courseid' => $courseid]);
|
|
|
43 |
|
|
|
44 |
echo $report->output();
|
|
|
45 |
} else {
|
|
|
46 |
// TODO remove when the minimum supported version is Moodle 4.0.
|
|
|
47 |
$table = new \tool_courserating\output\report311($PAGE->url);
|
|
|
48 |
$table->out(50, true);
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
echo $OUTPUT->footer();
|