[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/ -> messagelib.php (summary)

Functions for interacting with the message system

Copyright: 2008 Luis Rodrigues and Martin Dougiamas
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 580 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 message/lib.php

Defines 9 functions

  message_send()
  message_update_providers()
  message_update_processors()
  message_set_default_message_preference()
  message_get_providers_for_user()
  message_get_providers_from_db()
  message_get_providers_from_file()
  message_provider_uninstall()
  message_processor_uninstall()

Functions
Functions that are not part of a class:

message_send($eventdata)   X-Ref
Called when a message provider wants to send a message.
This functions checks the message recipient's message processor configuration then
sends the message to the configured processors

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
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

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

Note: processor failure is is not reported as false return value,
earlier versions did not do it consistently either.

param: stdClass|\core\message\message $eventdata information about the message (component, userfrom, userto, ...)
return: mixed the integer ID of the new message or false if there was a problem with submitted data

message_update_providers($component='moodle')   X-Ref
Updates the message_providers table with the current set of message providers

param: string $component For example 'moodle', 'mod_forum' or 'block_quiz_results'
return: boolean True on success

message_update_processors($processorname)   X-Ref
This function populates default message preferences for all existing providers
when the new message processor is added.

param: string $processorname The name of message processor plugin (e.g. 'email', 'jabber')

message_set_default_message_preference($component, $messagename, $fileprovider, $processorname='')   X-Ref
Setting default messaging preferences for particular message provider

param: string $component   The name of component (e.g. moodle, mod_forum, etc.)
param: string $messagename The name of message provider
param: array  $fileprovider The value of $messagename key in the array defined in plugin messages.php
param: string $processorname The optional name of message processor

message_get_providers_for_user($userid)   X-Ref
Returns the active providers for the user specified, based on capability

param: int $userid id of user
return: array An array of message providers

message_get_providers_from_db($component)   X-Ref
Gets the message providers that are in the database for this component.

This is an internal function used within messagelib.php

param: string $component A moodle component like 'moodle', 'mod_forum', 'block_quiz_results'
return: array An array of message providers

message_get_providers_from_file($component)   X-Ref
Loads the messages definitions for a component from file

If no messages are defined for the component, return an empty array.
This is an internal function used within messagelib.php

param: string $component A moodle component like 'moodle', 'mod_forum', 'block_quiz_results'
return: array An array of message providers or empty array if not exists

message_provider_uninstall($component)   X-Ref
Remove all message providers for particular component and corresponding settings

param: string $component A moodle component like 'moodle', 'mod_forum', 'block_quiz_results'
return: void

message_processor_uninstall($name)   X-Ref
Uninstall a message processor

param: string $name A message processor name like 'email', 'jabber'



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1