47 public function __construct(
protected bool $is_in_wsp =
false)
55 $this->subject_lang_id = $a_lang_id;
60 $this->subject_direct = trim($a_text);
65 $this->introduction = $a_lang_id;
70 $this->introduction_direct = trim($a_text);
75 $this->task = $a_lang_id;
80 $this->reason = $a_lang_id;
85 $this->goto_caption = $a_lang_id;
90 $this->changed_by = $a_id;
99 bool $a_multiline =
false,
100 bool $a_lang_direct =
false
102 $this->additional[] = [
103 'caption' => $a_lang_id,
104 'content' => trim($a_value),
105 'is_direct_translation' => $a_lang_direct,
106 'is_multiline' => $a_multiline
120 ?
string $a_goto_additional =
null,
121 string $a_permission =
"read"
123 $this->all_ref_ids = null;
126 if ($this->getObjId()) {
127 if (!$this->getRefId()) {
129 if (!$this->is_in_wsp) {
131 if (count($ref_ids) === 1) {
132 $this->ref_id = array_shift($ref_ids);
134 $this->all_ref_ids = $ref_ids;
137 } elseif ($this->is_in_wsp) {
138 $this->ref_id = $this->wsp_tree->lookupNodeId($this->getObjId());
142 if (!$this->goto_caption) {
143 $this->goto_caption =
"url";
147 $recipient_ids = array();
148 foreach (array_unique($a_user_ids) as
$user_id) {
150 if ($this->changed_by ===
$user_id) {
153 if ($this->composeAndSendMail(
$user_id, $a_goto_additional, $a_permission)) {
158 return $recipient_ids;
164 public function compose(
166 ?
string $a_goto_additional =
null,
167 string $a_permission =
"read",
168 bool $a_append_signature_direct =
false
170 $find_ref_id = false;
171 $this->initLanguage($a_user_id);
173 if ($this->subject_direct) {
174 $this->setSubject($this->subject_direct);
177 sprintf($this->getLanguageText($this->subject_lang_id), $this->getObjectTitle(
true))
182 $this->appendBody(
"\n\n");
184 if ($this->introduction) {
185 $this->appendBody($this->getLanguageText($this->introduction));
186 $this->appendBody(
"\n\n");
189 if ($this->introduction_direct) {
190 $this->appendBody($this->introduction_direct);
191 $this->appendBody(
"\n\n");
195 $this->appendBody($this->getLanguageText($this->task));
196 $this->appendBody(
"\n\n");
200 if ($this->getObjId()) {
201 $this->appendBody($this->getLanguageText(
"obj_" . $this->getObjType()) .
": " .
202 $this->getObjectTitle() .
"\n");
205 if (!empty($this->additional)) {
206 $num_addtional_sections = 0;
207 $render_opening_block_border =
true;
210 foreach ($this->additional as $item) {
211 if ($num_addtional_sections > 0) {
212 $this->appendBody(
"\n");
215 $caption = $item[
'caption'];
216 if ($caption !==
'') {
217 $caption = $item[
'is_direct_translation']
219 : $this->getLanguageText($caption);
222 if ($item[
'is_multiline']) {
223 if ($caption !==
'') {
224 $this->appendBody($caption);
225 $this->appendBody(
"\n");
227 $render_opening_block_border =
true;
230 if ($render_opening_block_border) {
231 $this->appendBody($this->getBlockBorder());
234 $this->appendBody(
"\n");
235 $this->appendBody($item[
'content']);
236 $this->appendBody(
"\n");
237 $this->appendBody($this->getBlockBorder());
240 $render_opening_block_border =
false;
246 $this->appendBody($caption . $item[
'content']);
249 $render_opening_block_border =
true;
252 ++$num_addtional_sections;
255 $this->body = trim($this->body);
256 $this->appendBody(
"\n\n");
258 if ($this->changed_by) {
259 $this->appendBody($this->getLanguageText(
"system_notification_installation_changed_by") .
": " .
261 $this->appendBody(
"\n\n");
264 if ($this->getObjId()) {
266 if (!$this->getRefId() && $this->all_ref_ids) {
268 foreach ($this->all_ref_ids as
$ref_id) {
269 if ($this->isRefIdAccessible($a_user_id,
$ref_id, $a_permission)) {
277 if ($this->getRefId() &&
279 !$this->isRefIdAccessible($a_user_id, $this->getRefId(), $a_permission)) {
283 $goto = $this->createPermanentLink(array(), (
string) $a_goto_additional);
285 $this->appendBody($this->getLanguageText($this->goto_caption) .
": " .
287 $this->appendBody(
"\n\n");
296 $this->appendBody($this->getLanguageText($this->reason));
297 $this->appendBody(
"\n\n");
303 $this->body = trim($this->body);
305 if (!$a_append_signature_direct) {
306 $this->getMail()->appendInstallationSignature(
true);
319 ?
string $a_goto_additional =
null,
320 string $a_permission =
"read"
322 if ($this->compose($a_user_id, $a_goto_additional, $a_permission)) {
323 $this->sendMail(array($a_user_id), is_numeric($a_user_id));
334 ?
string $a_goto_additional =
null,
335 string $a_permission =
"read",
336 bool $a_append_signature_direct =
false
338 if ($this->compose($a_user_id, $a_goto_additional, $a_permission, $a_append_signature_direct)) {
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
static _getInstallationSignature()
static _getAutoGeneratedMessageString(?ilLanguage $lang=null)
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTaskLangId(string $a_lang_id)
setIntroductionLangId(string $a_lang_id)
setSubjectLangId(string $a_lang_id)
sendMailAndReturnRecipients(array $a_user_ids, ?string $a_goto_additional=null, string $a_permission="read")
Send notification(s)
setGotoLangId(string $a_lang_id)
setIntroductionDirect(string $a_text)
composeAndGetMessage(int $a_user_id, ?string $a_goto_additional=null, string $a_permission="read", bool $a_append_signature_direct=false)
Compose notification to single recipient.
composeAndSendMail(int $a_user_id, ?string $a_goto_additional=null, string $a_permission="read")
Send notification to single recipient.
setReasonLangId(string $a_lang_id)
addAdditionalInfo(string $a_lang_id, string $a_value, bool $a_multiline=false, bool $a_lang_direct=false)
Add additional information.
setChangedByUserId(int $a_id)
__construct(protected bool $is_in_wsp=false)
string $introduction_direct
setSubjectDirect(string $a_text)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))