weekly release 5.0dev
[moodle.git] / comment / index.php
blob07812afd3166cb2ed26ba14719834a3e65259f70
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 * Comments management interface
21 * @package core_comment
22 * @copyright 2010 Dongsheng Cai {@link http://dongsheng.org}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 require_once('../config.php');
26 require_once($CFG->libdir.'/adminlib.php');
28 use core_reportbuilder\system_report_factory;
29 use core_comment\reportbuilder\local\systemreports\comments;
31 admin_externalpage_setup('comments', '', null, '', array('pagelayout'=>'report'));
33 $PAGE->requires->js_call_amd('core_comment/admin', 'init');
35 echo $OUTPUT->header();
36 echo $OUTPUT->heading(get_string('comments'));
38 $report = system_report_factory::create(comments::class, context_system::instance());
39 $report->set_default_per_page($CFG->commentsperpage);
41 echo $report->output();
43 // Render delete selected button.
44 if ($DB->record_exists('comments', [])) {
45 echo $OUTPUT->render(new single_button(
46 new moodle_url('#'),
47 get_string('deleteselected'),
48 'post',
49 single_button::BUTTON_PRIMARY,
50 ['data-action' => 'comment-delete-selected']
51 ));
54 echo $OUTPUT->footer();