diff options
author | Valentin Popov <info@valentineus.link> | 2017-11-18 05:31:25 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-11-18 05:31:25 +0300 |
commit | 97140dccf76f878991853d827449ca608eb91864 (patch) | |
tree | 7017e6d948a6aaa0bd36a10921987cc614132322 /editservice.php | |
parent | bf2cef3ea035f4487e4b41e3033c60b1f1f0ead3 (diff) | |
download | local_webhooks-97140dccf76f878991853d827449ca608eb91864.tar.xz local_webhooks-97140dccf76f878991853d827449ca608eb91864.zip |
Aesthetics in the code
Diffstat (limited to 'editservice.php')
-rw-r--r-- | editservice.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/editservice.php b/editservice.php index a997928..c97fa22 100644 --- a/editservice.php +++ b/editservice.php @@ -27,15 +27,15 @@ require_once(__DIR__ . "/classes/editform.php"); require_once($CFG->libdir . "/adminlib.php"); admin_externalpage_setup("pluginsoverview"); +require_login(); +/* Optional parameters */ $serviceid = optional_param("serviceid", 0, PARAM_INT); -require_login(); - /* Link generation */ -$urlparameters = array("serviceid" => $serviceid); +$urlparameters = array("serviceid" => $serviceid); $managerservice = new moodle_url("/local/webhooks/managerservice.php", $urlparameters); -$baseurl = new moodle_url("/local/webhooks/editservice.php", $urlparameters); +$baseurl = new moodle_url("/local/webhooks/editservice.php", $urlparameters); $PAGE->set_url($baseurl, $urlparameters); /* Configure the context of the page */ @@ -43,7 +43,7 @@ $context = context_system::instance(); $PAGE->set_context($context); /* Preparing a template for data */ -$titlepage = new lang_string("externalservice", "webservice"); +$titlepage = new lang_string("externalservice", "webservice"); $servicerecord = new stdClass; /* Create an editing form */ @@ -62,10 +62,13 @@ if ($editing = boolval($serviceid)) { /* Processing of received data */ if ($data = $mform->get_data()) { - if (!empty($data->events)) { - $data->events = base64_encode(gzcompress(serialize($data->events), 9)); + if (empty($data->events)) { + $data->events = array(); } + /* Pack the list of events */ + $data->events = base64_encode(gzcompress(serialize($data->events), 9)); + if ($editing) { $data->id = $serviceid; $DB->update_record("local_webhooks_service", $data); @@ -82,7 +85,7 @@ $PAGE->set_heading($titlepage); $PAGE->set_title($titlepage); /* The page title */ -$PAGE->navbar->add(new lang_string("externalservices", "webservice"), $managerservice); +$PAGE->navbar->add(new lang_string("pluginname", "local_webhooks"), $managerservice); $PAGE->navbar->add($titlepage); echo $OUTPUT->header(); |