aboutsummaryrefslogtreecommitdiff
path: root/managerservice.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-11-18 07:34:23 +0300
committerValentin Popov <info@valentineus.link>2017-11-18 07:34:23 +0300
commit3ea8f29329fcbb55d9367173fba1b4abeb927377 (patch)
treebd9051cb2d3f1182992023ee86f8ddbf39eef457 /managerservice.php
parentc1077bc9c15b55a28b564dab43d3d5b4dcdf5826 (diff)
downloadlocal_webhooks-3ea8f29329fcbb55d9367173fba1b4abeb927377.tar.xz
local_webhooks-3ea8f29329fcbb55d9367173fba1b4abeb927377.zip
Adding event calls
Diffstat (limited to 'managerservice.php')
-rw-r--r--managerservice.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/managerservice.php b/managerservice.php
index f75e54e..f15ef21 100644
--- a/managerservice.php
+++ b/managerservice.php
@@ -49,6 +49,11 @@ $PAGE->set_context($context);
/* Delete the service */
if (boolval($deleteid) && confirm_sesskey()) {
$DB->delete_records("local_webhooks_service", array("id" => $deleteid));
+
+ /* Run the event */
+ $event = \local_webhooks\event\service_deleted::create(array("context" => $context, "objectid" => $deleteid));
+ $event->trigger();
+
redirect($PAGE->url, new lang_string("eventwebserviceservicedeleted", "webservice"));
}
@@ -59,6 +64,11 @@ $callbacks = $DB->get_records_select("local_webhooks_service", null, null, $DB->
if (boolval($backupservices)) {
$filecontent = base64_encode(gzcompress(serialize($callbacks), 9));
$filename = "webhooks_" . date("U") . ".backup";
+
+ /* Run the event */
+ $event = \local_webhooks\event\backup_performed::create(array("context" => $context, "objectid" => 0));
+ $event->trigger();
+
send_file($filecontent, $filename, 0, 0, true, true);
}
@@ -69,6 +79,11 @@ if (boolval($hideshowid) && confirm_sesskey()) {
if (!empty($callback)) {
$callback->enable = !boolval($callback->enable);
$DB->update_record("local_webhooks_service", $callback);
+
+ /* Run the event */
+ $event = \local_webhooks\event\service_updated::create(array("context" => $context, "objectid" => $hideshowid));
+ $event->trigger();
+
redirect($PAGE->url, new lang_string("eventwebserviceserviceupdated", "webservice"));
}
}