aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2018-02-19 14:25:49 +0300
committerValentin Popov <info@valentineus.link>2018-02-19 14:25:49 +0300
commitdd1906531383cba37a7d746c0a727b0ed0c98582 (patch)
treed0e4e66e11709243461accb2600aa72a8b0cadf7
parent3a2bddeea47c9b031367fe0566ed55e821fe4b95 (diff)
downloadlocal_webhooks-dd1906531383cba37a7d746c0a727b0ed0c98582.tar.xz
local_webhooks-dd1906531383cba37a7d746c0a727b0ed0c98582.zip
The extension is added to external functions
-rw-r--r--externallib.php12
1 files changed, 7 insertions, 5 deletions
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;