Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 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.