ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilMailFolderGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
32 
37 {
38  // used as single element namespace for UrlBuilder
39  // added with '_' before parameter names in queries from the table
40  private const string URL_BUILDER_PREFIX = 'ilMailFolderGUI';
41 
42  // controller parameters
43  private const string PARAM_ACTION = 'action';
44  private const string PARAM_FOLDER_ID = 'mobj_id';
45  private const string PARAM_MAIL_ID = 'mail_id';
46  private const string PARAM_USER_ID = 'user_id';
47  private const string PARAM_TARGET_FOLDER = 'target_folder';
48  private const string PARAM_INTERRUPTIVE_ITEMS = 'interruptive_items';
49 
50  // controller commands
51  private const string CMD_ADD_SUB_FOLDER = 'addSubFolder';
52  private const string CMD_DELETE_MAILS = 'deleteMails';
53  private const string CMD_DELETE_SUB_FOLDER = 'deleteSubFolder';
54  private const string CMD_DELIVER_FILE = 'deliverFile';
55  private const string CMD_EMPTY_TRASH = 'emptyTrash';
56  private const string CMD_MOVE_SINGLE_MAIL = 'moveSingleMail';
57  private const string CMD_PRINT_MAIL = 'printMail';
58  private const string CMD_RENAME_SUB_FOLDER = 'renameSubFolder';
59  private const string CMD_SHOW_MAIL = 'showMail';
60  private const string CMD_SHOW_FOLDER = 'showFolder';
61  private const string CMD_SHOW_USER = 'showUser';
62  private const string CMD_TABLE_ACTION = 'executeTableAction';
63 
64  private readonly ilGlobalTemplateInterface $tpl;
65  private readonly ilCtrlInterface $ctrl;
66  private readonly ilLanguage $lng;
67  private readonly ilToolbarGUI $toolbar;
68  private readonly ilTabsGUI $tabs;
69  private readonly ilObjUser $user;
70  private readonly GlobalHttpState $http;
71  private readonly Refinery $refinery;
72  private readonly ilErrorHandling $error;
73  private readonly Factory $ui_factory;
74  private readonly Renderer $ui_renderer;
75  private readonly ilUIService $ui_service;
76  private readonly DataFactory $data_factory;
77  private ilMail $umail;
78  private ilMailbox $mbox;
80 
81  public function __construct()
82  {
83  global $DIC;
84 
85  $this->tpl = $DIC->ui()->mainTemplate();
86  $this->ctrl = $DIC->ctrl();
87  $this->lng = $DIC->language();
88  $this->toolbar = $DIC->toolbar();
89  $this->user = $DIC->user();
90  $this->tabs = $DIC->tabs();
91  $this->http = $DIC->http();
92  $this->refinery = $DIC->refinery();
93  $this->error = $DIC['ilErr'];
94  $this->ui_factory = $DIC->ui()->factory();
95  $this->ui_renderer = $DIC->ui()->renderer();
96  $this->ui_service = $DIC->uiService();
97  $this->data_factory = new ILIAS\Data\Factory();
98  }
99 
103  protected function initRequest(): void
104  {
105  $this->umail = new ilMail($this->user->getId());
106  $this->mbox = new ilMailbox($this->user->getId());
107 
108  if ($this->http->wrapper()->post()->has(self::PARAM_FOLDER_ID)) {
109  $folder_id = $this->http->wrapper()->post()->retrieve(
110  self::PARAM_FOLDER_ID,
111  $this->refinery->kindlyTo()->int()
112  );
113  } elseif ($this->http->wrapper()->query()->has(self::PARAM_FOLDER_ID)) {
114  $folder_id = $this->http->wrapper()->query()->retrieve(
115  self::PARAM_FOLDER_ID,
116  $this->refinery->kindlyTo()->int()
117  );
118  } else {
119  $folder_id = $this->refinery->byTrying([
120  $this->refinery->kindlyTo()->int(),
121  $this->refinery->always(0),
122  ])->transform(ilSession::get(self::PARAM_FOLDER_ID));
123  }
124 
125  if ($folder_id === 0 || !$this->mbox->isOwnedFolder($folder_id)) {
126  $folder_id = $this->mbox->getInboxFolder();
127  }
128 
129  $folder = $this->mbox->getFolderData($folder_id);
130  if ($folder === null) {
131  $this->tpl->setOnScreenMessage(
133  $this->lng->txt('mail_operation_on_invalid_folder')
134  );
135  $this->tpl->printToStdout();
136  }
137  $this->folder = $folder;
138  }
139 
140  public function executeCommand(): void
141  {
142  $this->initRequest();
143 
144  $next_class = $this->ctrl->getNextClass($this) ?? '';
145  switch (strtolower($next_class)) {
146  case strtolower(ilContactGUI::class):
147  $this->ctrl->forwardCommand(new ilContactGUI());
148  break;
149 
150  default:
151  $cmd = $this->ctrl->getCmd() ?? '';
152  match ($cmd) {
153  self::CMD_ADD_SUB_FOLDER, self::CMD_DELETE_MAILS, self::CMD_DELETE_SUB_FOLDER, self::CMD_DELIVER_FILE, self::CMD_EMPTY_TRASH, self::CMD_MOVE_SINGLE_MAIL, self::CMD_PRINT_MAIL, self::CMD_RENAME_SUB_FOLDER, self::CMD_SHOW_MAIL, self::CMD_SHOW_FOLDER, self::CMD_SHOW_USER, self::CMD_TABLE_ACTION => $this->{$cmd}(
154  ),
155  default => $this->showFolder(),
156  };
157  }
158  }
159 
160  protected function executeTableAction(): void
161  {
162  $action = $this->http->wrapper()->query()->retrieve(
163  self::URL_BUILDER_PREFIX . URLBuilder::SEPARATOR . self::PARAM_ACTION,
164  $this->refinery->byTrying([
165  $this->refinery->kindlyTo()->string(),
166  $this->refinery->always('')
167  ])
168  );
169 
170  // Magic value of data table in ui framework, no public constant found
171  $for_all_entries = implode(
172  '',
173  $this->http->wrapper()->query()->retrieve(
174  self::URL_BUILDER_PREFIX . URLBuilder::SEPARATOR . self::PARAM_MAIL_ID,
175  $this->refinery->byTrying([
176  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
177  $this->refinery->always([])
178  ])
179  )
180  ) === 'ALL_OBJECTS';
181 
182  if ($for_all_entries) {
183  // we must apply the filter because the shown table is filtered, too
184  $mail_ids = $this->getFilteredSearch()->getMaiIds();
185  } else {
186  $mail_ids = $this->getMailIdsFromRequest();
187  }
188 
189  if (empty($mail_ids)) {
190  // no redirect possible from async call
191  if ($action === MailFolderTableUI::ACTION_DELETE) {
192  $modal = $this->ui_factory->modal()->lightbox(
193  $this->ui_factory->modal()->lightboxTextPage(
194  $this->ui_renderer->render(
195  $this->ui_factory->messageBox()->failure($this->lng->txt('mail_select_one'))
196  ),
197  $this->lng->txt('delete'),
198  )
199  );
200  $this->http->saveResponse(
201  $this->http->response()->withBody(
202  Streams::ofString($this->ui_renderer->renderAsync($modal))
203  )
204  );
205  $this->http->sendResponse();
206  $this->http->close();
207  } else {
208  $this->tpl->setOnScreenMessage(
210  $this->lng->txt('mail_select_one'),
211  true
212  );
213  $this->redirectToFolder();
214  }
215  }
216 
217  switch ($action) {
218  case MailFolderTableUI::ACTION_SHOW:
219  $this->showMail();
220  return;
221 
222  case MailFolderTableUI::ACTION_EDIT:
223  $this->ctrl->setParameterByClass(
224  ilMailFormGUI::class,
225  self::PARAM_FOLDER_ID,
226  (string) $this->folder->getFolderId()
227  );
228  $this->ctrl->setParameterByClass(ilMailFormGUI::class, self::PARAM_MAIL_ID, (string) $mail_ids[0]);
229  $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_DRAFT);
230  $this->ctrl->redirectByClass(ilMailFormGUI::class);
231 
232  // no break
233  case MailFolderTableUI::ACTION_REPLY:
234  $this->ctrl->setParameterByClass(
235  ilMailFormGUI::class,
236  self::PARAM_FOLDER_ID,
237  (string) $this->folder->getFolderId()
238  );
239  $this->ctrl->setParameterByClass(ilMailFormGUI::class, self::PARAM_MAIL_ID, (string) $mail_ids[0]);
240  $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_REPLY);
241  $this->ctrl->redirectByClass(ilMailFormGUI::class);
242 
243  // no break
244  case MailFolderTableUI::ACTION_FORWARD:
245  $this->ctrl->setParameterByClass(
246  ilMailFormGUI::class,
247  self::PARAM_FOLDER_ID,
248  (string) $this->folder->getFolderId()
249  );
250  $this->ctrl->setParameterByClass(ilMailFormGUI::class, self::PARAM_MAIL_ID, (string) $mail_ids[0]);
251  $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_FORWARD);
252  $this->ctrl->redirectByClass(ilMailFormGUI::class);
253 
254  // no break
255  case MailFolderTableUI::ACTION_DOWNLOAD_ATTACHMENT:
256  $this->deliverAttachments();
257  return;
258 
259  case MailFolderTableUI::ACTION_PRINT:
260  $this->printMail();
261  return;
262 
263  case MailFolderTableUI::ACTION_PROFILE:
264  $mail_data = $this->umail->getMail($mail_ids[0] ?? 0);
265  if (!empty($user = ilMailUserCache::getUserObjectById($mail_data['sender_id'] ?? 0)) &&
266  $user->hasPublicProfile()) {
267  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, (string) $this->folder->getFolderId());
268  $this->ctrl->setParameter($this, self::PARAM_USER_ID, (string) $user->getId());
269  $this->ctrl->redirect($this, self::CMD_SHOW_USER);
270  } else {
271  $this->tpl->setOnScreenMessage(
273  $this->lng->txt('permission_denied'),
274  true
275  );
276  }
277  break;
278 
279  case MailFolderTableUI::ACTION_MARK_READ:
280  $this->umail->markRead($mail_ids);
281  $this->tpl->setOnScreenMessage(
283  $this->lng->txt('saved_successfully'),
284  true
285  );
286  break;
287 
288  case MailFolderTableUI::ACTION_MARK_UNREAD:
289  $this->umail->markUnread($mail_ids);
290  $this->tpl->setOnScreenMessage(
292  $this->lng->txt('saved_successfully'),
293  true
294  );
295  break;
296 
297  case MailFolderTableUI::ACTION_MOVE_TO:
298  $folder_id = $this->http->wrapper()->query()->retrieve(
299  self::URL_BUILDER_PREFIX . URLBuilder::SEPARATOR . self::PARAM_TARGET_FOLDER,
300  $this->refinery->kindlyTo()->int()
301  );
302  if (empty($folder_id)) {
303  $this->tpl->setOnScreenMessage(
305  $this->lng->txt('mail_move_error')
306  );
307  } elseif ($this->umail->moveMailsToFolder($mail_ids, $folder_id)) {
308  $this->tpl->setOnScreenMessage(
310  $this->lng->txt('mail_moved'),
311  true
312  );
313  } else {
314  $this->tpl->setOnScreenMessage(
316  $this->lng->txt('mail_move_error')
317  );
318  }
319  break;
320 
321  case MailFolderTableUI::ACTION_DELETE: // async call
322  $this->confirmDeleteMails($mail_ids);
323  break;
324 
325  default:
326  $this->tpl->setOnScreenMessage(
328  $this->lng->txt('permission_denied')
329  );
330  break;
331  }
332 
333  $this->redirectToFolder();
334  }
335 
336  protected function emptyTrash(): void
337  {
338  $this->umail->deleteMailsOfFolder($this->mbox->getTrashFolder());
339  $this->tpl->setOnScreenMessage(
341  $this->lng->txt('mail_deleted'),
342  true
343  );
344  $this->redirectToFolder();
345  }
346 
350  protected function showUser(): void
351  {
352  $usr_id = $this->http->wrapper()->query()->retrieve(
353  self::PARAM_USER_ID,
354  $this->refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->refinery->always(0)])
355  );
356 
357  $this->tpl->setVariable('TBL_TITLE', implode(' ', [
358  $this->lng->txt('profile_of'),
359  ilObjUser::_lookupLogin($usr_id),
360  ]));
361  $this->tpl->setVariable('TBL_TITLE_IMG', ilUtil::getImagePath('standard/icon_usr.svg'));
362  $this->tpl->setVariable('TBL_TITLE_IMG_ALT', $this->lng->txt('public_profile'));
363 
364  $profile_gui = new ilPublicUserProfileGUI($usr_id);
365 
366  $mail_id = $this->http->wrapper()->query()->retrieve(
367  self::PARAM_MAIL_ID,
368  $this->refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->refinery->always(0)])
369  );
370 
371  if ($mail_id > 0) {
372  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $mail_id);
373  $this->tabs->clearTargets();
374  $this->tabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, self::CMD_SHOW_MAIL));
375  } else {
376  $this->tabs->clearTargets();
377  $this->tabs->setBackTarget(
378  $this->lng->txt('back_to_folder'),
379  $this->ctrl->getLinkTarget($this, self::CMD_SHOW_FOLDER)
380  );
381  }
382 
383  $this->ctrl->clearParameters($this);
384 
385  $this->tpl->setTitle($this->lng->txt('mail'));
386  $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
387  $this->tpl->printToStdout();
388  }
389 
390  protected function showFolder(): void
391  {
392  $components = [];
393  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $this->folder->getFolderId());
394 
395  if ($this->folder->isUserLocalFolder()) {
396  $this->toolbar->addComponent(
397  $this->ui_factory->button()->standard(
398  $this->lng->txt('mail_add_subfolder'),
399  $this->ctrl->getLinkTarget($this, self::CMD_ADD_SUB_FOLDER)
400  )
401  );
402  }
403 
404  if ($this->folder->isUserFolder()) {
405  $this->toolbar->addComponent(
406  $this->ui_factory->button()->standard(
407  $this->lng->txt('rename'),
408  $this->ctrl->getLinkTarget($this, self::CMD_RENAME_SUB_FOLDER)
409  )
410  );
411 
412  $components[] = $modal = $this->ui_factory->modal()->interruptive(
413  $this->lng->txt('delete'),
414  $this->lng->txt('mail_sure_delete_folder'),
415  $this->ctrl->getLinkTarget($this, self::CMD_DELETE_SUB_FOLDER)
416  );
417  $this->toolbar->addComponent(
418  $this->ui_factory->button()->standard(
419  $this->lng->txt('delete'),
420  '#'
421  )
422  ->withOnClick($modal->getShowSignal())
423  );
424  }
425 
426  if ($this->folder->isTrash()) {
427  $components[] = $modal = $this->ui_factory->modal()->interruptive(
428  $this->lng->txt('mail_empty_trash'),
429  $this->lng->txt('mail_empty_trash_confirmation'),
430  $this->ctrl->getLinkTarget($this, self::CMD_EMPTY_TRASH)
431  );
432  $this->toolbar->addComponent(
433  $this->ui_factory->button()->standard(
434  $this->lng->txt('mail_empty_trash'),
435  '#'
436  )->withOnClick($modal->getShowSignal())
437  );
438  }
439 
440  [
441  $url_builder,
442  $action_token,
443  $row_id_token,
444  $target_token,
445  ] = (new URLBuilder(
446  $this->data_factory->uri(
447  ilUtil::_getHttpPath() . '/' .
448  $this->ctrl->getLinkTarget($this, self::CMD_TABLE_ACTION)
449  )
450  )
451  )->acquireParameters(
452  [self::URL_BUILDER_PREFIX],
453  self::PARAM_ACTION,
454  self::PARAM_MAIL_ID,
455  self::PARAM_TARGET_FOLDER
456  );
457 
458  $table = new MailFolderTableUI(
459  $url_builder,
460  $action_token,
461  $row_id_token,
462  $target_token,
463  $this->mbox->getSubFolders(),
465  $this->getFilteredSearch(),
466  $this->umail,
469  $this->lng,
470  $this->http->request(),
473  $this->user->getDateFormat(),
474  $this->user->getTimeFormat(),
475  new DateTimeZone($this->user->getTimeZone())
476  );
477 
478  $components[] = $this->getFilterUI()->getComponent();
479  $components[] = $table->getComponent();
480 
481  $this->tpl->setTitle($this->folder->getTitle());
482  $this->tpl->setContent($this->ui_renderer->render($components));
483  $this->tpl->printToStdout();
484  }
485 
486  protected function redirectToFolder(): never
487  {
488  $this->ctrl->clearParameters($this);
489  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $this->folder->getFolderId());
490  $this->ctrl->redirect($this, self::CMD_SHOW_FOLDER);
491  }
492 
493  protected function deleteSubFolder(): void
494  {
495  $parent_folder_id = $this->mbox->getParentFolderId($this->folder->getFolderId());
496  if ($parent_folder_id > 0 && $this->mbox->deleteFolder($this->folder->getFolderId())) {
497  $this->tpl->setOnScreenMessage(
499  $this->lng->txt('mail_folder_deleted'),
500  true
501  );
502  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $parent_folder_id);
503  $this->ctrl->redirect($this, self::CMD_SHOW_FOLDER);
504  } else {
505  $this->tpl->setOnScreenMessage(
507  $this->lng->txt('mail_error_delete'),
508  true
509  );
510  $this->redirectToFolder();
511  }
512  }
513 
514  protected function addSubFolder(): void
515  {
516  $form = $this->ui_factory->input()->container()->form()->standard(
517  $this->ctrl->getFormAction($this, self::CMD_ADD_SUB_FOLDER),
518  [
519  'folder' => $this->ui_factory->input()->field()->section([
520  'title' => $this->ui_factory->input()->field()->text($this->lng->txt('title'))->withRequired(true)
521  ], $this->lng->txt('mail_add_folder'))
522  ]
523  );
524 
525  $request = $this->http->request();
526  if ($request->getMethod() === 'POST') {
527  $form = $form->withRequest($request);
528  $data = $form->getData();
529  if (!empty($data['folder']['title'])) {
530  $new_folder_id = $this->mbox->addFolder(
531  $this->folder->getFolderId(),
532  (string) $data['folder']['title']
533  );
534  if ($new_folder_id > 0) {
535  $this->tpl->setOnScreenMessage(
537  $this->lng->txt('mail_folder_created'),
538  true
539  );
540  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $new_folder_id);
541  $this->ctrl->redirect($this, self::CMD_SHOW_FOLDER);
542  } else {
543  $this->tpl->setOnScreenMessage(
545  $this->lng->txt('mail_folder_exists')
546  );
547  }
548  }
549  }
550  $this->tpl->setContent($this->ui_renderer->render($form));
551  $this->tpl->printToStdout();
552  }
553 
554  protected function renameSubFolder(): void
555  {
556  $form = $this->ui_factory->input()->container()->form()->standard(
557  $this->ctrl->getFormAction($this, self::CMD_RENAME_SUB_FOLDER),
558  [
559  'folder' => $this->ui_factory->input()->field()->section([
560  'title' => $this->ui_factory->input()->field()->text($this->lng->txt('title'))->withRequired(true)
561  ], $this->lng->txt('mail_rename_folder'))
562  ]
563  );
564 
565  $request = $this->http->request();
566  if ($request->getMethod() === 'POST') {
567  $form = $form->withRequest($request);
568  $data = $form->getData();
569  if (!empty($data['folder']['title'])) {
570  if ($this->mbox->renameFolder($this->folder->getFolderId(), (string) $data['folder']['title'])) {
571  $this->tpl->setOnScreenMessage(
573  $this->lng->txt('mail_folder_name_changed'),
574  true
575  );
576  $this->redirectToFolder();
577  } else {
578  $this->tpl->setOnScreenMessage(
580  $this->lng->txt('mail_folder_exists')
581  );
582  }
583  }
584  }
585  $this->tpl->setContent($this->ui_renderer->render($form));
586  $this->tpl->printToStdout();
587  }
588 
589  protected function getFilterUI(): MailFilterUI
590  {
591  return new MailFilterUI(
592  $this->ctrl->getFormAction($this, self::CMD_SHOW_FOLDER),
593  ilSearchSettings::getInstance()->enabledLucene(),
596  $this->ui_service->filter(),
597  $this->lng,
598  new DateTimeZone($this->user->getTimeZone()),
599  );
600  }
601 
606  protected function getFilteredSearch(): MailFolderSearch
607  {
608  return new MailFolderSearch(
609  $this->folder,
610  $this->getFilterUI()->getData(),
611  ilSearchSettings::getInstance()->enabledLucene(),
612  );
613  }
614 
618  protected function getMailIdsFromRequest(): array
619  {
620  // table actions have a prefix, controller commands and modal items have none
621  foreach (
622  [
623  self::URL_BUILDER_PREFIX . URLBuilder::SEPARATOR . self::PARAM_MAIL_ID,
624  self::PARAM_MAIL_ID,
625  self::PARAM_INTERRUPTIVE_ITEMS
626  ] as $param
627  ) {
628  foreach (
629  [
630  $this->http->wrapper()->post(),
631  $this->http->wrapper()->query()
632  ] as $wrapper
633  ) {
634  if ($wrapper->has($param)) {
635  return $wrapper->retrieve(
636  $param,
637  $this->refinery->byTrying([
638  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
639  $this->refinery->always([])
640  ])
641  );
642  }
643  }
644  }
645 
646  return [];
647  }
648 
653  protected function moveSingleMail(): void
654  {
655  $mail_ids = $this->getMailIdsFromRequest();
656  if (count($mail_ids) !== 1) {
657  $this->showMail();
658  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one'));
659  return;
660  }
661 
662  $new_folder_id = $this->http->wrapper()->query()->retrieve(
663  'folder_id',
664  $this->refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->refinery->always(0)])
665  );
666  $redirect_folder_id = $new_folder_id;
667 
668  foreach ($mail_ids as $mail_id) {
669  $mail_data = $this->umail->getMail($mail_id);
670  if (isset($mail_data['folder_id']) &&
671  is_numeric($mail_data['folder_id']) &&
672  (int) $mail_data['folder_id'] > 0) {
673  $redirect_folder_id = (int) $mail_data['folder_id'];
674  break;
675  }
676  }
677 
678  if ($this->umail->moveMailsToFolder($mail_ids, $new_folder_id)) {
679  $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_moved'), true);
680  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $redirect_folder_id);
681  $this->ctrl->redirect($this, self::CMD_SHOW_FOLDER);
682  } else {
683  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_move_error'));
684  $this->showMail();
685  }
686  }
687 
688  protected function deleteMails(): void
689  {
690  if (!$this->folder->isTrash()) {
691  $this->tpl->setOnScreenMessage(
693  $this->lng->txt('mail_operation_on_invalid_folder'),
694  true
695  );
696  $this->redirectToFolder();
697  }
698 
699  $this->umail->deleteMails($this->getMailIdsFromRequest());
700  $this->tpl->setOnScreenMessage(
702  $this->lng->txt('mail_deleted'),
703  true
704  );
705  $this->redirectToFolder();
706  }
707 
712  protected function confirmDeleteMails(array $mail_ids): void
713  {
714  $user_timezone = new DateTimeZone($this->user->getTimeZone());
715  $records = $this->getFilteredSearch()->forMailIds($mail_ids)->getPagedRecords(10, 0, null, null);
716  $items = [];
717  foreach ($records as $record) {
718  $prefix = '';
719  if (!empty($record->getSendTime())) {
720  $time = $record->getSendTime()->setTimezone($user_timezone);
721  $prefix = $time->format($this->user->getDateFormat()->toString()) . ' ';
722  }
723  $items[] = $this->ui_factory->modal()->interruptiveItem()->standard(
724  (string) $record->getMailId(),
725  $prefix . $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($record->getSubject())
726  );
727  }
728 
729  $modal = $this->ui_factory->modal()->interruptive(
730  $this->lng->txt('delete'),
731  $this->lng->txt('mail_sure_delete_' . (count($items) === 1 ? 's' : 'p')),
732  $this->ctrl->getFormAction($this, self::CMD_DELETE_MAILS)
733  )->withAffectedItems($items);
734 
735  $this->http->saveResponse(
736  $this->http->response()->withBody(
737  Streams::ofString($this->ui_renderer->renderAsync($modal))
738  )
739  );
740  $this->http->sendResponse();
741  $this->http->close();
742  }
743 
744  protected function showMail(): void
745  {
746  $ui_components = [];
747 
748  $mail_id = $this->getMailIdsFromRequest()[0] ?? 0;
749  if ($mail_id <= 0) {
750  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
751  }
752 
753  $mail_data = $this->umail->getMail($mail_id);
754  if ($mail_data === null) {
755  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
756  }
757 
758  $this->umail->markRead([$mail_id]);
759 
760  $this->tpl->setTitle($this->lng->txt('mail_mails_of'));
761 
762  $this->tabs->clearTargets();
763  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
764  $this->tabs->setBackTarget(
765  $this->lng->txt('back_to_folder'),
766  $this->ctrl->getFormAction($this, self::CMD_SHOW_FOLDER)
767  );
768  $this->ctrl->clearParameters($this);
769 
770  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $mail_id);
771  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
772  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW_MAIL));
773  $this->ctrl->clearParameters($this);
774 
775  $form = new ilPropertyFormGUI();
776  $form->setId('MailContent');
777  $form->setPreventDoubleSubmission(false);
778  $form->setTableWidth('100%');
779  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
780  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $mail_id);
781  $form->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW_MAIL));
782  $this->ctrl->clearParameters($this);
783  $form->setTitle($this->lng->txt('mail_mails_of'));
784 
786  $sender = ilObjectFactory::getInstanceByObjId($mail_data['sender_id'], false);
787  $reply_btn = null;
788  if ($sender instanceof ilObjUser && $sender->getId() !== 0 && !$sender->isAnonymous()) {
789  $this->ctrl->setParameterByClass(
790  ilMailFormGUI::class,
791  self::PARAM_FOLDER_ID,
792  $mail_data['folder_id']
793  );
794  $this->ctrl->setParameterByClass(ilMailFormGUI::class, self::PARAM_MAIL_ID, $mail_id);
795  $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_REPLY);
796  $reply_btn = $this->ui_factory->button()->primary(
797  $this->lng->txt('reply'),
798  $this->ctrl->getLinkTargetByClass(ilMailFormGUI::class)
799  );
800  $this->toolbar->addStickyItem($reply_btn);
801  $this->ctrl->clearParametersByClass(ilMailFormGUI::class);
802  }
803 
804  $this->ctrl->setParameterByClass(ilMailFormGUI::class, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
805  $this->ctrl->setParameterByClass(ilMailFormGUI::class, self::PARAM_MAIL_ID, $mail_id);
806  $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_FORWARD);
807  if ($reply_btn === null) {
808  $fwd_btn = $this->ui_factory->button()->primary(
809  $this->lng->txt('forward'),
810  $this->ctrl->getLinkTargetByClass(ilMailFormGUI::class)
811  );
812  $this->toolbar->addStickyItem($fwd_btn);
813  } else {
814  $fwd_btn = $this->ui_factory->button()->standard(
815  $this->lng->txt('forward'),
816  $this->ctrl->getLinkTargetByClass(ilMailFormGUI::class)
817  );
818  $this->toolbar->addComponent($fwd_btn);
819  }
820  $this->ctrl->clearParametersByClass(ilMailFormGUI::class);
821 
822  if ($sender && $sender->getId() && !$sender->isAnonymous()) {
823  $linked_fullname = $sender->getPublicName();
824  $avatar = $this->ui_factory->symbol()->avatar()->picture(
825  $sender->getPersonalPicturePath('xsmall'),
826  $sender->getPublicName()
827  );
828 
829  if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), ['y', 'g'])) {
830  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $mail_id);
831  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
832  $this->ctrl->setParameter($this, self::PARAM_USER_ID, $sender->getId());
833  $linked_fullname = '<br /><a class="mailusername" href="' . $this->ctrl->getLinkTarget(
834  $this,
835  self::CMD_SHOW_USER
836  ) . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>';
837  $this->ctrl->clearParameters($this);
838  }
839 
840  $from = new ilCustomInputGUI($this->lng->txt('from') . ':');
841  $from->setHtml($this->ui_renderer->render($avatar) . ' ' . $linked_fullname);
842  } elseif (!$sender || !$sender->getId()) {
843  $from = new ilCustomInputGUI($this->lng->txt('from') . ':');
844  $from->setHtml(trim(($mail_data['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')'));
845  } else {
846  $from = new ilCustomInputGUI($this->lng->txt('from') . ':');
847  $from->setHtml(
848  $this->ui_renderer->render(
849  $this->ui_factory
850  ->symbol()
851  ->avatar()
852  ->picture(ilUtil::getImagePath('logo/ilias_logo_centered.png'), ilMail::_getIliasMailerName())
853  ) . '<br />' . ilMail::_getIliasMailerName()
854  );
855  }
856  $form->addItem($from);
857 
858  $to = new ilCustomInputGUI($this->lng->txt('mail_to') . ':');
859  $to->setHtml(
861  $this->umail->formatNamesForOutput($mail_data['rcp_to'] ?? ''),
862  false
863  )
864  );
865  $form->addItem($to);
866 
867  if ($mail_data['rcp_cc']) {
868  $cc = new ilCustomInputGUI($this->lng->txt('mail_cc') . ':');
869  $cc->setHtml(
871  $this->umail->formatNamesForOutput($mail_data['rcp_cc']),
872  false
873  )
874  );
875  $form->addItem($cc);
876  }
877 
878  if ($mail_data['rcp_bcc']) {
879  $bcc = new ilCustomInputGUI($this->lng->txt('mail_bcc') . ':');
880  $bcc->setHtml(
882  $this->umail->formatNamesForOutput($mail_data['rcp_bcc']),
883  false
884  )
885  );
886  $form->addItem($bcc);
887  }
888 
889  $subject = new ilCustomInputGUI($this->lng->txt('subject') . ':');
890  $subject->setHtml(ilUtil::htmlencodePlainString($mail_data['m_subject'] ?? '', true));
891  $form->addItem($subject);
892 
893  $date = new ilCustomInputGUI($this->lng->txt('mail_sent_datetime') . ':');
894  $date->setHtml(
896  new ilDateTime($mail_data['send_time'], IL_CAL_DATETIME)
897  )
898  );
899  $form->addItem($date);
900 
901  $message = new ilCustomInputGUI($this->lng->txt('message') . ':');
902  $message->setHtml(ilUtil::htmlencodePlainString($mail_data['m_message'] ?? '', true));
903  $form->addItem($message);
904 
905  if ($mail_data['attachments']) {
906  $att = new ilCustomInputGUI($this->lng->txt('attachments') . ':');
907 
908  $radiog = new ilRadioGroupInputGUI('', 'filename');
909  foreach ($mail_data['attachments'] as $file) {
910  $radiog->addOption(new ilRadioOption($file, md5((string) $file)));
911  }
912 
913  $att->setHtml($radiog->render());
914  $form->addCommandButton(self::CMD_DELIVER_FILE, $this->lng->txt('download'));
915  $form->addItem($att);
916  }
917 
918  $current_folder = $this->mbox->getFolderData((int) $mail_data['folder_id']);
919  if ($current_folder === null) {
920  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_operation_on_invalid_folder'), true);
921  $this->ctrl->setParameterByClass(ilMailGUI::class, self::PARAM_FOLDER_ID, $this->mbox->getInboxFolder());
922  $this->ctrl->redirectByClass(ilMailGUI::class);
923  }
924 
925  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $this->folder->getFolderId());
926  $this->tabs->addTab(
927  'current_folder',
928  $current_folder->getTitle(),
929  $this->ctrl->getLinkTarget($this, self::CMD_SHOW_FOLDER)
930  );
931  $this->ctrl->clearParameters($this);
932  $this->tabs->activateTab('current_folder');
933 
934  $move_links = [];
935  $folders = $this->mbox->getSubFolders();
936  foreach ($folders as $folder) {
937  if ((!$folder->isTrash() || !$current_folder->isTrash()) &&
938  $folder->getFolderId() !== $mail_data['folder_id']) {
939  $move_links[] = $this->ui_factory->button()->shy(
940  sprintf(
941  $this->lng->txt('mail_move_to_folder_x'),
942  $folder->getTitle()
943  ) . ($folder->isTrash() ? ' (' . $this->lng->txt('delete') . ')' : ''),
944  '#',
945  )->withOnLoadCode(static fn($id): string => "
946  document.getElementById('$id').addEventListener('click', function(e) {
947  const frm = this.closest('form'),
948  action = new URL(frm.action),
949  action_params = new URLSearchParams(action.search);
950 
951  action_params.delete('cmd');
952  action_params.append('cmd', '" . self::CMD_MOVE_SINGLE_MAIL . "');
953  action_params.delete('folder_id');
954  action_params.append('folder_id', '" . $folder->getFolderId() . "');
955 
956  action.search = action_params.toString();
957 
958  frm.action = action.href;
959  frm.submit();
960 
961  e.preventDefault();
962  e.stopPropagation();
963 
964  return false;
965  });");
966  }
967  }
968 
969  if ($this->folder->isTrash()) {
970  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $mail_id);
971  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
972  $modal = $this->ui_factory->modal()->interruptive(
973  $this->lng->txt('delete'),
974  $this->lng->txt('mail_sure_delete_s'),
975  $this->ctrl->getLinkTarget($this, self::CMD_DELETE_MAILS)
976  )->withAffectedItems([
977  $this->ui_factory->modal()->interruptiveItem()->standard(
978  (string) $mail_id,
980  new ilDateTime($mail_data['send_time'], IL_CAL_DATETIME)
981  ) . ' ' . $mail_data['m_subject']
982  )
983  ]);
984  $this->toolbar->addComponent(
985  $this->ui_factory->button()->standard(
986  $this->lng->txt('delete'),
987  '#'
988  )->withOnClick($modal->getShowSignal())
989  );
990  $this->ctrl->clearParameters($this);
991 
992  $ui_components[] = $modal;
993  }
994 
995  if ($move_links !== []) {
996  $this->toolbar->addComponent(
997  $this->ui_factory->dropdown()->standard($move_links)
998  ->withLabel($this->lng->txt('mail_move_to_folder_btn_label'))
999  );
1000  }
1001 
1002  $this->toolbar->addSeparator();
1003 
1004  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $mail_id);
1005  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $mail_data['folder_id']);
1006  $print_url = $this->ctrl->getLinkTarget($this, self::CMD_PRINT_MAIL);
1007  $this->ctrl->clearParameters($this);
1008  $print_btn = $this->ui_factory->button()
1009  ->standard($this->lng->txt('print'), '#')
1010  ->withOnLoadCode(static fn($id): string => "
1011  document.getElementById('$id').addEventListener('click', function() {
1012  const frm = this.closest('form'),
1013  action = frm.action;
1014 
1015  frm.action = '$print_url';
1016  frm.target = '_blank';
1017  frm.submit();
1018 
1019  frm.action = action;
1020  frm.removeAttribute('target');
1021 
1022  return false;
1023  });
1024  ");
1025  $this->toolbar->addComponent($print_btn);
1026 
1027  $prev_mail = $this->umail->getPreviousMail($mail_id);
1028  $next_mail = $this->umail->getNextMail($mail_id);
1029  if (is_array($prev_mail) || is_array($next_mail)) {
1030  $this->toolbar->addSeparator();
1031 
1032  if ($prev_mail && $prev_mail[self::PARAM_MAIL_ID]) {
1033  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $prev_mail[self::PARAM_MAIL_ID]);
1034  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $this->folder->getFolderId());
1035  $pref_btn = $this->ui_factory->button()
1036  ->standard(
1037  $this->lng->txt('previous'),
1038  $this->ctrl->getLinkTarget($this, self::CMD_SHOW_MAIL)
1039  );
1040  $this->toolbar->addComponent($pref_btn);
1041  $this->ctrl->clearParameters($this);
1042  }
1043 
1044  if ($next_mail && $next_mail[self::PARAM_MAIL_ID]) {
1045  $this->ctrl->setParameter($this, self::PARAM_MAIL_ID, $next_mail[self::PARAM_MAIL_ID]);
1046  $this->ctrl->setParameter($this, self::PARAM_FOLDER_ID, $this->folder->getFolderId());
1047  $next_btn = $this->ui_factory->button()
1048  ->standard(
1049  $this->lng->txt('next'),
1050  $this->ctrl->getLinkTarget($this, self::CMD_SHOW_MAIL)
1051  );
1052  $this->toolbar->addComponent($next_btn);
1053  $this->ctrl->clearParameters($this);
1054  }
1055  }
1056 
1057  $this->tpl->setContent($form->getHTML() . $this->ui_renderer->render($ui_components));
1058  $this->tpl->printToStdout();
1059  }
1060 
1061  protected function printMail(): void
1062  {
1063  $tplprint = new ilTemplate('tpl.mail_print.html', true, true, 'components/ILIAS/Mail');
1064 
1065  $mail_id = $this->getMailIdsFromRequest()[0] ?? 0;
1066  $mail_data = $this->umail->getMail($mail_id);
1067 
1068  $sender = ilObjectFactory::getInstanceByObjId($mail_data['sender_id'], false);
1069 
1070  $tplprint->setVariable('TXT_FROM', $this->lng->txt('from'));
1071  if ($sender instanceof ilObjUser && $sender->getId() !== 0 && !$sender->isAnonymous()) {
1072  $tplprint->setVariable('FROM', $sender->getPublicName());
1073  } elseif (!$sender instanceof ilObjUser || $sender->getId() === 0) {
1074  $tplprint->setVariable(
1075  'FROM',
1076  trim(($mail_data['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')')
1077  );
1078  } else {
1079  $tplprint->setVariable('FROM', ilMail::_getIliasMailerName());
1080  }
1081 
1082  $tplprint->setVariable('TXT_TO', $this->lng->txt('mail_to'));
1083  $tplprint->setVariable('TO', $mail_data['rcp_to']);
1084 
1085  if ($mail_data['rcp_cc']) {
1086  $tplprint->setCurrentBlock('cc');
1087  $tplprint->setVariable('TXT_CC', $this->lng->txt('mail_cc'));
1088  $tplprint->setVariable('CC', $mail_data['rcp_cc']);
1089  $tplprint->parseCurrentBlock();
1090  }
1091 
1092  if ($mail_data['rcp_bcc']) {
1093  $tplprint->setCurrentBlock('bcc');
1094  $tplprint->setVariable('TXT_BCC', $this->lng->txt('mail_bcc'));
1095  $tplprint->setVariable('BCC', $mail_data['rcp_bcc']);
1096  $tplprint->parseCurrentBlock();
1097  }
1098 
1099  $tplprint->setVariable('TXT_SUBJECT', $this->lng->txt('subject'));
1100  $tplprint->setVariable('SUBJECT', htmlspecialchars((string) $mail_data['m_subject']));
1101 
1102  $tplprint->setVariable('TXT_DATE', $this->lng->txt('date'));
1103  $tplprint->setVariable(
1104  'DATE',
1105  ilDatePresentation::formatDate(new ilDateTime($mail_data['send_time'], IL_CAL_DATETIME))
1106  );
1107 
1108  $tplprint->setVariable('TXT_MESSAGE', $this->lng->txt('message'));
1109  $tplprint->setVariable('MAIL_MESSAGE', nl2br(htmlspecialchars((string) $mail_data['m_message'])));
1110 
1111  $tplprint->show();
1112  }
1113 
1114  protected function deliverFile(): void
1115  {
1116  $mail_id = $this->http->wrapper()->query()->retrieve(
1117  self::PARAM_MAIL_ID,
1118  $this->refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->refinery->always(0)])
1119  );
1120  if ($mail_id <= 0) {
1121  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1122  }
1123 
1124  $filename = $this->http->wrapper()->post()->retrieve(
1125  'filename',
1126  $this->refinery->byTrying([$this->refinery->kindlyTo()->string(), $this->refinery->always('')])
1127  );
1128 
1129  if (is_string(ilSession::get('filename')) && ilSession::get('filename') !== '') {
1130  $filename = ilSession::get('filename');
1131  ilSession::set('filename', null);
1132  }
1133 
1134  try {
1135  if ($mail_id > 0 && $filename !== '') {
1136  while (str_contains((string) $filename, '..')) {
1137  $filename = str_replace('..', '', $filename);
1138  }
1139 
1140  $mail_file_data = new ilFileDataMail($this->user->getId());
1141  try {
1142  $file = $mail_file_data->getAttachmentPathAndFilenameByMd5Hash($filename, (int) $mail_id);
1143  ilFileDelivery::deliverFileLegacy($file['path'], $file['filename']);
1144  } catch (OutOfBoundsException $e) {
1145  throw new ilMailException('mail_error_reading_attachment', $e->getCode(), $e);
1146  }
1147  } else {
1148  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_attachment'));
1149  $this->showMail();
1150  }
1151  } catch (Exception $e) {
1152  $this->tpl->setOnScreenMessage('failure', $this->lng->txt($e->getMessage()), true);
1153  $this->redirectToFolder();
1154  }
1155  }
1156 
1157  protected function deliverAttachments(): void
1158  {
1159  try {
1160  $mail_id = $this->getMailIdsFromRequest()[0] ?? 0;
1161  $mail_data = $this->umail->getMail($mail_id);
1162  if ($mail_data === null || [] === (array) $mail_data['attachments']) {
1163  throw new ilMailException('mail_error_reading_attachment');
1164  }
1165 
1166  $type = $this->http->wrapper()->query()->retrieve(
1167  'type',
1168  $this->refinery->byTrying([$this->refinery->kindlyTo()->string(), $this->refinery->always('')])
1169  );
1170 
1171  $mail_file_data = new ilFileDataMail($this->user->getId());
1172  if (count($mail_data['attachments']) === 1) {
1173  $attachment = current($mail_data['attachments']);
1174 
1175  try {
1176  if ($type === 'draft') {
1177  if (!$mail_file_data->checkFilesExist([$attachment])) {
1178  throw new OutOfBoundsException('');
1179  }
1180  $path_to_file = $mail_file_data->getAbsoluteAttachmentPoolPathByFilename($attachment);
1181  $filename = $attachment;
1182  } else {
1183  $file = $mail_file_data->getAttachmentPathAndFilenameByMd5Hash(
1184  md5((string) $attachment),
1185  $mail_id
1186  );
1187  $path_to_file = $file['path'];
1188  $filename = $file['filename'];
1189  }
1191  } catch (OutOfBoundsException $e) {
1192  throw new ilMailException('mail_error_reading_attachment', $e->getCode(), $e);
1193  }
1194  } else {
1195  $mail_file_data->deliverAttachmentsAsZip(
1196  $mail_data['m_subject'],
1197  $mail_id,
1198  $mail_data['attachments'],
1199  $type === 'draft'
1200  );
1201  }
1202  } catch (Exception $e) {
1203  $this->tpl->setOnScreenMessage('failure', $this->lng->txt($e->getMessage()), true);
1204  $this->redirectToFolder();
1205  }
1206  }
1207 }
getAttachmentPathAndFilenameByMd5Hash(string $md5FileHash, int $mail_id)
static get(string $a_var)
This class represents an option in a radio group.
readonly GlobalHttpState $http
readonly ilCtrlInterface $ctrl
const IL_CAL_DATETIME
static getUserObjectById(int $usr_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const string CMD_DELIVER_FILE
const string CMD_SHOW_MAIL
readonly ilUIService $ui_service
readonly ilTabsGUI $tabs
const string CMD_EMPTY_TRASH
const string CMD_ADD_SUB_FOLDER
const string URL_BUILDER_PREFIX
final const string MAIL_FORM_TYPE_REPLY
static _getIliasMailerName()
readonly ilGlobalTemplateInterface $tpl
static _lookupPref(int $a_usr_id, string $a_keyword)
readonly Factory $ui_factory
const string PARAM_TARGET_FOLDER
const string CMD_RENAME_SUB_FOLDER
$components
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static htmlencodePlainString(string $a_str, bool $a_make_links_clickable, bool $a_detect_goto_links=false)
Encodes a plain text string into HTML for display in a browser.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
confirmDeleteMails(array $mail_ids)
Confirm the deletion of selected mails in async modal.
const string PARAM_MAIL_ID
GUI class for public user profile presentation.
const string CMD_SHOW_FOLDER
final const string MAIL_FORM_TYPE_FORWARD
ilMailFolderGUI:
static http()
Fetches the global http state from ILIAS.
This class represents a property in a property form.
readonly ilObjUser $user
readonly ilLanguage $lng
This is how the factory for UI elements looks.
Definition: Factory.php:37
initRequest()
Init class variables that can be determined in an actual request.
const string CMD_TABLE_ACTION
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const string CMD_PRINT_MAIL
$param
Definition: xapitoken.php:46
const string CMD_MOVE_SINGLE_MAIL
global $DIC
Definition: shib_login.php:26
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
MailFolderData $folder
readonly Refinery $refinery
$filename
Definition: buildRTE.php:78
const string PARAM_INTERRUPTIVE_ITEMS
const string PARAM_FOLDER_ID
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
const string CMD_DELETE_SUB_FOLDER
moveSingleMail()
Move a single mail to a folder Called from showMail page.
static _getHttpPath()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
readonly Renderer $ui_renderer
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
readonly ilToolbarGUI $toolbar
$message
Definition: xapiexit.php:31
readonly ilErrorHandling $error
final const string MAIL_FORM_TYPE_DRAFT
getFilteredSearch()
Searcher for mails in the folder, initialized with the current filter values needed for table display...
const string CMD_DELETE_MAILS
const string CMD_SHOW_USER
URLBuilder.
Definition: URLBuilder.php:40
readonly DataFactory $data_factory
const string PARAM_USER_ID
static set(string $a_var, $a_val)
Set a value.
static _lookupLogin(int $a_user_id)