ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMailFolderGUI Class Reference
+ Collaboration diagram for ilMailFolderGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 cancelEmptyTrash ()
 cancel Empty Trash Action and return to folder More...
 
 performEmptyTrash ()
 empty Trash and return to folder More...
 
 askForEmptyTrash ()
 confirmation message for empty trash action More...
 
 showUser ()
 
 addSubfolderCommands ($check_uf=false)
 
 deleteSubfolder ($a_show_confirm=true)
 
 performDeleteSubFolder ()
 
 performAddSubFolder ()
 
 performRenameSubFolder ()
 
 changeFolder ()
 
 editFolder ()
 
 confirmDeleteMails ()
 
 cancelDeleteMails ()
 
 deliverFile ()
 
 applyFilter ()
 
 resetFilter ()
 

Data Fields

 $umail = null
 
 $mbox = null
 

Private Attributes

 $current_select_cmd
 
 $current_selected_cmd
 
 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $errorDelete = false
 

Detailed Description

Author
Jens Conze
Version
$Id$

@ilCtrl_Calls ilMailFolderGUI: ilMailOptionsGUI, ilMailAttachmentGUI, ilMailSearchGUI @ilCtrl_Calls ilMailFolderGUI: ilPublicUserProfileGUI

Definition at line 19 of file class.ilMailFolderGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailFolderGUI::__construct ( )

Definition at line 33 of file class.ilMailFolderGUI.php.

34 {
35 global $tpl, $ilCtrl, $lng, $ilUser;
36
37 $this->tpl = $tpl;
38 $this->ctrl = $ilCtrl;
39 $this->lng = $lng;
40
41 $this->umail = new ilMail($ilUser->getId());
42 $this->mbox = new ilMailBox($ilUser->getId());
43
44 if(isset($_POST['mobj_id']) && (int)$_POST['mobj_id'])
45 {
46 $_GET['mobj_id'] = $_POST['mobj_id'];
47 }
48 // IF THERE IS NO OBJ_ID GIVEN GET THE ID OF MAIL ROOT NODE
49 if(!(int)$_GET['mobj_id'])
50 {
51 $_GET['mobj_id'] = $this->mbox->getInboxFolder();
52 }
53 $_GET['mobj_id'] = (int)$_GET['mobj_id'];
54 $ilCtrl->saveParameter($this, 'mobj_id');
55 $ilCtrl->setParameter($this, 'mobj_id', $_GET['mobj_id']);
56
57 }
$_GET["client_id"]
Class Mail this class handles base functions for mail handling.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

References $_GET, $_POST, $ilCtrl, $ilUser, $lng, and $tpl.

Member Function Documentation

◆ addSubfolderCommands()

ilMailFolderGUI::addSubfolderCommands (   $check_uf = false)

Definition at line 193 of file class.ilMailFolderGUI.php.

194 {
195 global $ilToolbar;
196
198 {
199 $ilToolbar->addSeparator();
200 }
201
202 $ilToolbar->addButton($this->lng->txt('mail_add_subfolder'), $this->ctrl->getLinkTarget($this, 'addSubFolder'));
203
204 if($check_uf == true)
205 {
206 $ilToolbar->addButton($this->lng->txt('rename'), $this->ctrl->getLinkTarget($this, 'renameSubFolder'));
207 $ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this, 'deleteSubFolder'));
208 }
209 return true;
210 }
const VIEWMODE_SESSION_KEY
static get($a_var)
Get a value.

References ilSession\get(), and ilMailGUI\VIEWMODE_SESSION_KEY.

+ Here is the call graph for this function:

◆ applyFilter()

ilMailFolderGUI::applyFilter ( )

Definition at line 1006 of file class.ilMailFolderGUI.php.

1007 {
1008 $sentFolderId = $this->mbox->getSentFolder();
1009 $draftsFolderId = $this->mbox->getDraftsFolder();
1010
1011 $isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder();
1012 $isSentFolder = $_GET['mobj_id'] == $sentFolderId;
1013 $isDraftFolder = $_GET['mobj_id'] == $draftsFolderId;
1014
1015 $table = new ilMailFolderTableGUI($this, (int)$_GET['mobj_id'], 'showFolder');
1016 $table->isSentFolder($isSentFolder)
1017 ->isDraftFolder($isDraftFolder)
1018 ->isTrashFolder($isTrashFolder)
1019 ->initFilter();
1020 $table->resetOffset();
1021 $table->writeFilterToSession();
1022
1023 $this->showFolder();
1024 }

References $_GET.

◆ askForEmptyTrash()

ilMailFolderGUI::askForEmptyTrash ( )

confirmation message for empty trash action

Definition at line 158 of file class.ilMailFolderGUI.php.

159 {
160 if($this->umail->countMailsOfFolder((int)$_GET['mobj_id']))
161 {
162 $this->askForConfirmation = true;
163 }
164
165 $this->showFolder();
166
167 return true;
168 }

References $_GET.

◆ cancelDeleteMails()

ilMailFolderGUI::cancelDeleteMails ( )

Definition at line 658 of file class.ilMailFolderGUI.php.

659 {
660 $this->ctrl->redirect($this);
661 }

◆ cancelEmptyTrash()

ilMailFolderGUI::cancelEmptyTrash ( )

cancel Empty Trash Action and return to folder

Definition at line 140 of file class.ilMailFolderGUI.php.

141 {
142 $this->showFolder();
143 }

◆ changeFolder()

ilMailFolderGUI::changeFolder ( )

Definition at line 526 of file class.ilMailFolderGUI.php.

527 {
528 switch ($this->current_selected_cmd)
529 {
530 default:
531 if(!(int)$_GET["mail_id"] || !(int)$this->current_selected_cmd)
532 {
533 ilUtil::sendInfo($this->lng->txt("mail_move_error"));
534 return $this->showMail();
535 }
536
537 if ($this->umail->moveMailsToFolder(array($_GET["mail_id"]), $this->current_selected_cmd))
538 {
539 ilUtil::sendInfo($this->lng->txt("mail_moved"), true);
540 $this->ctrl->redirectByClass("ilMailGUI");
541 }
542 else
543 {
544 ilUtil::sendInfo($this->lng->txt("mail_move_error"));
545 }
546 break;
547 }
548
549 $this->showMail();
550
551 return true;
552 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ confirmDeleteMails()

ilMailFolderGUI::confirmDeleteMails ( )

Definition at line 635 of file class.ilMailFolderGUI.php.

636 {
637 if($this->mbox->getTrashFolder() == $_GET['mobj_id'])
638 {
639 $_POST['mail_id'] = $mail_ids = explode(',', $_GET['mail_id']);
640 if(!is_array($mail_ids))
641 {
642 ilUtil::sendInfo($this->lng->txt('mail_select_one'));
643 }
644 else if($this->umail->deleteMails($mail_ids))
645 {
646 $_GET['offset'] = 0;
647 ilUtil::sendInfo($this->lng->txt('mail_deleted'));
648 }
649 else
650 {
651 ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
652 }
653 }
654
655 $this->showFolder();
656 }

References $_GET, $_POST, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ deleteSubfolder()

ilMailFolderGUI::deleteSubfolder (   $a_show_confirm = true)

Definition at line 369 of file class.ilMailFolderGUI.php.

370 {
371 if($a_show_confirm)
372 {
373 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
374 $oConfirmationGUI = new ilConfirmationGUI();
375
376 // set confirm/cancel commands
377 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"showFolder"));
378 $oConfirmationGUI->setHeaderText($this->lng->txt("mail_sure_delete_folder"));
379 $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "showFolder");
380 $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeleteSubfolder");
381 $this->tpl->setVariable('CONFIRMATION',$oConfirmationGUI->getHTML());
382
383 return $this->showFolder(true);
384 }
385 else
386 return $this->showFolder(false);
387 }
Confirmation screen class.

◆ deliverFile()

ilMailFolderGUI::deliverFile ( )

Definition at line 963 of file class.ilMailFolderGUI.php.

964 {
965 if ($_SESSION["mail_id"])
966 {
967 $_GET["mail_id"] = $_SESSION["mail_id"];
968 }
969 $_SESSION["mail_id"] = "";
970
971 $filename = ($_SESSION["filename"]
972 ? $_SESSION["filename"]
973 : ($_POST["filename"]
974 ? $_POST["filename"]
975 : $_GET["filename"]));
976 $_SESSION["filename"] = "";
977
978 if ($filename != "")
979 {
980 require_once "./Services/Mail/classes/class.ilFileDataMail.php";
981
982 // secure filename
983 $filename = str_replace("..", "", $filename);
984
985 $mfile = new ilFileDataMail($_SESSION["AccountId"]);
986 if(!is_array($file = $mfile->getAttachmentPathByMD5Filename($filename, $_GET['mail_id'])))
987 {
988 ilUtil::sendInfo($this->lng->txt('mail_error_reading_attachment'));
989 $this->showMail();
990 }
991 else
992 {
993 ilUtil::deliverFile($file['path'], $file['filename']);
994 }
995 }
996 else
997 {
998 ilUtil::sendInfo($this->lng->txt('mail_select_attachment'));
999 $this->showMail();
1000 }
1001 }
print $file
$filename
Definition: buildRTE.php:89
$_SESSION["AccountId"]
This class handles all operations on files (attachments) in directory ilias_data/mail.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.

References $_GET, $_POST, $_SESSION, $file, $filename, ilUtil\deliverFile(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ editFolder()

ilMailFolderGUI::editFolder ( )

Definition at line 554 of file class.ilMailFolderGUI.php.

555 {
556 switch ($this->current_selected_cmd)
557 {
558 case 'markMailsRead':
559 if(is_array($_POST["mail_id"]))
560 {
561 $this->umail->markRead($_POST["mail_id"]);
562 }
563 else
564 {
565 ilUtil::sendInfo($this->lng->txt("mail_select_one"));
566 }
567 break;
568 case 'markMailsUnread':
569 if(is_array($_POST["mail_id"]))
570 {
571 $this->umail->markUnread($_POST["mail_id"]);
572 }
573 else
574 {
575 ilUtil::sendInfo($this->lng->txt("mail_select_one"));
576 }
577 break;
578
579 case 'deleteMails':
580 // IF MAILBOX IS TRASH ASK TO CONFIRM
581 if($this->mbox->getTrashFolder() == $_GET["mobj_id"])
582 {
583 if(!is_array($_POST["mail_id"]))
584 {
585 ilUtil::sendInfo($this->lng->txt("mail_select_one"));
586 $this->errorDelete = true;
587 }
588 } // END IF MAILBOX IS TRASH FOLDER
589 else
590 {
591 // MOVE MAILS TO TRASH
592 if(!is_array($_POST["mail_id"]))
593 {
594 ilUtil::sendInfo($this->lng->txt("mail_select_one"));
595 }
596 else if($this->umail->moveMailsToFolder($_POST["mail_id"], $this->mbox->getTrashFolder()))
597 {
598 $_GET["offset"] = 0;
599 ilUtil::sendInfo($this->lng->txt("mail_moved_to_trash"));
600 }
601 else
602 {
603 ilUtil::sendInfo($this->lng->txt("mail_move_error"));
604 }
605 }
606 break;
607
608 case 'add':
609 $this->ctrl->setParameterByClass("ilmailoptionsgui", "cmd", "add");
610 $this->ctrl->redirectByClass("ilmailoptionsgui");
611
612 case 'moveMails':
613 default:
614 if(!is_array($_POST["mail_id"]))
615 {
616 ilUtil::sendInfo($this->lng->txt("mail_select_one"));
617 }
618 else if($this->umail->moveMailsToFolder($_POST["mail_id"],$this->current_selected_cmd))
619 {
620 ilUtil::sendInfo($this->lng->txt("mail_moved"));
621 }
622 else
623 {
624 ilUtil::sendInfo($this->lng->txt("mail_move_error"));
625 }
626 break;
627 }
628
629 $this->showFolder();
630 }

References $_GET, $_POST, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ executeCommand()

ilMailFolderGUI::executeCommand ( )

Definition at line 59 of file class.ilMailFolderGUI.php.

60 {
61 if ($_POST["select_cmd"])
62 {
63 $_GET["cmd"] = 'editFolder';
64
65 // lower menubar execute-button
66 $this->current_select_cmd = $_POST['select_cmd'];
67 $this->current_selected_cmd = $_POST['selected_cmd'];
68 }
69 else if ($_POST["select_cmd2"])
70 {
71 // upper menubar execute-button
72 $_GET["cmd"] = 'editFolder';
73 $this->current_select_cmd = $_POST['select_cmd2'];
74 $this->current_selected_cmd = $_POST['selected_cmd2'];
75 }
76
77 /* Fix: User views mail and wants to delete it...
78 mjansen: The mail system needs a revision :-)
79 */
80 if ($_GET['selected_cmd'] == "deleteMails" && $_GET["mail_id"])
81 {
82 $_GET["cmd"] = "editFolder";
83 $this->current_selected_cmd = "deleteMails";
84 $_POST["mail_id"] = array($_GET["mail_id"]);
85 }
86
87 /* Fix: User views mail and wants to move it...
88 mjansen: The mail system needs a revision :-)
89 */
90 $cmd = $this->ctrl->getCmd();
91 if($cmd == 'changeFolder' &&
92 is_numeric($_POST['selected_cmd']) &&
93 $_GET["mail_id"])
94 {
95 $this->current_selected_cmd = (int)$_POST['selected_cmd'];
96 }
97
98 $forward_class = $this->ctrl->getNextClass($this);
99 switch($forward_class)
100 {
101 case 'ilcontactgui':
102 require_once 'Services/Contact/classes/class.ilContactGUI.php';
103 $this->ctrl->forwardCommand(new ilContactGUI());
104 break;
105
106 case 'ilmailoptionsgui':
107 include_once 'Services/Mail/classes/class.ilMailOptionsGUI.php';
108
109 $this->ctrl->forwardCommand(new ilMailOptionsGUI());
110 break;
111
112 case 'ilpublicuserprofilegui':
113 include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
114 $this->tpl->setTitle($this->lng->txt("mail"));
115 $this->ctrl->saveParameter($this, "mail_id");
116 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
117 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, "showMail"));
118 $ret = $this->ctrl->forwardCommand($profile_gui);
119 if ($ret != "")
120 {
121 $this->tpl->setContent($ret);
122 $this->tpl->show();
123 }
124 break;
125
126 default:
127 if (!($cmd = $this->ctrl->getCmd()))
128 {
129 $cmd = "showFolder";
130 }
131 $this->$cmd();
132 break;
133 }
134 return true;
135 }
GUI class for public user profile presentation.
$cmd
Definition: sahs_server.php:35

References $_GET, $_POST, $cmd, and $ret.

◆ performAddSubFolder()

ilMailFolderGUI::performAddSubFolder ( )

Definition at line 406 of file class.ilMailFolderGUI.php.

407 {
408 if (isset($_POST["subfolder_title"]) && 'tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) $_SESSION["subfolder_title"] = ilUtil::stripSlashes($_POST['subfolder_title']);
409
410 if (empty($_POST['subfolder_title']))
411 {
412 ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"));
413 return $this->addSubFolder();
414 }
415 else if ($mobj_id = $this->mbox->addFolder($_GET["mobj_id"], ilUtil::stripSlashes($_POST["subfolder_title"])))
416 {
417 unset($_SESSION["subfolder_title"]);
418 ilUtil::sendInfo($this->lng->txt("mail_folder_created"), true);
419
420 $this->ctrl->setParameterByClass("ilMailGUI", 'mobj_id', $mobj_id);
421 $this->ctrl->redirectByClass("ilMailGUI");
422 }
423 else
424 {
425 ilUtil::sendFailure($this->lng->txt("mail_folder_exists"));
426 $this->addSubFolder();
427 return;
428 }
429 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_GET, $_POST, $_SESSION, ilSession\get(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilUtil\stripSlashes(), and ilMailGUI\VIEWMODE_SESSION_KEY.

+ Here is the call graph for this function:

◆ performDeleteSubFolder()

ilMailFolderGUI::performDeleteSubFolder ( )

Definition at line 389 of file class.ilMailFolderGUI.php.

390 {
391 $new_parent = $this->mbox->getParentFolderId((int)$_GET['mobj_id']);
392 if($this->mbox->deleteFolder((int)$_GET['mobj_id']))
393 {
394 ilUtil::sendInfo($this->lng->txt('mail_folder_deleted'), true);
395 $this->ctrl->setParameterByClass('ilMailGUI', 'mobj_id', (int)$new_parent);
396 $this->ctrl->redirectByClass('ilMailGUI');
397 }
398 else
399 {
400 ilUtil::sendFailure($this->lng->txt('mail_error_delete'));
401 $this->showFolder();
402 return;
403 }
404 }

References $_GET, ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ performEmptyTrash()

ilMailFolderGUI::performEmptyTrash ( )

empty Trash and return to folder

Definition at line 148 of file class.ilMailFolderGUI.php.

149 {
150 $this->umail->deleteMailsOfFolder($_GET['mobj_id']);
151 ilUtil::sendInfo($this->lng->txt('mail_deleted'));
152 $this->showFolder();
153 }

References $_GET, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ performRenameSubFolder()

ilMailFolderGUI::performRenameSubFolder ( )

Definition at line 496 of file class.ilMailFolderGUI.php.

497 {
498 if (isset($_POST["subfolder_title"]) && 'tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) $_SESSION["subfolder_title"] = $_POST['subfolder_title'];
499
500 $tmp_data = $this->mbox->getFolderData($_GET["mobj_id"]);
501 if ($tmp_data["title"] != $_POST["subfolder_title"])
502 {
503 if ($_POST["subfolder_title"] == "")
504 {
505 ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"));
506 return $this->renameSubFolder();
507 }
508 else
509 {
510 if ($this->mbox->renameFolder($_GET["mobj_id"], ilUtil::stripSlashes($_POST["subfolder_title"])))
511 {
512 ilUtil::sendInfo($this->lng->txt("mail_folder_name_changed"), true);
513 unset($_SESSION["subfolder_title"]);
514 $this->ctrl->redirectByClass("ilMailGUI");
515 }
516 else
517 {
518 ilUtil::sendFailure($this->lng->txt("mail_folder_exists"));
519 return $this->renameSubFolder();
520 }
521 }
522 }
523 return $this->showFolder();
524 }

References $_GET, $_POST, $_SESSION, ilSession\get(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilUtil\stripSlashes(), and ilMailGUI\VIEWMODE_SESSION_KEY.

+ Here is the call graph for this function:

◆ resetFilter()

ilMailFolderGUI::resetFilter ( )

Definition at line 1029 of file class.ilMailFolderGUI.php.

1030 {
1031 $sentFolderId = $this->mbox->getSentFolder();
1032 $draftsFolderId = $this->mbox->getDraftsFolder();
1033
1034 $isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder();
1035 $isSentFolder = $_GET['mobj_id'] == $sentFolderId;
1036 $isDraftFolder = $_GET['mobj_id'] == $draftsFolderId;
1037
1038 $table = new ilMailFolderTableGUI($this, (int)$_GET['mobj_id'], 'showFolder');
1039 $table->isSentFolder($isSentFolder)
1040 ->isDraftFolder($isDraftFolder)
1041 ->isTrashFolder($isTrashFolder)
1042 ->initFilter();
1043 $table->resetOffset();
1044 $table->resetFilter();
1045
1046 $this->showFolder();
1047 }

References $_GET.

◆ showUser()

ilMailFolderGUI::showUser ( )

Definition at line 170 of file class.ilMailFolderGUI.php.

171 {
172 global $ilCtrl, $ilToolbar;
173
174 $this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
175
176 $this->tpl->setTitle($this->lng->txt("mail"));
177 //$ilToolbar->addButton($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "showMail"));
178
179 $this->tpl->setVariable("TBL_TITLE", $this->lng->txt("profile_of")." ".
181 $this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath("icon_usr.svg"));
182 $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt("public_profile"));
183
184 include_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
185 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
186 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, "showMail"));
187 $this->tpl->setContent($ilCtrl->getHTML($profile_gui));
188 $this->tpl->show();
189
190 return true;
191 }
static _lookupLogin($a_user_id)
lookup login
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $_GET, $ilCtrl, ilObjUser\_lookupLogin(), and ilUtil\getImagePath().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilMailFolderGUI::$ctrl = null
private

Definition at line 25 of file class.ilMailFolderGUI.php.

◆ $current_select_cmd

ilMailFolderGUI::$current_select_cmd
private

Definition at line 21 of file class.ilMailFolderGUI.php.

◆ $current_selected_cmd

ilMailFolderGUI::$current_selected_cmd
private

Definition at line 22 of file class.ilMailFolderGUI.php.

◆ $errorDelete

ilMailFolderGUI::$errorDelete = false
private

Definition at line 31 of file class.ilMailFolderGUI.php.

◆ $lng

ilMailFolderGUI::$lng = null
private

Definition at line 26 of file class.ilMailFolderGUI.php.

Referenced by __construct().

◆ $mbox

ilMailFolderGUI::$mbox = null

Definition at line 29 of file class.ilMailFolderGUI.php.

◆ $tpl

ilMailFolderGUI::$tpl = null
private

Definition at line 24 of file class.ilMailFolderGUI.php.

Referenced by __construct().

◆ $umail

ilMailFolderGUI::$umail = null

Definition at line 28 of file class.ilMailFolderGUI.php.


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