aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2018-03-12 23:08:18 +0300
committerValentin Popov <info@valentineus.link>2018-03-12 23:08:18 +0300
commit79fe101e1b7fc311146914026c0369958e4b68c5 (patch)
treed0cef72cf7fe95d37baa87e593ebf372c963a49e
parentb12c850a2f20c0f1a04feab24e3a99caa661da65 (diff)
downloadlocal_webhooks-79fe101e1b7fc311146914026c0369958e4b68c5.tar.xz
local_webhooks-79fe101e1b7fc311146914026c0369958e4b68c5.zip
Added function 'local_webhooks_get_list_events_for_service'
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r--locallib.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/locallib.php b/locallib.php
index 4fae651..392d01d 100644
--- a/locallib.php
+++ b/locallib.php
@@ -72,6 +72,27 @@ function local_webhooks_cache_reset() {
}
/**
+ * Forms a list of events for the specified service.
+ *
+ * @param number $serviceid
+ * @return array
+ */
+function local_webhooks_get_list_events_for_service($serviceid) {
+ global $DB;
+
+ $rs = $DB->get_recordset(LOCAL_WEBHOOKS_TABLE_EVENTS, array("serviceid" => $serviceid), "id", "*", 0, 0);
+ $events = array();
+
+ foreach ($rs as $record) {
+ $events[$record->name] = $record->status;
+ }
+
+ $rs->close();
+
+ return $events;
+}
+
+/**
* Adds all events to the database.
*
* @param number $serviceid