Skip to content
Snippets Groups Projects
Unverified Commit d77f39b2 authored by fs959857's avatar fs959857 Committed by Tim Schroeder
Browse files

bugfix notifications: correct userid in link to settings

parent a2ac0124
No related branches found
No related tags found
No related merge requests found
......@@ -499,10 +499,10 @@ if ($action === 'report') {
$report->url = $CFG->wwwroot . '/mod/pdfannotator/view.php?id=' . $cm->id . '&action=overviewreports';
$messagetext = new stdClass();
$messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, get_string('modulename', 'pdfannotator'), $cm->name, $report, 'reportadded');
$messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, get_string('modulename', 'pdfannotator'), $cm->name, $report, 'reportadded');
$messagetext->url = $report->url;
try {
foreach ($recipients as $recipient) {
$messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, get_string('modulename', 'pdfannotator'), $cm->name, $report, 'reportadded', $recipient->id);
$messageid = pdfannotator_notify_manager($recipient, $course, $cm, $name, $messagetext);
}
// 2. Notify the reporting user that their report has been sent off (display blue toast box at top of page).
......
......@@ -260,10 +260,10 @@ function pdfannotator_send_forward_message($recipients, $messageparams, $course,
$text = new stdClass();
$module = get_string('modulename', 'pdfannotator');
$text->text = pdfannotator_format_notification_message_text($course, $cm, $context, $module, $cm->name, $messageparams, $name);
$text->html = pdfannotator_format_notification_message_html($course, $cm, $context, $module, $cm->name, $messageparams, $name);
$text->url = $messageparams->urltoquestion;
foreach ($recipients as $recipient) {
$text->html = pdfannotator_format_notification_message_html($course, $cm, $context, $module, $cm->name, $messageparams, $name, $recipient);
pdfannotator_notify_manager($recipient, $course, $cm, $name, $text);
}
}
......@@ -323,7 +323,7 @@ function pdfannotator_format_notification_message_text($course, $cm, $context, $
* @param stdClass $coursemodule
* @param string $assignmentname
*/
function pdfannotator_format_notification_message_html($course, $cm, $context, $modulename, $pdfannotatorname, $report, $messagetype) {
function pdfannotator_format_notification_message_html($course, $cm, $context, $modulename, $pdfannotatorname, $report, $messagetype, $recipientid) {
global $CFG, $USER;
$formatparams = array('context' => $context->get_course_context());
$posthtml = '<p><font face="sans-serif">' .
......@@ -339,7 +339,7 @@ function pdfannotator_format_notification_message_html($course, $cm, $context, $
$posthtml .= '<hr /><font face="sans-serif">';
$report->urltoreport = $CFG->wwwroot . '/mod/pdfannotator/view.php?id=' . $cm->id . '&action=overviewreports';
$posthtml .= '<p>' . get_string($messagetype . 'html', 'pdfannotator', $report) . '</p>';
$linktonotificationsettingspage = new moodle_url('/message/notificationpreferences.php', array('userid' => $USER->id));
$linktonotificationsettingspage = new moodle_url('/message/notificationpreferences.php', array('userid' => $recipientid));
$linktonotificationsettingspage = $linktonotificationsettingspage->__toString();
$posthtml .= '</font><hr />';
$posthtml .= '<font face="sans-serif"><p>' . get_string('unsubscribe_notification', 'pdfannotator', $linktonotificationsettingspage) . '</p></font>';
......
......@@ -89,11 +89,11 @@ class pdfannotator_comment {
$messagetext = new stdClass();
$module = get_string('modulename', 'pdfannotator');
$messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, $module, $cm->name, $comment, 'newanswer');
$messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, $module, $cm->name, $comment, 'newanswer');
$messagetext->url = $comment->urltoanswer;
$recipients = self::get_subscribed_users($annotationid);
foreach ($recipients as $recipient) {
if ($recipient != $USER->id) {
$messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, $module, $cm->name, $comment, 'newanswer', $recipient);
$messageid = pdfannotator_notify_manager($recipient, $course, $cm, 'newanswer', $messagetext, $anonymous);
}
}
......@@ -112,12 +112,12 @@ class pdfannotator_comment {
$messagetext = new stdClass();
$messagetext->text = pdfannotator_format_notification_message_text($course, $cm, $context, get_string('modulename', 'pdfannotator'), $cm->name, $question, 'newquestion');
$messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, get_string('modulename', 'pdfannotator'), $cm->name, $question, 'newquestion');
$messagetext->url = $question->urltoanswer;
foreach ($recipients as $recipient) {
if ($recipient->id == $USER->id) {
continue;
}
$messagetext->html = pdfannotator_format_notification_message_html($course, $cm, $context, get_string('modulename', 'pdfannotator'), $cm->name, $question, 'newquestion', $recipient->id);
$messageid = pdfannotator_notify_manager($recipient, $course, $cm, 'newquestion', $messagetext, $anonymous);
}
......
......@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_pdfannotator'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2020032600; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2020040800; // The current module version (Date: YYYYMMDDXX).
$plugin->release = 'PDF Annotator v1.3 release 2';
$plugin->requires = 2016112900; // Requires this Moodle version.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment