Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
New messaging class. More...
Public Member Functions | |
__get ($prop) | |
Magic getter method. More... | |
__isset ($prop) | |
Magic method to check if property is set. More... | |
__set ($prop, $value) | |
Magic setter method. More... | |
get_eventobject_for_processor ($processorname) | |
Get a event object for a specific processor in stdClass format. More... | |
set_additional_content ($processorname, $content) | |
This method lets you define content that would be added to the message only for specific message processors. More... | |
Protected Member Functions | |
get_fullmessage ($processorname='') | |
Fullmessage content including any processor specific content. More... | |
get_fullmessagehtml ($processorname='') | |
Fullmessagehtml content including any processor specific content. More... | |
get_message_with_additional_content ($processorname, $messagetype) | |
Helper method used to get message content added with processor specific content. More... | |
get_smallmessage ($processorname='') | |
Smallmessage content including any processor specific content. More... | |
set_customdata ($customdata) | |
Always JSON encode customdata. More... | |
New messaging class.
Required parameters of the $eventdata object: component string Component name. must exist in message_providers name string Message type name. must exist in message_providers userfrom object|int The user sending the message userto object|int The message recipient. This is mandatory for NOTIFICACIONS and 1:1 personal messages. subject string The message subject fullmessage string The full message in a given format fullmessageformat int The format if the full message (FORMAT_MOODLE, FORMAT_HTML, ..) fullmessagehtml string The full version (the message processor will choose with one to use) smallmessage string The small version of the message
Required parameters of the $eventdata object for PERSONAL MESSAGES: convid int The conversation identifier where this message will be sent
Optional parameters of the $eventdata object: notification bool Should the message be considered as a notification rather than a personal message contexturl string If this is a notification then you can specify a url to view the event. For example the forum post the user is being notified of. contexturlname string The display text for contexturl. replyto string An email address which can be used to send an reply. attachment stored_file File instance that needs to be sent as attachment. attachname string Name of the attachment. customdata mixed Custom data to be passed to the message processor. Must be serialisable using json_encode().
core\message\message::__get | ( | $prop | ) |
Magic getter method.
string | $prop | name of property to get. |
mixed |
coding_exception |
core\message\message::__isset | ( | $prop | ) |
Magic method to check if property is set.
string | $prop | name of property to check. |
bool |
coding_exception |
core\message\message::__set | ( | $prop, | |
$value | |||
) |
Magic setter method.
string | $prop | name of property to set. |
mixed | $value | value to assign to the property. |
mixed |
coding_exception |
core\message\message::get_eventobject_for_processor | ( | $processorname | ) |
Get a event object for a specific processor in stdClass format.
string | $processorname | Name of the processor. |
stdClass | event object in stdClass format. |
|
protected |
Fullmessage content including any processor specific content.
string | $processorname | Name of the processor. |
mixed|string |
|
protected |
Fullmessagehtml content including any processor specific content.
string | $processorname | Name of the processor. |
mixed|string |
|
protected |
Helper method used to get message content added with processor specific content.
string | $processorname | Name of the processor. |
string | $messagetype | one of 'fullmessagehtml', 'fullmessage', 'smallmessage'. |
mixed|string |
|
protected |
Smallmessage content including any processor specific content.
string | $processorname | Name of the processor. |
mixed|string |
core\message\message::set_additional_content | ( | $processorname, | |
$content | |||
) |
This method lets you define content that would be added to the message only for specific message processors.
Example of $content:- array('fullmessagehtml' => array('header' => 'header content', 'footer' => 'footer content'), 'smallmessage' => array('header' => 'header content for small message', 'footer' => 'footer content'), '*' => array('header' => 'header content for all types', 'footer' => 'footer content') )
string | $processorname | name of the processor. |
array | $content | content to add in the above defined format. |
|
protected |
Always JSON encode customdata.
mixed | $customdata | a data structure that must be serialisable using json_encode(). |