MDL-47162 core_message: Add course id to message eventdata

This commit is contained in:
Amanda Doughty 2016-07-20 12:40:34 +01:00 committed by Eloy Lafuente (stronk7)
parent 577bd70d38
commit cc350fd9c8
34 changed files with 345 additions and 76 deletions

View file

@ -257,13 +257,21 @@ switch ($mode) {
$a->lesson = format_string($lesson->name, true);
// Fetch message HTML and plain text formats
$b = new stdClass();
$b->essay = format_string($pages[$attempt->pageid]->title, true);
$b->lesson = $lesson->properties()->name;
$b->course = $course->idnumber ? $course->idnumber : $course->fullname;
$message = get_string('essayemailmessage2', 'lesson', $a);
$plaintext = format_text_email($message, FORMAT_HTML);
// Subject
$subject = get_string('essayemailsubject', 'lesson');
$eventdata = new stdClass();
// Context url.
$contexturl = new moodle_url('/grade/report/user/index.php', array('id' => $course->id));
$eventdata = new \core\message\message();
$eventdata->courseid = $course->id;
$eventdata->modulename = 'lesson';
$eventdata->userfrom = $USER;
$eventdata->userto = $users[$attempt->userid];
@ -271,7 +279,8 @@ switch ($mode) {
$eventdata->fullmessage = $plaintext;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = $message;
$eventdata->smallmessage = '';
$eventdata->smallmessage = $smallmessage;
$eventdata->contexturl = $contexturl;
// Required for messaging framework
$eventdata->component = 'mod_lesson';

View file

@ -178,6 +178,7 @@ $string['eolstudentoutoftime'] = 'Attention: You ran out of time for this lesso
$string['eolstudentoutoftimenoanswers'] = 'You did not answer any questions. You have received a 0 for this lesson.';
$string['essay'] = 'Essay';
$string['essayemailmessage2'] = '<p>Essay prompt: {$a->question}</p><p>Your response: <em>{$a->response}</em></p><p>Grader\'s comments: <em>{$a->comment}</em></p><p>You have received {$a->earned} out of {$a->outof} for this essay question.</p><p>Your grade for the {$a->lesson} lesson has been changed to {$a->newgrade}&#37;.</p>';
$string['essayemailmessage3'] = 'Your submission to {$a->lesson} essay {$a->essay} in {$a->course} has been graded.';
$string['essayemailsubject'] = 'Grade available for lesson question';
$string['essayresponses'] = 'Essay responses';
$string['essays'] = 'Essays';