diff --git a/controller.php b/controller.php index e39c140e39e6751b8b0d296d872a13714b308247..9f763193ff034f50b4b5e6a067c354d4b67200ee 100644 --- a/controller.php +++ b/controller.php @@ -498,11 +498,11 @@ if ($action === 'report') { $report->reportinguser = fullname($USER); $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->text = pdfannotator_format_notification_message_text($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). diff --git a/locallib.php b/locallib.php index 3a2e921ce904c9d7e7bec19bdd16cef746d954b9..b1d86354d7b37db94b5c08280f2943109f7167b9 100644 --- a/locallib.php +++ b/locallib.php @@ -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>'; diff --git a/model/comment.class.php b/model/comment.class.php index e856ac6820542283aa6034066d5800e0d187cdf7..ac4e4079eee6eed091b23238fd889435c8a07caf 100644 --- a/model/comment.class.php +++ b/model/comment.class.php @@ -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); } diff --git a/version.php b/version.php index 077b3492940a27627484e343521f0af8e76932b9..1a96ab9d2de5b376a47aa84c51874d33fbcab49c 100644 --- a/version.php +++ b/version.php @@ -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.