From eb4b9b69f862df8ba23cafc8cd5e4a887baa02f0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 6 May 2019 05:45:35 +0400 Subject: Added worked a class observer Signed-off-by: Valentin Popov --- classes/event/observer.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 classes/event/observer.php (limited to 'classes/event/observer.php') diff --git a/classes/event/observer.php b/classes/event/observer.php new file mode 100644 index 0000000..ff6a89e --- /dev/null +++ b/classes/event/observer.php @@ -0,0 +1,44 @@ +. + +namespace local_webhooks\event; + +defined('MOODLE_INTERNAL') || die(); + +use core\event\base as event; +use core\task\manager; +use local_webhooks\task\notify; +use function defined; + +/** + * Class observer. + * + * @copyright 2019 'Valentin Popov' + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package local_webhooks\event + */ +final class observer { + /** + * Main handler for events. + * + * @param \core\event\base $event + */ + public static function handler(event $event) { + $task = new notify(); + $task->set_custom_data($event->get_data()); + manager::queue_adhoc_task($task); + } +} \ No newline at end of file -- cgit v1.2.3