Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Messaging 2.0.

Development:Messaging 2.0: Difference between revisions

From MoodleDocs
No edit summary
Line 1: Line 1:
<p class="note">'''Note''': This page outlines ideas for further messaging improvements. It's a ''specification under construction''! If you have any comments or suggestions, please add them to the [[Development talk:Messaging 2.0|page comments]].''</p>
The messaging system in 2.0 has been revamped significantly. It is now event-driven, and allows users to control exactly what messages they receive and how.


==Revise 2007 code==


First steps are to review the current code:
==How to enable it==
# [http://cvs.moodle.org/contrib/patches/messaging_v2/ 2007 code]]
# Make code conform to [[Coding| Code guidelines]]
# Add phpdocs 
# lib/messagelib.php
# Review from mentor and other programmers
# Check into HEAD
# Continue polishing as necessary


Admin > Optional subsystems > Enable messaging system = Yes


==Extend basic messaging system==


# Store content formats for each message and use these when routing messages.  eg HTML messages from forums should be converted into basic text, etc  Sometimes certain message types won't be possible to route to certain output plugins - the GUI should indicate this clearly.
==How to configure it==
# Test everything very well.


Visit your own profile page (you need '''moodle/user:editownmessageprofile''' permission).


==Enhance the messaging popup GUI==
==How it works==
 
===Input===
We have events called "message_send" that look like this:
 
<code php>
$eventdata = new object();
$eventdata->component        = 'mod/forum';
$eventdata->name              = 'posts';
$eventdata->userfrom          = $userfrom;      // object
$eventdata->userto            = $userto;        // object
$eventdata->subject          = $postsubject;
$eventdata->fullmessage      = $posttext;      // raw text
$eventdata->fullmessageformat = FORMAT_PLAIN;  // text format
$eventdata->fullmessagehtml  = $posthtml;      // html rendered version
$eventdata->smallmessage      = '';            // useful for plugins like sms or twitter
 
events_trigger('message_send', $eventdata);
</php>
 
More of these can be added throughout Moodle as necessary, it's quite easy.
 
===Output===
 
In [http://cvs.moodle.org/moodle/message/output /message/output] there are full Moodle plugins for each type of output. 
 
Currently we have support for email, jabber and web-based popups.  Could add twitter and SMS quite easily.
 
Each plugin simply extends a class called "message_output" in [http://cvs.moodle.org/moodle/message/output/lib.php /message/output/lib.php] with methods for:
 
* send_message()
* config_form()
* process_form()
* load_data()


# Examine [http://tracker.moodle.org/browse/MDL/component/10084 the requests in the tracker], edit/prioritise/improve them
# [http://moodle.org/mod/forum/view.php?id=2697 Publicise the project in the forums], ask community to file issues and/or vote on them
# Tackle the [http://tracker.moodle.org/browse/MDL/component/10084?selected=com.atlassian.jira.plugin.system.project:component-popularissues-panel most requested items] first


==See also==
==See also==

Revision as of 04:19, 25 November 2008

The messaging system in 2.0 has been revamped significantly. It is now event-driven, and allows users to control exactly what messages they receive and how.


How to enable it

Admin > Optional subsystems > Enable messaging system = Yes


How to configure it

Visit your own profile page (you need moodle/user:editownmessageprofile permission).

How it works

Input

We have events called "message_send" that look like this:

$eventdata = new object(); $eventdata->component = 'mod/forum'; $eventdata->name = 'posts'; $eventdata->userfrom = $userfrom; // object $eventdata->userto = $userto; // object $eventdata->subject = $postsubject; $eventdata->fullmessage = $posttext; // raw text $eventdata->fullmessageformat = FORMAT_PLAIN; // text format $eventdata->fullmessagehtml = $posthtml; // html rendered version $eventdata->smallmessage = ; // useful for plugins like sms or twitter

events_trigger('message_send', $eventdata); </php>

More of these can be added throughout Moodle as necessary, it's quite easy.

Output

In /message/output there are full Moodle plugins for each type of output.

Currently we have support for email, jabber and web-based popups. Could add twitter and SMS quite easily.

Each plugin simply extends a class called "message_output" in /message/output/lib.php with methods for:

  • send_message()
  • config_form()
  • process_form()
  • load_data()


See also