57 $this->tpl = $DIC->ui()->mainTemplate();
58 $this->ctrl = $DIC->ctrl();
59 $this->lng = $DIC->language();
60 $this->toolbar = $DIC->toolbar();
61 $this->
user = $DIC->user();
62 $this->tabs = $DIC->tabs();
63 $this->httpRequest = $DIC->http()->request();
65 $this->umail =
new ilMail($this->
user->getId());
76 $folderId = $this->httpRequest->getParsedBody()[
'mobj_id'] ?? 0;
77 if (!is_numeric($folderId) || 0 == $folderId) {
78 $folderId = $this->httpRequest->getQueryParams()[
'mobj_id'] ?? 0;
81 if (!is_numeric($folderId) || 0 == $folderId || !$this->mbox->isOwnedFolder($folderId)) {
82 $folderId = $this->mbox->getInboxFolder();
85 $this->currentFolderId = (int) $folderId;
95 if (preg_match(
'/^([a-zA-Z0-9]+?)_(\d+?)$/', $originalCommand, $matches) && 3 === count($matches)) {
96 $originalCommand = $matches[1];
99 return $originalCommand;
111 preg_match(
'/^([a-zA-Z0-9]+?)_(\d+?)$/', $command, $matches) &&
112 3 === count($matches) && is_numeric($matches[2])
114 return (
int) $matches[2];
117 throw new \InvalidArgumentException(
"Cannot parse a numeric folder id from command string!");
126 $this->ctrl->getCmd()
129 $nextClass = $this->ctrl->getNextClass($this);
130 switch ($nextClass) {
135 case 'ilmailoptionsgui':
136 $this->tpl->setTitle($this->lng->txt(
'mail'));
140 case 'ilpublicuserprofilegui':
141 $this->tpl->setTitle($this->lng->txt(
'mail'));
142 $profileGui = new \ilPublicUserProfileGUI((
int) ($this->httpRequest->getQueryParams()[
'user'] ?? 0));
144 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
145 $profileGui->setBackUrl($this->ctrl->getLinkTarget($this,
'showMail'));
146 $this->ctrl->clearParameters($this);
148 $ret = $this->ctrl->forwardCommand($profileGui);
150 $this->tpl->setContent(
$ret);
156 if (!method_exists($this, $cmd)) {
169 $this->umail->deleteMailsOfFolder($this->currentFolderId);
171 \ilUtil::sendSuccess($this->lng->txt(
'mail_deleted'),
true);
172 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
173 $this->ctrl->redirect($this,
'showFolder');
181 if ($this->umail->countMailsOfFolder($this->currentFolderId)) {
182 $this->confirmTrashDeletion =
true;
193 $this->tpl->setVariable(
'TBL_TITLE', implode(
' ', [
194 $this->lng->txt(
'profile_of'),
198 $this->tpl->setVariable(
'TBL_TITLE_IMG_ALT', $this->lng->txt(
'public_profile'));
200 $profile_gui = new \ilPublicUserProfileGUI((
int) ($this->httpRequest->getQueryParams()[
'user'] ?? 0));
202 $this->ctrl->setParameter($this,
'mail_id', (
int) $this->httpRequest->getQueryParams()[
'mail_id']);
203 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
204 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this,
'showMail'));
205 $this->ctrl->clearParameters($this);
207 $this->tpl->setTitle($this->lng->txt(
'mail'));
208 $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
218 $this->toolbar->addSeparator();
221 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
222 $this->toolbar->addButton($this->lng->txt(
'mail_add_subfolder'), $this->ctrl->getLinkTarget($this,
'addSubFolder'));
224 if ($isUserSubFolder) {
225 $this->toolbar->addButton($this->lng->txt(
'rename'), $this->ctrl->getLinkTarget($this,
'renameSubFolder'));
226 $this->toolbar->addButton($this->lng->txt(
'delete'), $this->ctrl->getLinkTarget($this,
'deleteSubFolder'));
228 $this->ctrl->clearParameters($this);
235 protected function showFolder(
bool $oneConfirmationDialogueRendered =
false)
237 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail.html',
'Services/Mail');
238 $this->tpl->setTitle($this->lng->txt(
'mail'));
240 $sentFolderId = $this->mbox->getSentFolder();
241 $draftsFolderId = $this->mbox->getDraftsFolder();
243 $isTrashFolder = $this->currentFolderId == $this->mbox->getTrashFolder();
244 $isSentFolder = $this->currentFolderId == $sentFolderId;
245 $isDraftFolder = $this->currentFolderId == $draftsFolderId;
247 if ($isTrashFolder &&
'deleteMails' === $this->
parseCommand($this->ctrl->getCmd()) && !$this->errorDelete) {
248 $confirmationGui = new \ilConfirmationGUI();
249 $confirmationGui->setHeaderText($this->lng->txt(
'mail_sure_delete'));
251 $confirmationGui->addHiddenItem(
'mail_id[]', $mailId);
253 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
254 $confirmationGui->setFormAction($this->ctrl->getFormAction($this,
'showFolder'));
255 $this->ctrl->clearParameters($this);
256 $confirmationGui->setConfirm($this->lng->txt(
'confirm'),
'confirmDeleteMails');
257 $confirmationGui->setCancel($this->lng->txt(
'cancel'),
'showFolder');
258 $this->tpl->setVariable(
'CONFIRMATION', $confirmationGui->getHTML());
259 $oneConfirmationDialogueRendered =
true;
262 $folders = $this->mbox->getSubFolders();
263 $mtree = new \ilTree($this->
user->getId());
264 $mtree->setTableNames(
'mail_tree',
'mail_obj_data');
266 $isUserSubFolder =
false;
267 $isUserRootFolder =
false;
270 $folder_d = $mtree->getNodeData($this->currentFolderId);
271 if ($folder_d[
'm_type'] ===
'user_folder') {
272 $isUserSubFolder =
true;
273 } elseif ($folder_d[
'm_type'] ===
'local') {
274 $isUserRootFolder =
true;
279 $mailtable->isSentFolder($isSentFolder)
280 ->isDraftFolder($isDraftFolder)
281 ->isTrashFolder($isTrashFolder)
286 $mailtable->prepareHTML();
289 $this->lng->txt($e->getMessage()) !=
'-' . $e->getMessage() .
'-' ?
290 $this->lng->txt($e->getMessage()) :
295 $table_html = $mailtable->getHtml();
297 $folder_options = array();
299 foreach ($folders as $folder) {
300 $folder_d = $mtree->getNodeData($folder[
'obj_id']);
302 if ($folder[
'obj_id'] == $this->currentFolderId) {
303 if ($folder[
'type'] ===
'user_folder') {
304 $isUserSubFolder =
true;
306 if ($folder[
'type'] ===
'local') {
307 $isUserRootFolder =
true;
308 $isUserSubFolder =
false;
313 $folder_options[$folder[
'obj_id']] = sprintf(
314 $this->lng->txt(
'mail_change_to_folder'),
315 $this->lng->txt(
'mail_' . $folder[
'title'])
317 if ($folder[
'type'] ===
'user_folder') {
319 for (
$i = 2;
$i < $folder_d[
'depth'] - 1;
$i++) {
323 if ($folder_d[
'depth'] > 1) {
327 $folder_options[$folder[
'obj_id']] = sprintf(
328 $this->lng->txt(
'mail_change_to_folder'),
329 $pre .
' ' . $folder[
'title']
335 if ($oneConfirmationDialogueRendered ===
false && $this->confirmTrashDeletion ===
false) {
337 $si = new \ilSelectInputGUI(
'',
'mobj_id');
338 $si->setOptions($folder_options);
339 $si->setValue($this->currentFolderId);
340 $this->toolbar->addStickyItem(
$si);
343 $btn->setCaption(
'change');
344 $btn->setCommand(
'showFolder');
345 $this->toolbar->addStickyItem($btn);
346 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'showFolder'));
348 if ($isUserRootFolder ==
true || $isUserSubFolder ==
true) {
353 if ($mailtable->isTrashFolder() && $mailtable->getNumberOfMails() > 0 && $this->confirmTrashDeletion ===
true) {
354 $confirmationGui = new \ilConfirmationGUI();
355 $confirmationGui->setHeaderText($this->lng->txt(
'mail_empty_trash_confirmation'));
356 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
357 $confirmationGui->setFormAction($this->ctrl->getFormAction($this,
'performEmptyTrash'));
358 $this->ctrl->clearParameters($this);
359 $confirmationGui->setConfirm($this->lng->txt(
'confirm'),
'performEmptyTrash');
360 $confirmationGui->setCancel($this->lng->txt(
'cancel'),
'showFolder');
361 $this->tpl->setVariable(
'CONFIRMATION', $confirmationGui->getHTML());
364 $this->tpl->setVariable(
'MAIL_TABLE', $table_html);
373 if ($a_show_confirm) {
374 $confirmationGui = new \ilConfirmationGUI();
375 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
376 $confirmationGui->setFormAction($this->ctrl->getFormAction($this,
'showFolder'));
377 $this->ctrl->clearParameters($this);
378 $confirmationGui->setHeaderText($this->lng->txt(
'mail_sure_delete_folder'));
379 $confirmationGui->setCancel($this->lng->txt(
'cancel'),
'showFolder');
380 $confirmationGui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteSubFolder');
381 $this->tpl->setVariable(
'CONFIRMATION', $confirmationGui->getHTML());
394 $parentFolderId = $this->mbox->getParentFolderId($this->currentFolderId);
395 if ($parentFolderId > 0 && $this->mbox->deleteFolder($this->currentFolderId)) {
397 $this->ctrl->setParameterByClass(
'ilMailGUI',
'mobj_id', (
int) $parentFolderId);
398 $this->ctrl->redirectByClass(
'ilMailGUI');
411 $form = new \ilPropertyFormGUI();
412 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
413 $form->setFormAction($this->ctrl->getFormAction($this,
'performAddSubFolder'));
414 $this->ctrl->clearParameters($this);
415 if (
'edit' === $mode) {
416 $form->addCommandButton(
'performRenameSubFolder', $this->lng->txt(
'save'));
417 $form->setTitle($this->lng->txt(
'mail_rename_folder'));
419 $form->addCommandButton(
'performAddSubFolder', $this->lng->txt(
'save'));
420 $form->setTitle($this->lng->txt(
'mail_add_folder'));
422 $form->addCommandButton(
'showFolder', $this->lng->txt(
'cancel'));
424 $title = new \ilTextInputGUI($this->lng->txt(
'title'),
'subfolder_title');
425 $title->setRequired(
true);
437 $isFormValid =
$form->checkInput();
438 $form->setValuesByPost();
444 if ($newFolderId = $this->mbox->addFolder($this->currentFolderId,
$form->getInput(
'subfolder_title'))) {
445 \ilUtil::sendSuccess($this->lng->txt(
'mail_folder_created'),
true);
446 $this->ctrl->setParameterByClass(
'ilMailGUI',
'mobj_id', $newFolderId);
447 $this->ctrl->redirectByClass(
'ilMailGUI');
460 if (null ===
$form) {
464 $this->tpl->setTitle($this->lng->txt(
'mail'));
465 $this->tpl->setContent(
$form->getHTML());
475 $isFormValid =
$form->checkInput();
476 $form->setValuesByPost();
482 $folderData = $this->mbox->getFolderData($this->currentFolderId);
483 if ($folderData[
'title'] ===
$form->getInput(
'subfolder_title')) {
488 if ($this->mbox->renameFolder($this->currentFolderId,
$form->getInput(
'subfolder_title'))) {
489 \ilUtil::sendSuccess($this->lng->txt(
'mail_folder_name_changed'),
true);
490 $this->ctrl->setParameterByClass(
'ilMailGUI',
'mobj_id', $this->currentFolderId);
491 $this->ctrl->redirectByClass(
'ilMailGUI');
504 if (null ===
$form) {
506 $form->setValuesByArray([
'subfolder_title' => $this->mbox->getFolderData($this->currentFolderId)[
'title']]);
509 $this->tpl->setTitle($this->lng->txt(
'mail'));
510 $this->tpl->setContent(
$form->getHTML());
520 $mailIds = $this->httpRequest->getParsedBody()[
'mail_id'] ?? [];
521 if (!is_array($mailIds)) {
525 if (0 === count($mailIds) && !$ignoreHttpGet) {
526 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
527 if (is_numeric($mailId)) {
528 $mailIds = [$mailId];
532 return array_filter(array_map(
'intval', $mailIds));
541 if (count($mailIds) > 0) {
542 $this->umail->markRead($mailIds);
543 \ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
557 if (count($mailIds) > 0) {
558 $this->umail->markUnread($mailIds);
559 \ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
573 if (1 !== count($mailIds)) {
579 $newFolderId = (int) ($this->httpRequest->getParsedBody()[
'folder_id'] ?? 0);
580 $redirectFolderId = $newFolderId;
581 foreach ($mailIds as $mailId) {
582 $mailData = $this->umail->getMail($mailId);
583 if (isset($mailData[
'folder_id']) && is_numeric($mailData[
'folder_id']) && (
int) $mailData[
'folder_id'] > 0) {
584 $redirectFolderId = $mailData[
'folder_id'];
589 if ($this->umail->moveMailsToFolder($mailIds, $newFolderId)) {
590 \ilUtil::sendSuccess($this->lng->txt(
'mail_moved'),
true);
591 $this->ctrl->setParameter($this,
'mobj_id', $redirectFolderId);
592 $this->ctrl->redirect($this,
'showFolder');
605 if (0 === count($mailIds)) {
612 if ($this->umail->moveMailsToFolder($mailIds, $folderId)) {
613 \ilUtil::sendSuccess($this->lng->txt(
'mail_moved'),
true);
614 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
615 $this->ctrl->redirect($this,
'showFolder');
627 $trashFolderId = (int) $this->mbox->getTrashFolder();
630 if ($trashFolderId == $this->currentFolderId) {
631 if (0 === count($mailIds)) {
633 $this->errorDelete =
true;
636 if (0 === count($mailIds)) {
638 } elseif ($this->umail->moveMailsToFolder($mailIds, $trashFolderId)) {
639 \ilUtil::sendSuccess($this->lng->txt(
'mail_moved_to_trash'),
true);
640 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
641 $this->ctrl->redirect($this,
'showFolder');
656 if (0 === count($mailIds)) {
662 if ((
int) $this->mbox->getTrashFolder() === (int) $this->currentFolderId) {
663 if ($this->umail->deleteMails($mailIds)) {
664 \ilUtil::sendSuccess($this->lng->txt(
'mail_deleted'),
true);
665 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
666 $this->ctrl->redirect($this,
'showFolder');
678 protected function showMail()
684 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
687 $mailData = $this->umail->getMail($mailId);
688 $this->umail->markRead(array($mailId));
690 $this->tpl->setTitle($this->lng->txt(
'mail_mails_of'));
692 $this->tabs->clearTargets();
693 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
694 $this->tabs->setBackTarget($this->lng->txt(
'back_to_folder'), $this->ctrl->getFormAction($this,
'showFolder'));
695 $this->ctrl->clearParameters($this);
697 $this->ctrl->setParameter($this,
'mail_id', $mailId);
698 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
699 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'showMail'));
700 $this->ctrl->clearParameters($this);
702 $form = new \ilPropertyFormGUI();
703 $form->setPreventDoubleSubmission(
false);
704 $form->setTableWidth(
'100%');
705 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
706 $this->ctrl->setParameter($this,
'mail_id', $mailId);
707 $form->setFormAction($this->ctrl->getFormAction($this,
'showMail'));
708 $this->ctrl->clearParameters($this);
709 $form->setTitle($this->lng->txt(
'mail_mails_of'));
716 if ($sender && $sender->getId() && !$sender->isAnonymous()) {
718 $replyBtn->setCaption(
'reply');
719 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mobj_id', $mailData[
'folder_id']);
720 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mail_id', $mailId);
721 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'reply');
722 $replyBtn->setUrl($this->ctrl->getLinkTargetByClass(
'ilmailformgui'));
723 $this->ctrl->clearParametersByClass(
'ilmailformgui');
725 $replyBtn->setPrimary(
true);
726 $this->toolbar->addStickyItem($replyBtn);
730 $fwdBtn->setCaption(
'forward');
731 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mobj_id', $mailData[
'folder_id']);
732 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mail_id', $mailId);
733 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'forward');
734 $fwdBtn->setUrl($this->ctrl->getLinkTargetByClass(
'ilmailformgui'));
735 $this->ctrl->clearParametersByClass(
'ilmailformgui');
738 $fwdBtn->setPrimary(
true);
739 $this->toolbar->addStickyItem($fwdBtn);
741 $this->toolbar->addButtonInstance($fwdBtn);
745 $printBtn->setCaption(
'print');
746 $this->ctrl->setParameter($this,
'mail_id', $mailId);
747 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
748 $printBtn->setUrl($this->ctrl->getLinkTarget($this,
'printMail'));
749 $this->ctrl->clearParameters($this);
750 $printBtn->setTarget(
'_blank');
751 $this->toolbar->addButtonInstance($printBtn);
754 $deleteBtn->setCaption(
'delete');
755 $deleteBtn->setCommand(
'deleteMails');
757 $this->toolbar->addButtonInstance($deleteBtn);
759 if ($sender && $sender->getId() && !$sender->isAnonymous()) {
760 $linked_fullname = $sender->getPublicName();
762 $sender->getPersonalPicturePath(
'xsmall'),
763 $sender->getPublicName(),
772 $this->ctrl->setParameter($this,
'mail_id', $mailId);
773 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
774 $this->ctrl->setParameter($this,
'user', $sender->getId());
775 $linked_fullname =
'<br /><a href="' . $this->ctrl->getLinkTarget($this,
'showUser') .
'" title="' . $linked_fullname .
'">' . $linked_fullname .
'</a>';
776 $this->ctrl->clearParameters($this);
780 $from->setHtml($picture .
' ' . $linked_fullname);
782 } elseif (!$sender || !$sender->getId()) {
784 $from->setHtml($mailData[
'import_name'] .
' (' . $this->lng->txt(
'user_deleted') .
')');
790 '<br />' . ilMail::_getIliasMailerName()
799 if ($mailData[
'rcp_cc']) {
805 if ($mailData[
'rcp_bcc']) {
808 $form->addItem($bcc);
813 $form->addItem($subject);
817 $form->addItem($date);
823 if ($mailData[
'attachments']) {
827 foreach ($mailData[
'attachments'] as $file) {
831 $att->
setHtml($radiog->render());
832 $form->addCommandButton(
'deliverFile', $this->lng->txt(
'download'));
833 $form->addItem($att);
836 $isTrashFolder =
false;
837 if ($this->mbox->getTrashFolder() == $mailData[
'folder_id']) {
838 $isTrashFolder =
true;
841 $currentFolderData = $this->mbox->getFolderData($mailData[
'folder_id']);
842 $actions = $this->mbox->getActions($mailData[
'folder_id']);
844 $selectOptions = array();
846 if (
$key ===
'moveMails') {
847 $folders = $this->mbox->getSubFolders();
848 foreach ($folders as $folder) {
850 ($folder[
'type'] !==
'trash' || !$isTrashFolder) &&
851 $folder[
'obj_id'] != $mailData[
'folder_id']
853 $optionText =
$action .
' ' . $folder[
'title'];
854 if ($folder[
'type'] !==
'user_folder') {
855 $optionText =
$action .
' ' . $this->lng->txt(
'mail_' . $folder[
'title']) . ($folder[
'type'] ==
'trash' ?
' (' . $this->lng->txt(
'delete') .
')' :
'');
858 $selectOptions[$folder[
'obj_id']] = $optionText;
864 $folderLabel = $this->lng->txt(
'mail_' . $currentFolderData[
'title']);
865 if ($currentFolderData[
'type'] ===
'user_folder') {
866 $folderLabel = $currentFolderData[
'title'];
869 $this->toolbar->addSeparator();
870 $this->toolbar->addText(sprintf($this->lng->txt(
'current_folder'), $folderLabel));
872 if (is_array($selectOptions) && count($selectOptions) > 0) {
873 $actions = new \ilSelectInputGUI(
'',
'folder_id');
874 $actions->setOptions($selectOptions);
875 $this->toolbar->addInputItem($actions);
878 $moveBtn->setCaption(
'execute');
879 $moveBtn->setCommand(
'moveSingleMail');
880 $this->toolbar->addButtonInstance($moveBtn);
883 $prevMail = $this->umail->getPreviousMail($mailId);
884 $nextMail = $this->umail->getNextMail($mailId);
885 if (is_array($prevMail) || is_array($nextMail)) {
886 $this->toolbar->addSeparator();
888 if ($prevMail[
'mail_id']) {
890 $prevBtn->setCaption(
'previous');
891 $this->ctrl->setParameter($this,
'mail_id', $prevMail[
'mail_id']);
892 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
893 $prevBtn->setUrl($this->ctrl->getLinkTarget($this,
'showMail'));
894 $this->ctrl->clearParameters($this);
895 $this->toolbar->addButtonInstance($prevBtn);
898 if ($nextMail[
'mail_id']) {
900 $nextBtn->setCaption(
'next');
901 $this->ctrl->setParameter($this,
'mail_id', $nextMail[
'mail_id']);
902 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
903 $nextBtn->setUrl($this->ctrl->getLinkTarget($this,
'showMail'));
904 $this->ctrl->clearParameters($this);
905 $this->toolbar->addButtonInstance($nextBtn);
909 $this->tpl->setContent(
$form->getHTML());
916 public function printMail()
918 $tplprint =
new ilTemplate(
'tpl.mail_print.html',
true,
true,
'Services/Mail');
919 $tplprint->setVariable(
'JSPATH', $this->tpl->tplPath);
921 $mailData = $this->umail->getMail((
int) ($this->httpRequest->getQueryParams()[
'mail_id'] ?? 0));
928 $tplprint->setVariable(
'TXT_FROM', $this->lng->txt(
'from'));
929 if ($sender && $sender->getId() && !$sender->isAnonymous()) {
930 $tplprint->setVariable(
'FROM', $sender->getPublicName());
931 } elseif (!$sender || !$sender->getId()) {
932 $tplprint->setVariable(
'FROM', $mailData[
'import_name'] .
' (' . $this->lng->txt(
'user_deleted') .
')');
934 $tplprint->setVariable(
'FROM', ilMail::_getIliasMailerName());
937 $tplprint->setVariable(
'TXT_TO', $this->lng->txt(
'mail_to'));
938 $tplprint->setVariable(
'TO', $mailData[
'rcp_to']);
940 if ($mailData[
'rcp_cc']) {
941 $tplprint->setCurrentBlock(
'cc');
942 $tplprint->setVariable(
'TXT_CC', $this->lng->txt(
'cc'));
943 $tplprint->setVariable(
'CC', $mailData[
'rcp_cc']);
944 $tplprint->parseCurrentBlock();
947 if ($mailData[
'rcp_bcc']) {
948 $tplprint->setCurrentBlock(
'bcc');
949 $tplprint->setVariable(
'TXT_BCC', $this->lng->txt(
'bc'));
950 $tplprint->setVariable(
'BCC', $mailData[
'rcp_bcc']);
951 $tplprint->parseCurrentBlock();
954 $tplprint->setVariable(
'TXT_SUBJECT', $this->lng->txt(
'subject'));
955 $tplprint->setVariable(
'SUBJECT', htmlspecialchars($mailData[
'm_subject']));
957 $tplprint->setVariable(
'TXT_DATE', $this->lng->txt(
'date'));
960 $tplprint->setVariable(
'TXT_MESSAGE', $this->lng->txt(
'message'));
961 $tplprint->setVariable(
'MAIL_MESSAGE', nl2br(htmlspecialchars($mailData[
'm_message'])));
968 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
974 $filename = $this->httpRequest->getParsedBody()[
'filename'] ??
'';
982 while (strpos(
$filename,
'..') !==
false) {
986 $mailFileData = new \ilFileDataMail($this->
user->getId());
988 $file = $mailFileData->getAttachmentPathAndFilenameByMd5Hash(
$filename, (
int) $mailId);
990 }
catch (\OutOfBoundsException $e) {
991 throw new \ilException(
'mail_error_reading_attachment');
999 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
1000 $this->ctrl->redirect($this);
1007 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
1009 $mailData = $this->umail->getMail((
int) $mailId);
1010 if (null === $mailData || 0 === count((array) $mailData[
'attachments'])) {
1011 throw new \ilException(
'mail_error_reading_attachment');
1014 $type = $this->httpRequest->getQueryParams()[
'type'] ??
'';
1016 $mailFileData = new \ilFileDataMail($this->
user->getId());
1017 if (count($mailData[
'attachments']) === 1) {
1018 $attachment = current($mailData[
'attachments']);
1021 if (
'draft' ===
$type) {
1022 if (!$mailFileData->checkFilesExist([$attachment])) {
1023 throw new \OutOfBoundsException(
'');
1025 $pathToFile = $mailFileData->getAbsoluteAttachmentPoolPathByFilename($attachment);
1026 $fileName = $attachment;
1028 $file = $mailFileData->getAttachmentPathAndFilenameByMd5Hash(md5($attachment), (
int) $mailId);
1029 $pathToFile = $file[
'path'];
1030 $fileName = $file[
'filename'];
1033 }
catch (\OutOfBoundsException $e) {
1034 throw new \ilException(
'mail_error_reading_attachment');
1037 $mailFileData->deliverAttachmentsAsZip(
1038 $mailData[
'm_subject'],
1040 $mailData[
'attachments'],
1046 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
1047 $this->ctrl->redirect($this);
1056 $sentFolderId = $this->mbox->getSentFolder();
1057 $draftsFolderId = $this->mbox->getDraftsFolder();
1059 $isTrashFolder = $this->currentFolderId == $this->mbox->getTrashFolder();
1060 $isSentFolder = $this->currentFolderId == $sentFolderId;
1061 $isDraftFolder = $this->currentFolderId == $draftsFolderId;
1064 $table->isSentFolder($isSentFolder)
1065 ->isDraftFolder($isDraftFolder)
1066 ->isTrashFolder($isTrashFolder)
1069 $table->writeFilterToSession();
1079 $sentFolderId = $this->mbox->getSentFolder();
1080 $draftsFolderId = $this->mbox->getDraftsFolder();
1082 $isTrashFolder = $this->currentFolderId == $this->mbox->getTrashFolder();
1083 $isSentFolder = $this->currentFolderId == $sentFolderId;
1084 $isDraftFolder = $this->currentFolderId == $draftsFolderId;
1087 $table->isSentFolder($isSentFolder)
1088 ->isDraftFolder($isDraftFolder)
1089 ->isTrashFolder($isTrashFolder)
static _lookupLogin($a_user_id)
lookup login
getMailIdsFromRequest(bool $ignoreHttpGet=false)
This class represents an option in a radio group.
addSubFolder(\ilPropertyFormGUI $form=null)
Called if the acting user wants to create a folder.
__construct()
ilMailFolderGUI constructor.
markMailsRead()
Called if multiple messages should be marked as read in the list view.
deleteSubFolder($a_show_confirm=true)
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
renameSubFolder(\ilPropertyFormGUI $form=null)
Called if the acting user wants to rename a folder.
confirmDeleteMails()
Called if the final deletion of selected messages was confirmed by the acting user.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
performAddSubFolder()
Called if a folder is created by the action user.
const VIEWMODE_SESSION_KEY
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
parseFolderIdFromCommand(string $command)
catch(Exception $e) $message
if(isset($_POST['submit'])) $form
getSubFolderForm(string $mode='create')
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Mail Box class Base class for creating and handling mail boxes.
addSubFolderCommands(bool $isUserSubFolder=false)
special template class to simplify handling of ITX/PEAR
markMailsUnread()
Called if multiple messages should be marked as un-read in the list view.
moveMails()
Called if a single message or multiple messages should be be moved in the list view.
showFolder(bool $oneConfirmationDialogueRendered=false)
Shows current folder.
parseCommand(string $originalCommand)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
deleteMails()
Called if a single message or multiple messages should be deleted.
moveSingleMail()
Called if a single message should be be moved in the detail view.
static _lookupPref($a_usr_id, $a_keyword)
performRenameSubFolder()
Called if the folder title is renamed by the acting user.
confirmEmptyTrash()
Called if the deletion of messages in trash should be confirmed by the acting user.
performEmptyTrash()
Called if the deletion of all messages in trash was confirmed by the acting user. ...
if(empty($password)) $table
static htmlencodePlainString($a_str, $a_make_links_clickable, $a_detect_goto_links=false)
Encodes a plain text string into HTML for display in a browser.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.