summaryrefslogtreecommitdiff
path: root/restorebackup.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-11-22 12:59:02 +0300
committerValentin Popov <info@valentineus.link>2017-11-22 12:59:02 +0300
commit57cac60ab3cab5c65fdf92e986da110863d02de4 (patch)
treef69ad54173d34fd0f5b577d2dc5a57018fa94fdd /restorebackup.php
parentd4d105c0180e1a02396f00f924679ac0a84a8654 (diff)
downloadlocal_webhooks-57cac60ab3cab5c65fdf92e986da110863d02de4.tar.xz
local_webhooks-57cac60ab3cab5c65fdf92e986da110863d02de4.zip
Code refactoring
Diffstat (limited to 'restorebackup.php')
-rw-r--r--restorebackup.php15
1 files changed, 4 insertions, 11 deletions
diff --git a/restorebackup.php b/restorebackup.php
index 75a6fb7..453e25c 100644
--- a/restorebackup.php
+++ b/restorebackup.php
@@ -26,16 +26,13 @@ require_once(__DIR__ . "/../../config.php");
require_once(__DIR__ . "/classes/editform.php");
require_once($CFG->libdir . "/adminlib.php");
-admin_externalpage_setup("local_webhooks");
-
/* Link generation */
$managerservice = new moodle_url("/local/webhooks/managerservice.php");
$baseurl = new moodle_url("/local/webhooks/restorebackup.php");
-$PAGE->set_url($baseurl);
/* Configure the context of the page */
+admin_externalpage_setup("local_webhooks", "", null, $baseurl, array());
$context = context_system::instance();
-$PAGE->set_context($context);
/* Create an editing form */
$mform = new \local_webhooks\service_backup_form($PAGE->url);
@@ -46,8 +43,7 @@ if ($mform->is_cancelled()) {
}
/* Processing the received file */
-$data = $mform->get_data();
-if (boolval($data) && confirm_sesskey()) {
+if ($data = $mform->get_data() && confirm_sesskey()) {
$content = $mform->get_file_content("backupfile");
$callbacks = unserialize(gzuncompress(base64_decode($content)));
@@ -63,14 +59,11 @@ if (boolval($data) && confirm_sesskey()) {
redirect($managerservice, new lang_string("restorefinished", "moodle"));
}
-/* Page template */
+/* The page title */
$titlepage = new lang_string("backup", "moodle");
-$PAGE->set_pagelayout("admin");
+$PAGE->navbar->add($titlepage);
$PAGE->set_heading($titlepage);
$PAGE->set_title($titlepage);
-
-/* The page title */
-$PAGE->navbar->add($titlepage);
echo $OUTPUT->header();
/* Displays the form */