aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2018-02-18 20:37:43 +0300
committerValentin Popov <info@valentineus.link>2018-02-18 20:37:43 +0300
commit29bdbc745614b8ac19259229a028efa03d8d4ddb (patch)
tree5d4a659135423e11c24537f8d0329a6d63d48be6
parentebf76795da6cb23eb26bfdddc664dd49a87effed (diff)
downloadlocal_webhooks-29bdbc745614b8ac19259229a028efa03d8d4ddb.tar.xz
local_webhooks-29bdbc745614b8ac19259229a028efa03d8d4ddb.zip
Added a service search function that contains the specified event
-rw-r--r--lib.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib.php b/lib.php
index b6321e4..e3f034e 100644
--- a/lib.php
+++ b/lib.php
@@ -45,6 +45,25 @@ function local_webhooks_change_status($serviceid) {
}
/**
+ * Search for services that contain the specified event.
+ *
+ * @param string $eventname
+ * @return array
+ */
+function local_webhooks_search_services_by_event($eventname) {
+ $recordlist = local_webhooks_get_list_records();
+ $result = array();
+
+ foreach ($recordlist as $record) {
+ if (boolval($record->enable) && !empty($record->events[$eventname])) {
+ $result[] = $record;
+ }
+ }
+
+ return $result;
+}
+
+/**
* Get the record from the database.
*
* @param number $serviceid