From 1f2ff1b110f43171d0ff6d97e6c4cffc5094d4e3 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 6 Feb 2019 13:55:48 +0800 Subject: [PATCH] MDL-64788 core_message: removed unused temporary page --- message/pendingcontactrequests.php | 93 ------------------------------ 1 file changed, 93 deletions(-) delete mode 100644 message/pendingcontactrequests.php diff --git a/message/pendingcontactrequests.php b/message/pendingcontactrequests.php deleted file mode 100644 index f408ec2924c..00000000000 --- a/message/pendingcontactrequests.php +++ /dev/null @@ -1,93 +0,0 @@ -. - -/** - * A page displaying the user's contact requests. - * - * This is a temporary (well, should be) page until the new UI is introduced for 3.6. - * - * @package core_message - * @copyright 2018 Mark Nelson - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -require_once('../config.php'); -require_once($CFG->dirroot . '/message/externallib.php'); - -require_login(null, false); - -if (isguestuser()) { - redirect($CFG->wwwroot); -} - -if (empty($CFG->messaging)) { - print_error('disabled', 'message'); -} - -$userid = optional_param('userid', '', PARAM_INT); // The userid of the request. -$action = optional_param('action', '', PARAM_ALPHA); - -// Confirm the request is able to be approved/disapproved. -if ($userid) { - $request = $DB->get_record('message_contact_requests', ['userid' => $userid, 'requesteduserid' => $USER->id], '*', MUST_EXIST); -} - -// Use external functions as these are what we will be using in the new UI. -if ($userid && $action && confirm_sesskey()) { - if ($action == 'approve') { - core_message_external::confirm_contact_request($request->userid, $USER->id); - } else if ($action == 'decline') { - core_message_external::decline_contact_request($request->userid, $USER->id); - } - - redirect(new moodle_url('/message/pendingcontactrequests.php')); -} - -$table = new html_table(); - -$headers = []; -$headers[] = ''; -$headers[] = ''; - -$table->head = $headers; - -// Use external functions as these are what we will be using in the new UI. -if ($contactrequests = core_message_external::get_contact_requests($USER->id)) { - foreach ($contactrequests as $contactrequest) { - $approvelink = new moodle_url('/message/pendingcontactrequests.php', ['userid' => $contactrequest->id, - 'action' => 'approve', 'sesskey' => sesskey()]); - $declinelink = new moodle_url('/message/pendingcontactrequests.php', ['userid' => $contactrequest->id, - 'action' => 'decline', 'sesskey' => sesskey()]); - - $cells = array(); - $cells[] = $contactrequest->fullname; - $cells[] = html_writer::link($approvelink, get_string('approve')) . " | " . - html_writer::link($declinelink, get_string('cancel')); - $table->data[] = new html_table_row($cells); - } -} - -$url = new moodle_url('/message/pendingcontactrequests.php'); -$PAGE->set_url($url); - -$PAGE->set_context(context_user::instance($USER->id)); -$PAGE->set_pagelayout('standard'); -$PAGE->set_title('Pending contact requests'); -$PAGE->set_heading('Pending contact requests'); - -echo $OUTPUT->header(); -echo html_writer::table($table); -echo $OUTPUT->footer();