diff options
author | Valentin Popov <info@valentineus.link> | 2017-11-18 07:34:23 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-11-18 07:34:23 +0300 |
commit | 3ea8f29329fcbb55d9367173fba1b4abeb927377 (patch) | |
tree | bd9051cb2d3f1182992023ee86f8ddbf39eef457 /editservice.php | |
parent | c1077bc9c15b55a28b564dab43d3d5b4dcdf5826 (diff) | |
download | local_webhooks-3ea8f29329fcbb55d9367173fba1b4abeb927377.tar.xz local_webhooks-3ea8f29329fcbb55d9367173fba1b4abeb927377.zip |
Adding event calls
Diffstat (limited to 'editservice.php')
-rw-r--r-- | editservice.php | 12 |
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")); } } |