ILIAS  release_8 Revision v8.24
ilPRGMail Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilPRGMail:

Public Member Functions

 __construct (ilComponentLogger $log, ilLanguage $lng)
 
 sendInformToReAssignMail (int $assignment_id, int $root_prg_id)
 
 resetExpiryInfoSentFor (int $assignment_id, int $root_prg_id)
 
 sendRiskyToFailMail (int $assignment_id, int $root_prg_id)
 
 resetRiskyToFailSentFor (int $assignment_id, int $root_prg_id)
 
 sendReAssignedMail (int $assignment_id, int $root_prg_id)
 

Protected Member Functions

 getAssignmentAndProgramme (int $assignment_id, int $root_prg_id)
 
 sendMail (ilObjStudyProgramme $prg, ilPRGAssignment $assignment, string $subject, string $body_template)
 

Protected Attributes

ilComponentLogger $log
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Send mails to users (usually triggered by cron)

Definition at line 24 of file class.ilPRGMail.php.

Constructor & Destructor Documentation

◆ __construct()

ilPRGMail::__construct ( ilComponentLogger  $log,
ilLanguage  $lng 
)

Definition at line 29 of file class.ilPRGMail.php.

32 {
33 $this->log = $log;
34 $this->lng = $lng;
35 $this->lng->loadLanguageModule("prg");
36 $this->lng->loadLanguageModule("mail");
37 }
ilLanguage $lng
ilComponentLogger $log

References $lng, $log, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignmentAndProgramme()

ilPRGMail::getAssignmentAndProgramme ( int  $assignment_id,
int  $root_prg_id 
)
protected
Returns
array [ilPRGAssignment, ilObjStudyProgramme]

Definition at line 42 of file class.ilPRGMail.php.

42 : array
43 {
44 $prg = ilObjStudyProgramme::getInstanceByObjId($root_prg_id);
45 $ass = $prg->getSpecificAssignment($assignment_id);
46 return [$ass, $prg];
47 }
static getInstanceByObjId(int $obj_id)

References ilObjStudyProgramme\getInstanceByObjId().

+ Here is the call graph for this function:

◆ resetExpiryInfoSentFor()

ilPRGMail::resetExpiryInfoSentFor ( int  $assignment_id,
int  $root_prg_id 
)

Definition at line 95 of file class.ilPRGMail.php.

95 : void
96 {
97 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
98 $now = new \DateTimeImmutable();
99 $vq = $ass->getProgressTree()->getValidityOfQualification();
100
101 if ($vq && $vq > $now) {
102 $prg->resetExpiryInfoSentFor($ass);
103 }
104 }
getAssignmentAndProgramme(int $assignment_id, int $root_prg_id)

References ilObjStudyProgramme\resetExpiryInfoSentFor().

+ Here is the call graph for this function:

◆ resetRiskyToFailSentFor()

ilPRGMail::resetRiskyToFailSentFor ( int  $assignment_id,
int  $root_prg_id 
)

Definition at line 124 of file class.ilPRGMail.php.

124 : void
125 {
126 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
127 $now = new \DateTimeImmutable();
128 $deadline = $ass->getProgressTree()->getDeadline();
129 if ($deadline && $deadline > $now) {
130 $prg->resetRiskyToFailSentFor($ass);
131 }
132 }

References ilObjStudyProgramme\resetRiskyToFailSentFor().

+ Here is the call graph for this function:

◆ sendInformToReAssignMail()

ilPRGMail::sendInformToReAssignMail ( int  $assignment_id,
int  $root_prg_id 
)

Definition at line 77 of file class.ilPRGMail.php.

77 : void
78 {
79 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
80
81 if (! $prg->getSettings()->getAutoMailSettings()->getReminderNotRestartedByUserDays() > 0) {
82 $this->log->write("Send info to re-assign mail is deactivated in study programme settings");
83 return;
84 }
85
86 $subject = $this->lng->txt("info_to_re_assign_mail_subject");
87 $body_template = $this->lng->txt("info_to_re_assign_mail_body");
88 $sent = $this->sendMail($prg, $ass, $subject, $body_template);
89
90 if ($sent) {
91 $prg->storeExpiryInfoSentFor($ass);
92 }
93 }
sendMail(ilObjStudyProgramme $prg, ilPRGAssignment $assignment, string $subject, string $body_template)

References ilObjStudyProgramme\getSettings(), ILIAS\Repository\lng(), and ilObjStudyProgramme\storeExpiryInfoSentFor().

+ Here is the call graph for this function:

◆ sendMail()

ilPRGMail::sendMail ( ilObjStudyProgramme  $prg,
ilPRGAssignment  $assignment,
string  $subject,
string  $body_template 
)
protected

Definition at line 49 of file class.ilPRGMail.php.

54 : bool {
55 $user_info = $assignment->getUserInformation();
56 $gender = $user_info->getGender() ?: 'anonymous';
57 $name = $user_info->getFullname();
58 $login = $user_info->getLogin();
59
60 $body = sprintf(
61 $body_template,
62 $this->lng->txt("mail_salutation_" . $gender),
63 $name,
64 $prg->getTitle()
65 );
66
67 $mail = new ilMail(ANONYMOUS_USER_ID);
68 try {
69 $mail->enqueue($login, '', '', $subject, $body, []);
70 return true;
71 } catch (Exception $e) {
72 $this->log->write($e->getMessage());
73 return false;
74 }
75 }
const ANONYMOUS_USER_ID
Definition: constants.php:27
if($format !==null) $name
Definition: metadata.php:247

◆ sendReAssignedMail()

ilPRGMail::sendReAssignedMail ( int  $assignment_id,
int  $root_prg_id 
)

Definition at line 134 of file class.ilPRGMail.php.

134 : bool
135 {
136 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
137
138 if (! $prg->getSettings()->getAutoMailSettings()->getSendReAssignedMail()) {
139 $this->log->write("Send re assign mail is deactivated in study programme settings");
140 return false;
141 }
142
143 $subject = $this->lng->txt("re_assigned_mail_subject");
144 $body_template = $this->lng->txt("re_assigned_mail_body");
145 $sent = $this->sendMail($prg, $ass, $subject, $body_template);
146
147 return $sent;
148 }

References ilObjStudyProgramme\getSettings(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ sendRiskyToFailMail()

ilPRGMail::sendRiskyToFailMail ( int  $assignment_id,
int  $root_prg_id 
)

Definition at line 106 of file class.ilPRGMail.php.

106 : void
107 {
108 list($ass, $prg) = $this->getAssignmentAndProgramme($assignment_id, $root_prg_id);
109
110 if (! $prg->getSettings()->getAutoMailSettings()->getProcessingEndsNotSuccessfulDays() > 0) {
111 $this->log->write("Send risky to fail mail is deactivated in study programme settings");
112 return;
113 }
114
115 $subject = $this->lng->txt("risky_to_fail_mail_subject");
116 $body_template = $this->lng->txt("risky_to_fail_mail_body");
117 $sent = $this->sendMail($prg, $ass, $subject, $body_template);
118
119 if ($sent) {
120 $prg->storeRiskyToFailSentFor($ass);
121 }
122 }

References ilObjStudyProgramme\getSettings(), ILIAS\Repository\lng(), and ilObjStudyProgramme\storeRiskyToFailSentFor().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilPRGMail::$lng
protected

Definition at line 27 of file class.ilPRGMail.php.

Referenced by __construct().

◆ $log

ilComponentLogger ilPRGMail::$log
protected

Definition at line 26 of file class.ilPRGMail.php.

Referenced by __construct().


The documentation for this class was generated from the following file: