Permalink
Browse files

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

…-tags
  • Loading branch information...
1 parent 4b3ee4f commit 53dcf634889e5cc5a923f921ef0579190728cb0c @grabs grabs committed Apr 7, 2012
Showing with 25 additions and 7 deletions.
  1. +25 −7 mod/feedback/show_nonrespondents.php
@@ -66,12 +66,33 @@
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)) {
- // require_once($CFG->dirroot.'/message/lib.php');
+ $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)) {
+ if (is_array($messageuser)) {
foreach ($messageuser as $userid) {
$senduser = $DB->get_record('user', array('id'=>$userid));
$eventdata = new stdClass();
@@ -80,9 +101,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);
}
@@ -101,9 +122,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 53dcf63

Please sign in to comment.