Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
/comment/ -> index.php (source)

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]

   1  <?php
   2  
   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.
  14  //
  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/>.
  17  
  18  /*
  19   * Comments management interface
  20   *
  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
  24   */
  25  require_once('../config.php');
  26  require_once($CFG->libdir.'/adminlib.php');
  27  
  28  use core_reportbuilder\system_report_factory;
  29  use core_comment\reportbuilder\local\systemreports\comments;
  30  
  31  admin_externalpage_setup('comments', '', null, '', array('pagelayout'=>'report'));
  32  
  33  $PAGE->requires->js_call_amd('core_comment/admin', 'init');
  34  
  35  echo $OUTPUT->header();
  36  echo $OUTPUT->heading(get_string('comments'));
  37  
  38  $report = system_report_factory::create(comments::class, context_system::instance());
  39  $report->set_default_per_page($CFG->commentsperpage);
  40  
  41  echo $report->output();
  42  
  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      ));
  52  }
  53  
  54  echo $OUTPUT->footer();