summaryrefslogtreecommitdiff
path: root/editservice.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 /editservice.php
parentc1077bc9c15b55a28b564dab43d3d5b4dcdf5826 (diff)
downloadlocal_webhooks-3ea8f29329fcbb55d9367173fba1b4abeb927377.tar.xz
local_webhooks-3ea8f29329fcbb55d9367173fba1b4abeb927377.zip
Adding event calls
Diffstat (limited to 'editservice.php')
-rw-r--r--editservice.php12
1 files changed, 11 insertions, 1 deletions
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"));
}
}