ILIAS  release_8 Revision v8.23
ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService Class Reference
+ Collaboration diagram for ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService:

Public Member Functions

 __construct (EmployeeTalkEmailNotification $message, string $subject, \ilObjUser $to, \ilObjUser $cc, VCalender $calendar)
 
 send ()
 Send the notification. More...
 

Private Member Functions

 getIcalEvent (string $mime_boundary)
 
 getTalkGoto ()
 

Private Attributes

EmployeeTalkEmailNotification $message
 
string $subject
 
ilObjUser $to
 
ilObjUser $cc
 
VCalender $calendar
 

Detailed Description

Definition at line 23 of file EmployeeTalkEmailNotificationService.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::__construct ( EmployeeTalkEmailNotification  $message,
string  $subject,
\ilObjUser  $to,
\ilObjUser  $cc,
VCalender  $calendar 
)

Definition at line 31 of file EmployeeTalkEmailNotificationService.php.

References ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\$calendar, ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\$cc, ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\$message, ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\$subject, ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\$to, and ILIAS\UI\examples\Symbol\Glyph\Calendar\calendar().

+ Here is the call graph for this function:

Member Function Documentation

◆ getIcalEvent()

ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::getIcalEvent ( string  $mime_boundary)
private

Definition at line 123 of file EmployeeTalkEmailNotificationService.php.

References ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\$message, and ILIAS\UI\examples\Symbol\Glyph\Calendar\calendar().

123  : string
124  {
125  $message = "--$mime_boundary\r\n";
126  $message .= 'Content-Type: text/calendar;name="appointment.ics";method=' . $this->calendar->getMethod() . "\r\n";
127  $message .= "Content-Disposition: attachment;filename=\"appointment.ics\"\r\n";
128  $message .= "Content-Transfer-Encoding: UTF8\r\n\r\n";
129  $message .= $this->calendar->render() . "\r\n";
130  return $message;
131  }
+ Here is the call graph for this function:

◆ getTalkGoto()

ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::getTalkGoto ( )
private

Definition at line 133 of file EmployeeTalkEmailNotificationService.php.

References CLIENT_ID, and ilObjEmployeeTalk\TYPE.

Referenced by ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\send().

133  : string
134  {
135  return ILIAS_HTTP_PATH . '/goto.php?target=' . \ilObjEmployeeTalk::TYPE . '_' .
136  $this->message->getTalkRefId() . '&client_id=' . CLIENT_ID;
137  }
const CLIENT_ID
Definition: constants.php:41
+ Here is the caller graph for this function:

◆ send()

ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::send ( )

Send the notification.

Returns
bool

Definition at line 50 of file EmployeeTalkEmailNotificationService.php.

References ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ILIAS\UI\examples\Symbol\Glyph\Calendar\calendar(), and ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService\getTalkGoto().

50  : bool
51  {
52  $notif = new \ilSystemNotification();
53  $notif->setLangModules(['etal', 'orgu']);
54  $attachment = new \ilFileDataMail(ANONYMOUS_USER_ID);
55 
56  $subject = sprintf(
57  $notif->getUserLanguage($this->to->getId())->txt($this->message->getSubjectLangKey()),
58  $this->subject
59  );
60 
61  $notif->setRefId($this->message->getTalkRefId());
62  $notif->setObjId(0);
63  $notif->setIntroductionLangId($this->message->getMessageLangKey());
64 
65  $notif->addAdditionalInfo(
66  'obj_etal',
67  $this->message->getTalkName()
68  );
69 
70  if ($this->message->getTalkDescription()) {
71  $notif->addAdditionalInfo(
72  'description',
73  $this->message->getTalkDescription()
74  );
75  }
76 
77  if ($this->message->getTalkLocation()) {
78  $notif->addAdditionalInfo(
79  'location',
80  $this->message->getTalkLocation()
81  );
82  }
83 
84  $notif->addAdditionalInfo(
85  'superior',
86  $this->message->getNameOfSuperior()
87  );
88 
89  $notif->addAdditionalInfo(
90  'notification_talks_date_list_header',
91  "- " . implode("\r\n- ", $this->message->getDates()),
92  true
93  );
94 
95  if ($this->message->getAddGoto()) {
96  $notif->addAdditionalInfo(
97  'url',
98  $this->getTalkGoto()
99  );
100  }
101 
102  $attachment_name = 'appointments.ics';
103  $attachment->storeAsAttachment(
104  $attachment_name,
105  $this->calendar->render()
106  );
107 
108  $mail = new \ilMail(ANONYMOUS_USER_ID);
109  $mail->enqueue(
110  \ilObjUser::_lookupLogin($this->to->getId()),
111  \ilObjUser::_lookupLogin($this->cc->getId()),
112  "",
113  $subject,
114  $notif->composeAndGetMessage($this->to->getId(), null, '', true),
115  [$attachment_name]
116  );
117 
118  $attachment->unlinkFile('appointments.ics');
119 
120  return true;
121  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:

Field Documentation

◆ $calendar

VCalender ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::$calendar
private

◆ $cc

ilObjUser ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::$cc
private

◆ $message

◆ $subject

string ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::$subject
private

◆ $to

ilObjUser ILIAS\EmployeeTalk\Service\EmployeeTalkEmailNotificationService::$to
private

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