Permalink
Browse files

MDL-32124 - mails to non respondents are sent as plain text with html…

…-tags
  • Loading branch information...
1 parent f24ff8f commit 767ed44ca4ed5484c2ded0d52022125de3feae7d @grabs grabs committed Apr 7, 2012
Showing with 25 additions and 6 deletions.
  1. +25 −6 mod/feedback/show_nonrespondents.php
@@ -33,7 +33,7 @@
$subject = optional_param('subject', '', PARAM_CLEANHTML);
$message = optional_param('message', '', PARAM_CLEANHTML);
$format = optional_param('format', FORMAT_MOODLE, PARAM_INT);
-$messageuser = optional_param('messageuser', false, PARAM_INT);
+$messageuser = optional_param_array('messageuser', false, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA);
$perpage = optional_param('perpage', FEEDBACK_DEFAULT_PAGE_COUNT, PARAM_INT); // how many per page
$showall = optional_param('showall', false, PARAM_INT); // should we show all users
@@ -80,9 +80,31 @@
print_error('invalidsesskey');
}
+$strfeedbacks = get_string("modulenameplural", "feedback");
+$strfeedback = get_string("modulename", "feedback");
+
require_capability('mod/feedback:viewreports', $context);
if ($action == 'sendmessage' AND has_capability('moodle/course:bulkmessaging', $coursecontext)) {
+ $shortname = format_string($course->shortname,
+ true,
+ array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
+
+ $htmlmessage = "<body id=\"email\">";
+
+ $link1 = $CFG->wwwroot.'/course/view.php?id='.$course->id;
+ $link2 = $CFG->wwwroot.'/mod/feedback/index.php?id='.$course->id;
+ $link3 = $CFG->wwwroot.'/mod/feedback/view.php?id='.$cm->id;
+
+ $htmlmessage .= '<div class="navbar">'.
+ '<a target="_blank" href="'.$link1.'">'.$shortname.'</a> &raquo; '.
+ '<a target="_blank" href="'.$link2.'">'.$strfeedbacks.'</a> &raquo; '.
+ '<a target="_blank" href="'.$link3.'">'.format_string($feedback->name, true).'</a>'.
+ '</div>';
+
+ $htmlmessage .= $message;
+ $htmlmessage .= '</body>';
+
$good = 1;
if (is_array($messageuser)) {
foreach ($messageuser as $userid) {
@@ -93,9 +115,9 @@
$eventdata->userfrom = $USER;
$eventdata->userto = $senduser;
$eventdata->subject = $subject;
- $eventdata->fullmessage = $message;
+ $eventdata->fullmessage = html_to_text($htmlmessage);
$eventdata->fullmessageformat = FORMAT_PLAIN;
- $eventdata->fullmessagehtml = '';
+ $eventdata->fullmessagehtml = $htmlmessage;
$eventdata->smallmessage = '';
$good = $good && message_send($eventdata);
}
@@ -114,9 +136,6 @@
////////////////////////////////////////////////////////
/// Print the page header
-$strfeedbacks = get_string("modulenameplural", "feedback");
-$strfeedback = get_string("modulename", "feedback");
-
$PAGE->navbar->add(get_string('show_nonrespondents', 'feedback'));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title(format_string($feedback->name));

0 comments on commit 767ed44

Please sign in to comment.