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 --- editservice.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'editservice.php') diff --git a/editservice.php b/editservice.php index 8b065ff..4564909 100644 --- a/editservice.php +++ b/editservice.php @@ -71,9 +71,19 @@ if ($data = $mform->get_data()) { if ($editing) { $data->id = $serviceid; $DB->update_record("local_webhooks_service", $data); + + /* Run the event */ + $event = \local_webhooks\event\service_updated::create(array("context" => $context, "objectid" => $data->id)); + $event->trigger(); + redirect($managerservice, new lang_string("eventwebserviceserviceupdated", "webservice")); } else { - $DB->insert_record("local_webhooks_service", $data); + $servicenewid = $DB->insert_record("local_webhooks_service", $data); + + /* Run the event */ + $event = \local_webhooks\event\service_added::create(array("context" => $context, "objectid" => $servicenewid)); + $event->trigger(); + redirect($managerservice, new lang_string("eventwebserviceservicecreated", "webservice")); } } -- cgit v1.2.3