Service search function on the event
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
270c04a603
commit
17b9cfde78
23
lib.php
23
lib.php
@ -85,6 +85,29 @@ class local_webhooks_api {
|
|||||||
return $services;
|
return $services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of services subscribed to the event.
|
||||||
|
*
|
||||||
|
* @param string $eventName
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function get_services_by_event( $eventName = "" ) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if ( !is_string( $eventName ) || empty( $eventName ) ) {
|
||||||
|
print_error( "unknowparamtype", "error", null, "eventName" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$events = $DB->get_records( LW_TABLE_EVENTS, array( "name" => $eventName ), "", "*", 0, 0 );
|
||||||
|
|
||||||
|
$services = array();
|
||||||
|
foreach ( $events as $event ) {
|
||||||
|
$services[] = local_webhooks_api::get_service( $event->serviceid );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $services;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create service data in the database.
|
* Create service data in the database.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user