From dd1906531383cba37a7d746c0a727b0ed0c98582 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 19 Feb 2018 15:25:49 +0400 Subject: The extension is added to external functions --- externallib.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'externallib.php') diff --git a/externallib.php b/externallib.php index 0430c40..39f06e3 100644 --- a/externallib.php +++ b/externallib.php @@ -88,7 +88,8 @@ class local_webhooks_external extends external_api { public static function search_services_by_event_parameters() { return new external_function_parameters( array( - "eventname" => new external_value(PARAM_TEXT, "The name of the event.") + "eventname" => new external_value(PARAM_TEXT, "The name of the event."), + "active" => new external_value(PARAM_BOOL, "Service status filter switch.", VALUE_OPTIONAL) ) ); } @@ -96,19 +97,20 @@ class local_webhooks_external extends external_api { /** * Search for services that contain the specified event. * - * @param string $eventname + * @param string $eventname + * @param boolean $active * @return array * @since Moodle 2.9 Options available * @since Moodle 2.2 */ - public static function search_services_by_event($eventname = "") { - $parameters = self::validate_parameters(self::search_services_by_event_parameters(), array("eventname" => $eventname)); + public static function search_services_by_event($eventname = "", $active = false) { + $parameters = self::validate_parameters(self::search_services_by_event_parameters(), array("eventname" => $eventname, "active" => $active)); $context = context_system::instance(); self::validate_context($context); $result = array(); - if ($listrecords = local_webhooks_search_services_by_event($parameters["eventname"])) { + if ($listrecords = local_webhooks_search_services_by_event($parameters["eventname"], $parameters["active"])) { foreach ($listrecords as $index => $record) { $result[$index]["enable"] = $record->enable; $result[$index]["id"] = $record->id; -- cgit v1.2.3