. /* * Comments management interface */ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once('lib.php'); $context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/comment:delete', $context); $PAGE->requires->yui_lib('yahoo')->in_head(); $PAGE->requires->yui_lib('dom')->in_head(); $PAGE->requires->yui_lib('event')->in_head(); $PAGE->requires->yui_lib('animation')->in_head(); $PAGE->requires->yui_lib('json')->in_head(); $PAGE->requires->yui_lib('connection')->in_head(); $PAGE->requires->js('comment/admin.js')->in_head(); $action = optional_param('action', '', PARAM_ALPHA); $commentid = optional_param('commentid', 0, PARAM_INT); $commentids = optional_param('commentids', '', PARAM_ALPHANUMEXT); $page = optional_param('page', 0, PARAM_INT); $manager = new comment_manager(); if (!empty($action)) { confirm_sesskey(); } if ($action === 'delete') { // delete a single comment if (!empty($commentid)) { if ($manager->delete_comment($commentid)) { redirect($CFG->httpswwwroot.'/comment/', get_string('deleted')); } else { $err = 'cannotdeletecomment'; } } // delete a list of comments if (!empty($commentids)) { if ($manager->delete_comments($commentids)) { die('yes'); } else { die('no'); } } } admin_externalpage_setup('comments'); admin_externalpage_print_header(); echo $OUTPUT->heading(get_string('comments')); if (!empty($err)) { print_error($err, 'error', $CFG->httpswwwroot.'/comment/'); } if (empty($action)) { $manager->print_comments($page); echo '