Merge branch 'MDL-32124_master_wip' of git://github.com/grabs/moodle

This commit is contained in:
Sam Hemelryk 2012-04-10 17:21:00 +12:00
commit 9f8662a528

View File

@ -33,7 +33,7 @@ $id = required_param('id', PARAM_INT);
$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 @@ if (($formdata = data_submitted()) AND !confirm_sesskey()) {
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 @@ if ($action == 'sendmessage' AND has_capability('moodle/course:bulkmessaging', $
$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 @@ if ($action == 'sendmessage' AND has_capability('moodle/course:bulkmessaging', $
////////////////////////////////////////////////////////
/// 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));