Actions

Developer Area/Core Subsystems/Notifications

From Mahara Wiki

< Developer Area‎ | Core Subsystems
Revision as of 18:14, 12 May 2011 by WikiSysop (talk | contribs)

Mahara has a notifications framework for getting messages to users through a variety of means.

Notification types are plugins, currently there exists three:

Internal - all activity shows up in the user's 'recent activity' page Email - user gets an email per notification Emaildigest - user gets an email each day with a summary of all notifications.

For each type of activity (discussed later), the user can direct it to one of these different plugins.

Notifications will always go to the activity log, but if a different notification plugin has been selected, they will go there marked as read.

For all the types of activity, you need to call activity_occured and pass it the activity type (described below) and an array (or stdclass object) of information. Each activity type expects different information.

The different types of activity are:

watchlist (artefact)

Activity that occurs on an artefact (edit)

Will notify any users who are monitoring that artefact or any artefacts that have this artefact as a child.

Requires $data->artefact (id of artefact) and should have $data->subject

watchlist (view)

Any new items added to the view, or the view name/description etc changed.

Will notify any users who are monitoring the view.

Requires $data->view (id of view) and $data->subject (eg 'artefact was added')

watchlist (community)

Unclear what activity on a community is so far.

Will notify any users who are monitoring the community.

Requires $data->community (id of community) and $data->subject (eg 'user was added etc)

maharamessage

System message. Will notify all users the message is sent to.

Requires $data->message and $data->subject (contents of message) and $data->users (array of user ids)

usermessage

Message from one user to another. Will notify the user the message is sent to.

Requires $data->message and $data->subject(contents of message), $data->userto (id of user message is sent to), $data->userfrom (id of user message is sent from)

feedback (artefact)

Feedback on an artefact. Will notify the artefact owner.

Requires $data->artefact (id of artefact) and $data->view (id of view) and $data->subject and $data->feedback (contents of feedback)

feedback (view)

Feedback on a view. Will notify the view owner.

Requires $data->view (id of view) and $data->subject and $data->feedback (contents of feedback)

newview

A new view is created. Will notify any users who have access to this view (through friends list, user list or group list (view permissions))

Requires $data->view (id of new view) and $data->owner (id of user owning new view)

viewaccess

View access has changed. Will notify any users who have access to this view (through the same 3 ways as newview), and who AREN'T in the list of oldusers passed in

Requires the same two args as newview and $data->oldusers (as calling activity_get_viewaccess_users($view, $owner); will return)

contactus

The Contact Us form is filled out. Will notify all admin users subscribed (as per AdminNotifications?.

Requires $data->subject, $data->message, $data->userfrom (if loggedin), $data->fromname, $data->fromemail

TODO: other admin messages