aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-12-27 18:51:34 +0300
committerValentin Popov <info@valentineus.link>2017-12-27 18:51:34 +0300
commit2eaa622161720d95ac3f627b4adec97e3a22ac7c (patch)
treed264d8763aa91ff25a763dd291705b4c112b3bb3
parent3d4b78bd8b5c47f27d8b03101633c03da4e46997 (diff)
downloadlocal_webhooks-2eaa622161720d95ac3f627b4adec97e3a22ac7c.tar.xz
local_webhooks-2eaa622161720d95ac3f627b4adec97e3a22ac7c.zip
Added external function display a list of events
-rw-r--r--externallib.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/externallib.php b/externallib.php
index 8acd3af..aa807a7 100644
--- a/externallib.php
+++ b/externallib.php
@@ -234,6 +234,50 @@ class local_webhooks_external extends external_api {
* @since Moodle 2.9 Options available
* @since Moodle 2.2
*/
+ public static function get_list_events_parameters() {
+ return new external_function_parameters(array());
+ }
+
+ /**
+ * Get a list of all system events.
+ *
+ * @return array
+ * @since Moodle 2.9 Options available
+ * @since Moodle 2.2
+ */
+ public static function get_list_events() {
+ $context = context_system::instance();
+ self::validate_context($context);
+
+ $result = array();
+ if ($eventlist = local_webhooks_get_list_events()) {
+ foreach ($eventlist as $item) {
+ $result[] = $item["eventname"];
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns description of method result value.
+ *
+ * @return external_description
+ * @since Moodle 2.2
+ */
+ public static function get_list_events_returns() {
+ return new external_multiple_structure(
+ new external_value(PARAM_TEXT, "Event name.")
+ );
+ }
+
+ /**
+ * Returns description of method parameters.
+ *
+ * @return external_function_parameters
+ * @since Moodle 2.9 Options available
+ * @since Moodle 2.2
+ */
public static function create_record_parameters() {
return new external_function_parameters(
array(