diff options
author | Valentin Popov <info@valentineus.link> | 2018-02-19 14:05:58 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-02-19 14:24:34 +0300 |
commit | 3a2bddeea47c9b031367fe0566ed55e821fe4b95 (patch) | |
tree | 85d24a5b9d18c5d0525a9035bbd8bbe7dd3d003f | |
parent | a41dbbb950d4a71aba46aaa25cecc811eb34242e (diff) | |
download | local_webhooks-3a2bddeea47c9b031367fe0566ed55e821fe4b95.tar.xz local_webhooks-3a2bddeea47c9b031367fe0566ed55e821fe4b95.zip |
The search function is expanded
-rw-r--r-- | lib.php | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -47,16 +47,24 @@ function local_webhooks_change_status($serviceid) { /** * Search for services that contain the specified event. * - * @param string $eventname + * @param string $eventname + * @param boolean $active * @return array */ -function local_webhooks_search_services_by_event($eventname) { +function local_webhooks_search_services_by_event($eventname, $active = false) { $recordlist = local_webhooks_get_list_records(); + $active = boolval($active); $result = array(); foreach ($recordlist as $record) { - if (boolval($record->enable) && !empty($record->events[$eventname])) { - $result[] = $record; + if (!empty($record->events[$eventname])) { + if ($active && boolval($record->enable)) { + $result[] = $record; + } + + if (!$active) { + $result[] = $record; + } } } |