Commit 9e52bce7 authored by Penny Leach's avatar Penny Leach
Browse files

more work on notification stuffs

parent 0309529d
...@@ -36,4 +36,6 @@ $string['typeobjectionable'] = 'Objectionable content'; ...@@ -36,4 +36,6 @@ $string['typeobjectionable'] = 'Objectionable content';
$string['typevirusrepeat'] = 'Virus flat repeat'; $string['typevirusrepeat'] = 'Virus flat repeat';
$string['typevirusrelease'] = 'Virus flag release'; $string['typevirusrelease'] = 'Virus flag release';
$string['type'] = 'Activity type: ';
$string['attime'] = 'at';
?> ?>
\ No newline at end of file
...@@ -30,5 +30,5 @@ $string['emailsubject'] = 'Message from Mahara: %s'; ...@@ -30,5 +30,5 @@ $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. 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"; $string['emailbodynoreply'] = "This is an auto generated notification from Mahara. Following is the content of your notification\n\n--------------------------------------------------\n\n";
$string['emailbodyending'] = 'To update your notification preferences, visit %s';
?> ?>
\ No newline at end of file
...@@ -45,6 +45,8 @@ class PluginNotificationEmail extends PluginNotification { ...@@ -45,6 +45,8 @@ class PluginNotificationEmail extends PluginNotification {
$messagebody = get_string('emailbodynoreply', 'notification.email') $messagebody = get_string('emailbodynoreply', 'notification.email')
. $data->message; . $data->message;
} }
$prefurl = get_config('wwwroot') . 'account/activityprefs.php';
$messagebody .= "\n\n" . get_string('emailbodyending', 'notification.email', $prefurl);
email_user($user, $userfrom, $subject, $messagebody); email_user($user, $userfrom, $subject, $messagebody);
} }
} }
......
...@@ -29,5 +29,5 @@ defined('INTERNAL') || die(); ...@@ -29,5 +29,5 @@ defined('INTERNAL') || die();
$string['emailsubject'] = 'Message from Mahara: Daily digest'; $string['emailsubject'] = 'Message from Mahara: Daily digest';
$string['emailbodynoreply'] = "This is an auto generated notification from Mahara. Following is the daily digest of all your notifications\n\n--------------------------------------------------\n\n"; $string['emailbodynoreply'] = "This is an auto generated notification from Mahara. Following is the daily digest of all your notifications\n\n--------------------------------------------------\n\n";
$string['emailbodyending'] = 'To update your notification preferences, visit %s';
?> ?>
\ No newline at end of file
...@@ -79,14 +79,30 @@ class PluginNotificationEmaildigest extends PluginNotification { ...@@ -79,14 +79,30 @@ class PluginNotificationEmaildigest extends PluginNotification {
} }
foreach ($users as $user) { foreach ($users as $user) {
$subject = get_string('emailsubject', 'notification.emaildigest');
//delete_records_select('notification_emaildigest_queue', 'ctime <= '); $body = get_string('emailbodynoreply', 'notification.emaildigest');
foreach ($user->entries as $entry) {
$body .= get_string('type', 'activity') . $entry->nicetype
. get_string('attime') . $entry->ctime . "\n"
. $queue->message;
if (!empty($queue->url)) {
$body .= "\n" . $queue->url;
}
$prefurl = get_config('wwwroot') . 'account/activityprefs.php';
$body .= "\n\n" . get_string('emailbodyending', 'notification.emaildigest', $prefurl););
}
try {
email_user($user->user, null, $subject, $body);
// only delete them if the email succeeded!
delete_records_select('notification_emaildigest_queue',
'id IN (' . db_array_to_ph($entries) . ')',
array_keys($user->entries));
}
catch (Exception $e) {
// @todo
}
} }
} }
} }
......
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