Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 403]

This file defines an adhoc task to send notifications.

Copyright: 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 126 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

notification_task:: (3 methods):
  execute()
  generate_message()
  replace_placeholders()


Class: notification_task  - X-Ref

Adhock class, used to send notifications to users.

execute()   X-Ref
Send out messages.


generate_message($subscriptionid, \stdClass $eventobj)   X-Ref
Generates the message object for a give subscription and event.

param: int $subscriptionid Subscription instance
param: \stdClass $eventobj Event data
return: false|\stdClass message object

replace_placeholders($template, subscription $subscription, $eventobj, $context)   X-Ref
Replace place holders in the template with respective content.

param: string $template Message template.
param: subscription $subscription subscription instance
param: \stdclass $eventobj Event data
param: \context $context context object
return: mixed final template string.