Added plaintext lang variants for email bodies and updated template (#230)

This commit is contained in:
Aaron Parker 2018-08-24 16:24:02 +01:00 committed by Mark Nelson
parent ff02ba71aa
commit 76a20a80e0
3 changed files with 7 additions and 3 deletions

View file

@ -102,11 +102,13 @@ class email_certificate implements \renderable, \templatable {
if ($this->isstudent) { if ($this->isstudent) {
$data->emailgreeting = get_string('emailstudentgreeting', 'customcert', $this->userfullname); $data->emailgreeting = get_string('emailstudentgreeting', 'customcert', $this->userfullname);
$data->emailbody = get_string('emailstudentbody', 'customcert', $info); $data->emailbody = get_string('emailstudentbody', 'customcert', $info);
$data->emailbodyplaintext = get_string('emailstudentbodyplaintext', 'customcert', $info);
$data->emailcertificatelink = new \moodle_url('/mod/customcert/view.php', array('id' => $this->cmid)); $data->emailcertificatelink = new \moodle_url('/mod/customcert/view.php', array('id' => $this->cmid));
$data->emailcertificatetext = get_string('emailstudentcertificatelinktext', 'customcert'); $data->emailcertificatetext = get_string('emailstudentcertificatelinktext', 'customcert');
} else { } else {
$data->emailgreeting = get_string('emailnonstudentgreeting', 'customcert'); $data->emailgreeting = get_string('emailnonstudentgreeting', 'customcert');
$data->emailbody = get_string('emailnonstudentbody', 'customcert', $info); $data->emailbody = get_string('emailnonstudentbody', 'customcert', $info);
$data->emailbodyplaintext = get_string('emailnonstudentbodyplaintext', 'customcert', $info);
$data->emailcertificatelink = new \moodle_url('/mod/customcert/view.php', array('id' => $this->cmid)); $data->emailcertificatelink = new \moodle_url('/mod/customcert/view.php', array('id' => $this->cmid));
$data->emailcertificatetext = get_string('emailnonstudentcertificatelinktext', 'customcert'); $data->emailcertificatetext = get_string('emailnonstudentcertificatelinktext', 'customcert');
} }

View file

@ -72,10 +72,12 @@ Please note: The elements are rendered in this order. The order can be changed b
$string['elementwidth'] = 'Width'; $string['elementwidth'] = 'Width';
$string['elementwidth_help'] = 'Specify the width of the element - \'0\' means that there is no width constraint.'; $string['elementwidth_help'] = 'Specify the width of the element - \'0\' means that there is no width constraint.';
$string['emailnonstudentbody'] = 'Attached is the certificate \'{$a->certificatename}\' for \'{$a->userfullname}\' for the course \'{$a->coursefullname}\'.'; $string['emailnonstudentbody'] = 'Attached is the certificate \'{$a->certificatename}\' for \'{$a->userfullname}\' for the course \'{$a->coursefullname}\'.';
$string['emailnonstudentbodyplaintext'] = 'Attached is the certificate \'{$a->certificatename}\' for \'{$a->userfullname}\' for the course \'{$a->coursefullname}\'.';
$string['emailnonstudentcertificatelinktext'] = 'View certificate report'; $string['emailnonstudentcertificatelinktext'] = 'View certificate report';
$string['emailnonstudentgreeting'] = 'Hi'; $string['emailnonstudentgreeting'] = 'Hi';
$string['emailnonstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}'; $string['emailnonstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}';
$string['emailstudentbody'] = 'Attached is your certificate \'{$a->certificatename}\' for the course \'{$a->coursefullname}\'.'; $string['emailstudentbody'] = 'Attached is your certificate \'{$a->certificatename}\' for the course \'{$a->coursefullname}\'.';
$string['emailstudentbodyplaintext'] = 'Attached is your certificate \'{$a->certificatename}\' for the course \'{$a->coursefullname}\'.';
$string['emailstudentcertificatelinktext'] = 'View certificate'; $string['emailstudentcertificatelinktext'] = 'View certificate';
$string['emailstudentgreeting'] = 'Dear {$a}'; $string['emailstudentgreeting'] = 'Dear {$a}';
$string['emailstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}'; $string['emailstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}';

View file

@ -27,18 +27,18 @@
Context variables required for this template: Context variables required for this template:
* emailgreeting * emailgreeting
* emailbody * emailbodyplaintext
* emailcertificatelink * emailcertificatelink
* emailcertificatelinktext * emailcertificatelinktext
Example context (json): Example context (json):
{ {
"emailgreeting": "Dear Angus MacGyver", "emailgreeting": "Dear Angus MacGyver",
"emailbody": "Attached is your certificate 'The basics' for the course 'Survival as an '80s action hero'", "emailbodyplaintext": "Attached is your certificate 'The basics' for the course 'Survival as an '80s action hero'",
"emailcertificatelink": "http://yoursite.com/mod/customcert/view.php?id=4", "emailcertificatelink": "http://yoursite.com/mod/customcert/view.php?id=4",
"emailcertificatelinktext": "Certificate report" "emailcertificatelinktext": "Certificate report"
} }
}} }}
{{{emailgreeting}}} {{{emailgreeting}}}
{{{emailbody}}} {{{emailbodyplaintext}}}