Skip to content

Commit

Permalink
Added settings to customize the subject and conclusion for report mai…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
gmanaud committed Jun 6, 2024
1 parent bd620b3 commit 65ccba9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/task/mailing_task.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,11 @@ public function execute() {

$finalcontent .= $mailingintroduction;
$finalcontent .= $mailcontent;
$finalcontent .= get_string('mailingoutro', 'report_coursemanager');
$finalcontent .= '<br />';
$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);
}
Expand Down
4 changes: 4 additions & 0 deletions lang/en/report_coursemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>
You can use the following variables :<br>
%userfirstname% : User\'s first name<br>
%userlastname% : User\'s last name<br>
%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';
Expand Down
4 changes: 4 additions & 0 deletions lang/fr/report_coursemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>
Vous pouvez utiliser les variables suivantes :<br>
%userfirstname% : prénom de l\'utilisateur<br>
%userlastname% : nom de l\'utilisateur<br>
%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';
Expand Down
21 changes: 21 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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',
Expand Down

0 comments on commit 65ccba9

Please sign in to comment.