ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Mail\Autoresponder\AutoresponderNotification Class Reference
+ Inheritance diagram for ILIAS\Mail\Autoresponder\AutoresponderNotification:
+ Collaboration diagram for ILIAS\Mail\Autoresponder\AutoresponderNotification:

Public Member Functions

 __construct (private readonly ilMailOptions $sender_mail_options, int $receiver_id, private readonly DateTimeImmutable $next_auto_responder_datetime)
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct (protected bool $is_in_wsp=false)
 
 setType (int $a_type)
 
 getType ()
 
 setSender (int $a_usr_id)
 
 getSender ()
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 
 setAttachments (array $a_att)
 
 getAttachments ()
 
 setLangModules (array $a_modules)
 
 getUserLanguage (int $a_usr_id)
 
 setRefId (int $a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId (int $a_obj_id)
 
 getObjType ()
 
 setAdditionalInformation (array $a_info)
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, bool $a_parse_recipients=true)
 
 getBlockBorder ()
 

Additional Inherited Members

- Data Fields inherited from ilMailNotification
final const int SUBJECT_TITLE_LENGTH = 60
 
- Protected Member Functions inherited from ilMailNotification
 setSubject (string $a_subject)
 
 getSubject ()
 
 setBody (string $a_body)
 
 appendBody (string $a_body)
 
 getBody ()
 
 initLanguage (int $a_usr_id)
 
 initLanguageByIso2Code (string $a_code='')
 
 setLanguage (ilLanguage $a_language)
 
 getLanguage ()
 
 getLanguageText (string $a_keyword)
 
 getObjectTitle (bool $a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink (array $a_params=[], string $a_append='')
 
 userToString (int $a_usr_id)
 
 isRefIdAccessible (int $a_user_id, int $a_ref_id, string $a_permission='read')
 
- Protected Attributes inherited from ilMailNotification
int $type
 
int $sender
 
ilMail $mail = null
 
string $subject = ''
 
string $body = ''
 
array $attachments = []
 
ilLanguage $language
 
array $lang_modules = []
 
array $recipients = []
 
int $ref_id
 
int $obj_id = 0
 
string $obj_type = ''
 
array $additional_info = []
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Detailed Description

Definition at line 29 of file AutoresponderNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Mail\Autoresponder\AutoresponderNotification::__construct ( private readonly ilMailOptions  $sender_mail_options,
int  $receiver_id,
private readonly DateTimeImmutable  $next_auto_responder_datetime 
)

Definition at line 31 of file AutoresponderNotification.php.

References ILIAS\GlobalScreen\Provider\__construct(), ilMailNotification\setRecipients(), and ilMailNotification\setSender().

35  {
37 
38  $this->setSender($sender_mail_options->getUsrId());
39  $this->setRecipients([$receiver_id]);
40  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ send()

ILIAS\Mail\Autoresponder\AutoresponderNotification::send ( )

Definition at line 42 of file AutoresponderNotification.php.

References ilMailNotification\appendBody(), ilDatePresentation\formatDate(), ilDatePresentation\getLanguage(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getRecipients(), IL_CAL_UNIX, ilMailNotification\initLanguage(), ilMailNotification\initMail(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilDatePresentation\setLanguage(), ilMailNotification\setSubject(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by ILIAS\Mail\Autoresponder\AutoresponderServiceImpl\handleAutoresponderMails().

42  : bool
43  {
44  $use_relative_dates = ilDatePresentation::useRelativeDates();
46 
47  foreach ($this->getRecipients() as $recipient) {
48  $this->initLanguage($recipient);
49  $this->initMail();
50 
51  $this->getMail()->setSaveInSentbox(false);
52  $former_language = ilDatePresentation::getLanguage();
54 
55  $this->setSubject($this->sender_mail_options->getAbsenceAutoresponderSubject());
56 
57  $this->setBody($this->sender_mail_options->getAbsenceAutoresponderBody());
58  $this->appendBody("\n");
59  $this->appendBody($this->sender_mail_options->getSignature());
60  $this->appendBody("\n\n");
61  $this->appendBody(
62  str_ireplace(
63  [
64  '[NEXT_AUTO_RESPONDER_DATETIME]'
65  ],
66  [
68  new ilDateTime($this->next_auto_responder_datetime->getTimestamp(), IL_CAL_UNIX)
69  )
70  ],
71  $this->getLanguageText('mail_absence_auto_responder_body_hint')
72  )
73  );
74 
75  $this->sendMail([$recipient]);
76 
77  ilDatePresentation::setLanguage($former_language);
78  }
79 
80  ilDatePresentation::setUseRelativeDates($use_relative_dates);
81 
82  return true;
83  }
static array static setUseRelativeDates(bool $a_status)
set use relative dates
sendMail(array $a_rcp, bool $a_parse_recipients=true)
const IL_CAL_UNIX
static setLanguage(ilLanguage $a_lng)
getLanguageText(string $a_keyword)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
setSubject(string $a_subject)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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