Update function 'local_webhooks_search_record'
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
82842e5ed8
commit
6a83be960e
26
lib.php
26
lib.php
@ -47,27 +47,25 @@ function local_webhooks_change_status($serviceid) {
|
|||||||
/**
|
/**
|
||||||
* Search for services that contain the specified event.
|
* Search for services that contain the specified event.
|
||||||
*
|
*
|
||||||
* @param string $eventname
|
* @param string $eventname
|
||||||
* @param boolean $active
|
* @param number $limitfrom
|
||||||
|
* @param number $limitnum
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function local_webhooks_search_services_by_event($eventname, $active = false) {
|
function local_webhooks_search_record($eventname, $limitfrom = 0, $limitnum = 0) {
|
||||||
$recordlist = local_webhooks_get_list_records();
|
global $DB;
|
||||||
$active = boolval($active);
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
foreach ($recordlist as $record) {
|
$rs = $DB->get_recordset(LOCAL_WEBHOOKS_TABLE_EVENTS, array("name" => $eventname, "status" => true), "id", "*", $limitfrom, $limitnum);
|
||||||
if (!empty($record->events[$eventname])) {
|
$result = array();
|
||||||
if ($active && boolval($record->enable)) {
|
|
||||||
$result[] = $record;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$active) {
|
foreach ($rs as $event) {
|
||||||
$result[] = $record;
|
if ($record = $DB->get_record(LOCAL_WEBHOOKS_TABLE_SERVICES, array("id" => $event->serviceid, "status" => true), "*", IGNORE_MISSING)) {
|
||||||
}
|
$result[] = $record;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rs->close();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user