19 declare(strict_types=1);
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)) {
60 $lng = new \ilLanguage($lang);
61 $lng->loadLanguageModule(self::LANGMODULE);
62 $lng->loadLanguageModule(
"mail");
66 return $lng->txtlng(self::LANGMODULE, $identifier, $lang);
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, []);
99 $this->log->write($e->getMessage());
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);
118 $prg->storeExpiryInfoSentFor($ass);
125 $now = new \DateTimeImmutable();
126 $vq = $ass->getProgressTree()->getValidityOfQualification();
128 if ($vq && $vq > $now) {
129 $prg->resetExpiryInfoSentFor($ass);
137 if (! $prg->getSettings()->getAutoMailSettings()->getProcessingEndsNotSuccessfulDays() > 0) {
138 $this->log->write(
"Send risky to fail mail is deactivated in study programme settings");
143 $subject =
"risky_to_fail_mail_subject";
144 $body_template =
"risky_to_fail_mail_body";
145 $sent = $this->
sendMail($prg, $ass, $subject, $body_template);
148 $prg->storeRiskyToFailSentFor($ass);
155 $now = new \DateTimeImmutable();
156 $deadline = $ass->getProgressTree()->getDeadline();
157 if ($deadline && $deadline > $now) {
158 $prg->resetRiskyToFailSentFor($ass);
166 if (! $prg->getSettings()->getAutoMailSettings()->getSendReAssignedMail()) {
167 $this->log->write(
"Send re assign mail is deactivated in study programme settings");
172 $subject =
"re_assigned_mail_subject";
173 $body_template =
"re_assigned_mail_body";
174 $sent = $this->
sendMail($prg, $ass, $subject, $body_template);
sendReAssignedMail(int $assignment_id, int $root_prg_id)
__construct(protected ilComponentLogger $log, ilLanguage $lng)
resetRiskyToFailSentFor(int $assignment_id, int $root_prg_id)
getLangKey()
Return lang key.
Component logger with individual log levels by component id.
loadLanguageModule(string $a_module)
Load language module.
array $languages
var <string, ilLanguage> $languages
resetExpiryInfoSentFor(int $assignment_id, int $root_prg_id)
sendMail(ilObjStudyProgramme $prg, ilPRGAssignment $assignment, string $subject, string $body_template)
getUserLanguage(int $usr_id)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
txt(string $identifier, string $lang)
Send mails to users (usually triggered by cron)
getAssignmentAndProgramme(int $assignment_id, int $root_prg_id)
static getInstanceByObjId(int $obj_id)
static getRefIdFor(int $obj_id)
sendInformToReAssignMail(int $assignment_id, int $root_prg_id)
sendRiskyToFailMail(int $assignment_id, int $root_prg_id)
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...