From 3ea8f29329fcbb55d9367173fba1b4abeb927377 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 18 Nov 2017 08:34:23 +0400 Subject: Adding event calls --- managerservice.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'managerservice.php') 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")); } } -- cgit v1.2.3