Commit d0cbf332 authored by Penny Leach's avatar Penny Leach
Browse files

internal and email notification plugins now do *stuff*

parent e079cd3a
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage notification-internal
* @author Penny Leach <penny@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['typemaharamessage'] = 'System message';
$string['typeusermessage'] = 'Message from user';
$string['typefeedback'] = 'Feedback';
$string['typewatchlist'] = 'Watchlist';
$string['typenewview'] = 'New view';
$string['typecontactus'] = 'Contact us';
$string['typeobjectionable'] = 'Objectionable content';
$string['typevirusrepeat'] = 'Virus flat repeat';
$string['typevirusrelease'] = 'Virus flag release';
?>
\ No newline at end of file
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage notification-internal
* @author Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['emailsubject'] = 'Message from Mahara: %s';
$string['emailbodynoreply'] = "This is an auto generated notification from Mahara. Please do not reply to this message. Following is the content of your notification\n\n--------------------------------------------------\n\n";
$string['emailbodynoreply'] = "This is an auto generated notification from Mahara. Following is the content of your notification\n\n--------------------------------------------------\n\n";
?>
\ No newline at end of file
...@@ -31,7 +31,21 @@ require_once(get_config('docroot') . 'notification/lib.php'); ...@@ -31,7 +31,21 @@ require_once(get_config('docroot') . 'notification/lib.php');
class PluginNotificationEmail extends PluginNotification { class PluginNotificationEmail extends PluginNotification {
public static function notify_user($user, $data) { public static function notify_user($user, $data) {
// @todo
$fulltype = get_string('type' . $data->type, 'activity');
$subject = get_string('emailsubject', 'notification.email', $fulltype);
if (!empty($data->userfrom)) {
$userfrom = get_record('usr', 'id', $data->userfrom);
$messagebody = get_string('emailbody', 'notification.email')
. $data->message;
}
else {
$userfrom = null;
$messagebody = get_string('emailbodynoreply', 'notification.email')
. $data->message;
}
email_user($user, $userfrom, $subject, $messagebody);
} }
} }
......
...@@ -30,7 +30,7 @@ class PluginNotificationInternal extends PluginNotification { ...@@ -30,7 +30,7 @@ class PluginNotificationInternal extends PluginNotification {
public static function notify_user($user, $data) { public static function notify_user($user, $data) {
$toinsert = new StdClass; $toinsert = new StdClass;
$toinsert->type = $data->activitytype; $toinsert->type = $data->type;
$toinsert->usr = $user->id; $toinsert->usr = $user->id;
if (!empty($user->markasread)) { if (!empty($user->markasread)) {
$toinsert->read = 1; $toinsert->read = 1;
...@@ -38,8 +38,8 @@ class PluginNotificationInternal extends PluginNotification { ...@@ -38,8 +38,8 @@ class PluginNotificationInternal extends PluginNotification {
else { else {
$toinsert->read = 0; $toinsert->read = 0;
} }
$toinsert->message = $message; $toinsert->message = $data->message;
$toinsert->cime = db_format_timestamp(time()); $toinsert->ctime = db_format_timestamp(time());
if (!empty($data->url)) { if (!empty($data->url)) {
$toinsert->url = $data->url; $toinsert->url = $data->url;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment