Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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