Added function 'local_webhooks_get_list_events_for_service'

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
Valentin Popov 2018-03-13 00:08:18 +04:00
parent b12c850a2f
commit 79fe101e1b
Signed by: Valentin Popov
GPG Key ID: 269A00ACA90A8EA3

View File

@ -71,6 +71,27 @@ function local_webhooks_cache_reset() {
return $cache->purge();
}
/**
* 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.
*