19declare(strict_types=1);
37 $lng->loadLanguageModule(self::LANGMODULE);
38 $lng->loadLanguageModule(
"mail");
39 $this->languages[
$lng->getLangKey()] =
$lng;
48 $ass = $prg->getSpecificAssignment($assignment_id);
54 return \ilObjUser::_getPreferences($usr_id)[
'language'];
57 protected function txt(
string $identifier,
string $lang): string
59 if(!array_key_exists(
$lang, $this->languages)) {
61 $lng->loadLanguageModule(self::LANGMODULE);
62 $lng->loadLanguageModule(
"mail");
66 return $lng->txtlng(self::LANGMODULE, $identifier,
$lang);
75 $user_info = $assignment->getUserInformation();
76 $gender = $user_info->getGender() ?:
'anonymous';
77 $name = implode(
' ', [$user_info->getFirstname(), $user_info->getLastname()]);
78 $login = $user_info->getLogin();
82 $salutation = $this->
txt(
"mail_salutation_" . $gender,
$lang);
83 $subject = $this->
txt($subject,
$lang);
84 $body_template = $this->
txt($body_template,
$lang);
92 .
'<br /><br />' . $prg_link;
96 $mail->enqueue($login,
'',
'', $subject, $body, []);
98 }
catch (Exception
$e) {
99 $this->log->write(
$e->getMessage());
106 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
108 if (! $prg->
getSettings()->getAutoMailSettings()->getReminderNotRestartedByUserDays() > 0) {
109 $this->log->write(
"Send info to re-assign mail is deactivated in study programme settings");
113 $subject =
"info_to_re_assign_mail_subject";
114 $body_template =
"info_to_re_assign_mail_body";
115 $sent = $this->sendMail($prg, $ass, $subject, $body_template);
124 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
125 $now = new \DateTimeImmutable();
126 $vq = $ass->getProgressTree()->getValidityOfQualification();
128 if ($vq && $vq > $now) {
135 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
137 if (! $prg->
getSettings()->getAutoMailSettings()->getProcessingEndsNotSuccessfulDays() > 0) {
138 $this->log->write(
"Send risky to fail mail is deactivated in study programme settings");
142 $lang = $this->getUserLanguage($ass->getUserId());
143 $subject =
"risky_to_fail_mail_subject";
144 $body_template =
"risky_to_fail_mail_body";
145 $sent = $this->sendMail($prg, $ass, $subject, $body_template);
154 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
155 $now = new \DateTimeImmutable();
156 $deadline = $ass->getProgressTree()->getDeadline();
157 if ($deadline && $deadline > $now) {
164 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
166 if (! $prg->
getSettings()->getAutoMailSettings()->getSendReAssignedMail()) {
167 $this->log->write(
"Send re assign mail is deactivated in study programme settings");
171 $lang = $this->getUserLanguage($ass->getUserId());
172 $subject =
"re_assigned_mail_subject";
173 $body_template =
"re_assigned_mail_body";
174 $sent = $this->sendMail($prg, $ass, $subject, $body_template);
Component logger with individual log levels by component id.
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
resetRiskyToFailSentFor(ilPRGAssignment $ass)
resetExpiryInfoSentFor(ilPRGAssignment $ass)
static getInstanceByObjId(int $obj_id)
storeRiskyToFailSentFor(ilPRGAssignment $ass)
storeExpiryInfoSentFor(ilPRGAssignment $ass)
static getRefIdFor(int $obj_id)
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
Send mails to users (usually triggered by cron)
getUserLanguage(int $usr_id)
resetRiskyToFailSentFor(int $assignment_id, int $root_prg_id)
sendRiskyToFailMail(int $assignment_id, int $root_prg_id)
txt(string $identifier, string $lang)
__construct(protected ilComponentLogger $log, ilLanguage $lng)
array $languages
var <string, ilLanguage> $languages
getAssignmentAndProgramme(int $assignment_id, int $root_prg_id)
resetExpiryInfoSentFor(int $assignment_id, int $root_prg_id)
sendInformToReAssignMail(int $assignment_id, int $root_prg_id)
sendMail(ilObjStudyProgramme $prg, ilPRGAssignment $assignment, string $subject, string $body_template)
sendReAssignedMail(int $assignment_id, int $root_prg_id)