From 65ccba908ff4b27cd1957f7868970ac14f493e12 Mon Sep 17 00:00:00 2001 From: Geoffroy Manaud Date: Thu, 6 Jun 2024 12:12:04 +0200 Subject: [PATCH] Added settings to customize the subject and conclusion for report mailing --- classes/task/mailing_task.php | 5 +++-- lang/en/report_coursemanager.php | 4 ++++ lang/fr/report_coursemanager.php | 4 ++++ settings.php | 21 +++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) mode change 100644 => 100755 classes/task/mailing_task.php diff --git a/classes/task/mailing_task.php b/classes/task/mailing_task.php old mode 100644 new mode 100755 index b560c30..d25a498 --- a/classes/task/mailing_task.php +++ b/classes/task/mailing_task.php @@ -175,10 +175,11 @@ public function execute() { $finalcontent .= $mailingintroduction; $finalcontent .= $mailcontent; - $finalcontent .= get_string('mailingoutro', 'report_coursemanager'); + $finalcontent .= '
'; + $finalcontent .= get_config('report_coursemanager', 'mailing_outro'); $send = email_to_user($teacheruserinfo, $from, - get_string('mailingtitle', 'report_coursemanager'), $finalcontent); + get_config('report_coursemanager', 'mailing_title'), $finalcontent); mtrace('Mail sent to user '.$teacher->idteacher); } diff --git a/lang/en/report_coursemanager.php b/lang/en/report_coursemanager.php index ade098d..b3fbd9f 100755 --- a/lang/en/report_coursemanager.php +++ b/lang/en/report_coursemanager.php @@ -65,12 +65,16 @@ $string['enablestudentstask_desc'] = 'If checked, activates automated task to detect courses without students or without recent students visits.'; $string['enableorphanstask'] = 'Activate orphaned submissions report'; $string['enableorphanstask_desc'] = 'If checked, activates automated task to detect assigns with orphaned files.'; +$string['mailingtitle_setting'] = 'Subject of the email'; +$string['mailingtitle_setting_desc'] = 'Subject line for the mailing sent to teachers.'; $string['mailingintro_setting'] = 'Email content'; $string['mailingintro_setting_desc'] = 'Introduction of the report mailing.
You can use the following variables :
%userfirstname% : User\'s first name
%userlastname% : User\'s last name
%coursemanagerlink% : Course Manager\'s link'; +$string['mailingoutro_setting'] = 'Email outro'; +$string['mailingoutro_setting_desc'] = 'End of content of the report mailing.'; // Headings for settings page. $string['reportssettingsheading'] = 'Settings for reports calculation'; diff --git a/lang/fr/report_coursemanager.php b/lang/fr/report_coursemanager.php index 9301f67..b7dc8ea 100755 --- a/lang/fr/report_coursemanager.php +++ b/lang/fr/report_coursemanager.php @@ -65,12 +65,16 @@ $string['enablestudentstask_desc'] = 'Si coché, active la tâche permettant de détecter les cours sans étudiants ou sans visites d\'étudiants récents.'; $string['enableorphanstask'] = 'Activer le rapport des devoirs orphelins'; $string['enableorphanstask_desc'] = 'Si coché, active la tâche permettant de détecter les fichiers orphelins dans les devoirs.'; +$string['mailingtitle_setting'] = 'Objet du mail'; +$string['mailingtitle_setting_desc'] = 'Objet pour le mailing envoyé aux enseignants.'; $string['mailingintro_setting'] = 'Introduction du mail'; $string['mailingintro_setting_desc'] = 'Message d\'introduction pour le mailing envoyé aux enseignants.
Vous pouvez utiliser les variables suivantes :
%userfirstname% : prénom de l\'utilisateur
%userlastname% : nom de l\'utilisateur
%coursemanagerlink% : lien vers le gestionnaire de cours'; +$string['mailingoutro_setting'] = 'Conclusion du mail'; +$string['mailingoutro_setting_desc'] = 'Message de conclusion pour le mailing envoyé aux enseignants.'; // Headings for settings page. $string['reportssettingsheading'] = 'Paramètres pour le calcul des rapports'; diff --git a/settings.php b/settings.php index 47192cd..34ab75e 100755 --- a/settings.php +++ b/settings.php @@ -162,6 +162,13 @@ $description = get_string('enablemailing_desc', 'report_coursemanager'); $settings->add(new admin_setting_configcheckbox($name, $title, $description, 0)); + // Subject of the email for report mailing. + $name = 'report_coursemanager/mailing_title'; + $title = get_string('mailingtitle_setting', 'report_coursemanager'); + $description = get_string('mailingtitle_setting_desc', 'report_coursemanager'); + $default = get_string('mailingtitle', 'report_coursemanager'); + $settings->add(new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT, '50')); + // Introduction for report mailing. $name = 'report_coursemanager/mailing_introduction'; $title = get_string('mailingintro_setting', 'report_coursemanager'); @@ -175,6 +182,20 @@ PARAM_RAW ) ); + + // Outro for report mailing. + $name = 'report_coursemanager/mailing_outro'; + $title = get_string('mailingoutro_setting', 'report_coursemanager'); + $description = get_string('mailingoutro_setting_desc', 'report_coursemanager'); + $settings->add( + new admin_setting_configtextarea( + $name, + $title, + $description, + get_string('mailingoutro', 'report_coursemanager'), + PARAM_RAW + ) + ); } $ADMIN->add('reports', new admin_externalpage('report_coursemanager',