19 declare(strict_types=1);
41 public function __construct(
protected bool $is_in_wsp =
false)
47 if ($this->is_in_wsp) {
53 public function setType(
int $a_type): void
55 $this->type = $a_type;
65 $this->sender = $a_usr_id;
79 return $this->subject = $a_subject;
87 protected function setBody(
string $a_body): void
89 $this->body = $a_body;
94 return $this->body .= $a_body;
104 $this->recipients = $a_rcp;
114 $this->attachments = $a_att;
124 $this->lang_modules = $a_modules;
137 foreach ($this->lang_modules as $lmod) {
147 $this->
language->loadLanguageModule(
'mail');
149 foreach ($this->lang_modules as $lmod) {
150 $this->
language->loadLanguageModule($lmod);
166 return str_replace(
'\n',
"\n", $this->
getLanguage()->txt($a_keyword));
171 if (!$this->is_in_wsp) {
172 $this->ref_id = $a_id;
175 $this->ref_id = $a_id;
176 $obj_id = $this->wsp_tree->lookupObjectId($this->
getRefId());
194 $this->obj_id = $a_obj_id;
205 $this->additional_info = $a_info;
225 public function sendMail(array $a_rcp,
bool $a_parse_recipients =
true): void
228 foreach ($a_rcp as $rcp) {
229 if ($a_parse_recipients) {
232 $recipients[] = $rcp;
235 $recipients = implode(
',', $recipients);
236 $errors = $this->
getMail()->enqueue(
244 if ($errors !== []) {
256 return is_object($this->mail) ? $this->mail : $this->
initMail();
262 if (!$this->is_in_wsp) {
263 return ilLink::_getLink($this->ref_id, $this->
getObjType(), $a_params, $a_append);
273 return ($name[
'title'] ? $name[
'title'] .
' ' :
'') .
274 ($name[
'firstname'] ? $name[
'firstname'] .
' ' :
'') .
275 ($name[
'lastname'] ? $name[
'lastname'] .
' ' :
'');
278 protected function isRefIdAccessible(
int $a_user_id,
int $a_ref_id,
string $a_permission =
'read'): bool
284 if (!$this->is_in_wsp) {
285 if (trim($a_permission) &&
286 !$DIC->access()->checkAccessOfUser(
296 trim($a_permission) &&
297 !$this->wsp_access_handler->checkAccessOfUser(
314 return "----------------------------------------\n";
final const int SUBJECT_TITLE_LENGTH
__construct(protected bool $is_in_wsp=false)
appendBody(string $a_body)
static getLogger(string $a_component_id)
Get component logger.
sendMail(array $a_rcp, bool $a_parse_recipients=true)
isRefIdAccessible(int $a_user_id, int $a_ref_id, string $a_permission='read')
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
static _lookupName(int $a_user_id)
lookup user name
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initLanguageByIso2Code(string $a_code='')
loadLanguageModule(string $a_module)
Load language module.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
userToString(int $a_usr_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getAdditionalInformation()
static strLen(string $a_string)
static _lookupTitle(int $obj_id)
ilWorkspaceAccessHandler $wsp_access_handler
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
setLangModules(array $a_modules)
getUserLanguage(int $a_usr_id)
initLanguage(int $a_usr_id)
ilWorkspaceTree $wsp_tree
static _getLanguage(string $a_lang_key='')
Get language object.
getLanguageText(string $a_keyword)
setRecipients(array $a_rcp)
getObjectTitle(bool $a_shorten=false)
createPermanentLink(array $a_params=[], string $a_append='')
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
setSubject(string $a_subject)
language()
description: > Example for rendring a language glyph.
static _lookupType(int $id, bool $reference=false)
setLanguage(ilLanguage $a_language)
setAdditionalInformation(array $a_info)
setAttachments(array $a_att)
static _lookupLogin(int $a_user_id)