aboutsummaryrefslogtreecommitdiff
path: root/editservice.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 /editservice.php
parentd4d105c0180e1a02396f00f924679ac0a84a8654 (diff)
downloadlocal_webhooks-57cac60ab3cab5c65fdf92e986da110863d02de4.tar.xz
local_webhooks-57cac60ab3cab5c65fdf92e986da110863d02de4.zip
Code refactoring
Diffstat (limited to 'editservice.php')
-rw-r--r--editservice.php18
1 files changed, 5 insertions, 13 deletions
diff --git a/editservice.php b/editservice.php
index 4564909..907a41d 100644
--- a/editservice.php
+++ b/editservice.php
@@ -26,8 +26,6 @@ require_once(__DIR__ . "/../../config.php");
require_once(__DIR__ . "/classes/editform.php");
require_once($CFG->libdir . "/adminlib.php");
-admin_externalpage_setup("local_webhooks");
-
/* Optional parameters */
$serviceid = optional_param("serviceid", 0, PARAM_INT);
@@ -35,15 +33,10 @@ $serviceid = optional_param("serviceid", 0, PARAM_INT);
$urlparameters = array("serviceid" => $serviceid);
$managerservice = new moodle_url("/local/webhooks/managerservice.php", $urlparameters);
$baseurl = new moodle_url("/local/webhooks/editservice.php", $urlparameters);
-$PAGE->set_url($baseurl, $urlparameters);
/* Configure the context of the page */
+admin_externalpage_setup("local_webhooks", "", null, $baseurl, array());
$context = context_system::instance();
-$PAGE->set_context($context);
-
-/* Preparing a template for data */
-$titlepage = new lang_string("externalservice", "webservice");
-$servicerecord = new stdClass;
/* Create an editing form */
$mform = new \local_webhooks\service_edit_form($PAGE->url);
@@ -54,6 +47,7 @@ if ($mform->is_cancelled()) {
}
/* Getting the data */
+$servicerecord = new stdClass();
if ($editing = boolval($serviceid)) {
$servicerecord = $DB->get_record("local_webhooks_service", array("id" => $serviceid), "*", MUST_EXIST);
$mform->set_data($servicerecord);
@@ -88,13 +82,11 @@ if ($data = $mform->get_data()) {
}
}
-/* Page template */
-$PAGE->set_pagelayout("admin");
-$PAGE->set_heading($titlepage);
-$PAGE->set_title($titlepage);
-
/* The page title */
+$titlepage = new lang_string("externalservice", "webservice");
$PAGE->navbar->add($titlepage);
+$PAGE->set_heading($titlepage);
+$PAGE->set_title($titlepage);
echo $OUTPUT->header();
/* Displays the form */