ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailFolderGUI Class Reference
+ Collaboration diagram for ilMailFolderGUI:

Public Member Functions

 __construct ()
 executeCommand ()
 add ()
 cancelEmptyTrash ()
 cancel Empty Trash Action and return to folder
 performEmptyTrash ()
 empty Trash and return to folder
 askForEmptyTrash ()
 confirmation message for empty trash action
 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

Constructor & Destructor Documentation

ilMailFolderGUI::__construct ( )

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

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

{
global $tpl, $ilCtrl, $lng, $ilUser;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->umail = new ilMail($ilUser->getId());
$this->mbox = new ilMailBox($ilUser->getId());
if(isset($_POST['mobj_id']) && (int)$_POST['mobj_id'])
{
$_GET['mobj_id'] = $_POST['mobj_id'];
}
// IF THERE IS NO OBJ_ID GIVEN GET THE ID OF MAIL ROOT NODE
if(!(int)$_GET['mobj_id'])
{
$_GET['mobj_id'] = $this->mbox->getInboxFolder();
}
$_GET['mobj_id'] = (int)$_GET['mobj_id'];
$ilCtrl->saveParameter($this, 'mobj_id');
$ilCtrl->setParameter($this, 'mobj_id', $_GET['mobj_id']);
}

Member Function Documentation

ilMailFolderGUI::add ( )

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

References $_GET, $ilUser, $lng, and ilUtil\sendInfo().

{
global $lng, $ilUser;
if($_GET["mail_id"] != "")
{
if (is_array($mail_data = $this->umail->getMail($_GET["mail_id"])))
{
require_once "Services/Contact/classes/class.ilAddressbook.php";
$abook = new ilAddressbook($ilUser->getId());
$tmp_user = new ilObjUser($mail_data["sender_id"]);
if ($abook->checkEntryByLogin($tmp_user->getLogin()) > 0)
{
ilUtil::sendInfo($lng->txt("mail_entry_exists"));
}
else
{
$abook->addEntry($tmp_user->getLogin(),
$tmp_user->getFirstname(),
$tmp_user->getLastname(),
$tmp_user->getEmail());
ilUtil::sendInfo($lng->txt("mail_entry_added"));
}
}
}
$this->showMail();
}

+ Here is the call graph for this function:

ilMailFolderGUI::addSubfolderCommands (   $check_uf = false)

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

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

{
global $ilToolbar;
{
$ilToolbar->addSeparator();
}
$ilToolbar->addButton($this->lng->txt('mail_add_subfolder'), $this->ctrl->getLinkTarget($this, 'addSubFolder'));
if($check_uf == true)
{
$ilToolbar->addButton($this->lng->txt('rename'), $this->ctrl->getLinkTarget($this, 'renameSubFolder'));
$ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this, 'deleteSubFolder'));
}
return true;
}

+ Here is the call graph for this function:

ilMailFolderGUI::applyFilter ( )

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

{
$sentFolderId = $this->mbox->getSentFolder();
$draftsFolderId = $this->mbox->getDraftsFolder();
$isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder();
$isSentFolder = $_GET['mobj_id'] == $sentFolderId;
$isDraftFolder = $_GET['mobj_id'] == $draftsFolderId;
$table = new ilMailFolderTableGUI($this, (int)$_GET['mobj_id'], 'showFolder');
$table->isSentFolder($isSentFolder)
->isDraftFolder($isDraftFolder)
->isTrashFolder($isTrashFolder)
->initFilter();
$table->resetOffset();
$table->writeFilterToSession();
$this->showFolder();
}
ilMailFolderGUI::askForEmptyTrash ( )

confirmation message for empty trash action

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

References $_GET.

{
if($this->umail->countMailsOfFolder((int)$_GET['mobj_id']))
{
$this->askForConfirmation = true;
}
$this->showFolder();
return true;
}
ilMailFolderGUI::cancelDeleteMails ( )

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

{
$this->ctrl->redirect($this);
}
ilMailFolderGUI::cancelEmptyTrash ( )

cancel Empty Trash Action and return to folder

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

{
$this->showFolder();
}
ilMailFolderGUI::changeFolder ( )

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

References $_GET, and ilUtil\sendInfo().

{
switch ($this->current_selected_cmd)
{
default:
if(!(int)$_GET["mail_id"] || !(int)$this->current_selected_cmd)
{
ilUtil::sendInfo($this->lng->txt("mail_move_error"));
return $this->showMail();
}
if ($this->umail->moveMailsToFolder(array($_GET["mail_id"]), $this->current_selected_cmd))
{
ilUtil::sendInfo($this->lng->txt("mail_moved"), true);
$this->ctrl->redirectByClass("ilMailGUI");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_move_error"));
}
break;
}
$this->showMail();
return true;
}

+ Here is the call graph for this function:

ilMailFolderGUI::confirmDeleteMails ( )

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

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

{
if($this->mbox->getTrashFolder() == $_GET['mobj_id'])
{
$_POST['mail_id'] = $mail_ids = explode(',', $_GET['mail_id']);
if(!is_array($mail_ids))
{
ilUtil::sendInfo($this->lng->txt('mail_select_one'));
}
else if($this->umail->deleteMails($mail_ids))
{
$_GET['offset'] = 0;
ilUtil::sendInfo($this->lng->txt('mail_deleted'));
}
else
{
ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
}
}
$this->showFolder();
}

+ Here is the call graph for this function:

ilMailFolderGUI::deleteSubfolder (   $a_show_confirm = true)

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

{
if($a_show_confirm)
{
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$oConfirmationGUI = new ilConfirmationGUI();
// set confirm/cancel commands
$oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"showFolder"));
$oConfirmationGUI->setHeaderText($this->lng->txt("mail_sure_delete_folder"));
$oConfirmationGUI->setCancel($this->lng->txt("cancel"), "showFolder");
$oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeleteSubfolder");
$this->tpl->setVariable('CONFIRMATION',$oConfirmationGUI->getHTML());
return $this->showFolder(true);
}
else
return $this->showFolder(false);
}
ilMailFolderGUI::deliverFile ( )

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

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

{
if ($_SESSION["mail_id"])
{
$_GET["mail_id"] = $_SESSION["mail_id"];
}
$_SESSION["mail_id"] = "";
$filename = ($_SESSION["filename"]
? $_SESSION["filename"]
: ($_POST["filename"]
? $_POST["filename"]
: $_GET["filename"]));
$_SESSION["filename"] = "";
if ($filename != "")
{
require_once "./Services/Mail/classes/class.ilFileDataMail.php";
// secure filename
$filename = str_replace("..", "", $filename);
$mfile = new ilFileDataMail($_SESSION["AccountId"]);
if(!is_array($file = $mfile->getAttachmentPathByMD5Filename($filename, $_GET['mail_id'])))
{
ilUtil::sendInfo($this->lng->txt('mail_error_reading_attachment'));
$this->showMail();
}
else
{
ilUtil::deliverFile($file['path'], $file['filename']);
}
}
else
{
ilUtil::sendInfo($this->lng->txt('mail_select_attachment'));
$this->showMail();
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::editFolder ( )

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

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

{
switch ($this->current_selected_cmd)
{
case 'markMailsRead':
if(is_array($_POST["mail_id"]))
{
$this->umail->markRead($_POST["mail_id"]);
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_select_one"));
}
break;
case 'markMailsUnread':
if(is_array($_POST["mail_id"]))
{
$this->umail->markUnread($_POST["mail_id"]);
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_select_one"));
}
break;
case 'deleteMails':
// IF MAILBOX IS TRASH ASK TO CONFIRM
if($this->mbox->getTrashFolder() == $_GET["mobj_id"])
{
if(!is_array($_POST["mail_id"]))
{
ilUtil::sendInfo($this->lng->txt("mail_select_one"));
$this->errorDelete = true;
}
} // END IF MAILBOX IS TRASH FOLDER
else
{
// MOVE MAILS TO TRASH
if(!is_array($_POST["mail_id"]))
{
ilUtil::sendInfo($this->lng->txt("mail_select_one"));
}
else if($this->umail->moveMailsToFolder($_POST["mail_id"], $this->mbox->getTrashFolder()))
{
$_GET["offset"] = 0;
ilUtil::sendInfo($this->lng->txt("mail_moved_to_trash"));
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_move_error"));
}
}
break;
case 'add':
$this->ctrl->setParameterByClass("ilmailoptionsgui", "cmd", "add");
$this->ctrl->redirectByClass("ilmailoptionsgui");
case 'moveMails':
default:
if(!is_array($_POST["mail_id"]))
{
ilUtil::sendInfo($this->lng->txt("mail_select_one"));
}
else if($this->umail->moveMailsToFolder($_POST["mail_id"],$this->current_selected_cmd))
{
ilUtil::sendInfo($this->lng->txt("mail_moved"));
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_move_error"));
}
break;
}
$this->showFolder();
}

+ Here is the call graph for this function:

ilMailFolderGUI::executeCommand ( )

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

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

{
if ($_POST["select_cmd"])
{
$_GET["cmd"] = 'editFolder';
// lower menubar execute-button
$this->current_select_cmd = $_POST['select_cmd'];
$this->current_selected_cmd = $_POST['selected_cmd'];
}
else if ($_POST["select_cmd2"])
{
// upper menubar execute-button
$_GET["cmd"] = 'editFolder';
$this->current_select_cmd = $_POST['select_cmd2'];
$this->current_selected_cmd = $_POST['selected_cmd2'];
}
/* Fix: User views mail and wants to delete it...
mjansen: The mail system needs a revision :-)
*/
if ($_GET['selected_cmd'] == "deleteMails" && $_GET["mail_id"])
{
$_GET["cmd"] = "editFolder";
$this->current_selected_cmd = "deleteMails";
$_POST["mail_id"] = array($_GET["mail_id"]);
}
/* Fix: User views mail and wants to move it...
mjansen: The mail system needs a revision :-)
*/
$cmd = $this->ctrl->getCmd();
if($cmd == 'changeFolder' &&
is_numeric($_POST['selected_cmd']) &&
$_GET["mail_id"])
{
$this->current_selected_cmd = (int)$_POST['selected_cmd'];
}
$forward_class = $this->ctrl->getNextClass($this);
switch($forward_class)
{
case 'ilmailaddressbookgui':
include_once 'Services/Contact/classes/class.ilMailAddressbookGUI.php';
$this->ctrl->forwardCommand(new ilMailAddressbookGUI());
break;
case 'ilmailoptionsgui':
include_once 'Services/Mail/classes/class.ilMailOptionsGUI.php';
$this->ctrl->forwardCommand(new ilMailOptionsGUI());
break;
case 'ilpublicuserprofilegui':
include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
$this->tpl->setTitle($this->lng->txt("mail"));
$this->ctrl->saveParameter($this, "mail_id");
$profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
$profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, "showMail"));
$ret = $this->ctrl->forwardCommand($profile_gui);
if ($ret != "")
{
$this->tpl->setContent($ret);
$this->tpl->show();
}
break;
default:
if (!($cmd = $this->ctrl->getCmd()))
{
$cmd = "showFolder";
}
$this->$cmd();
break;
}
return true;
}
ilMailFolderGUI::performAddSubFolder ( )

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

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

{
if (isset($_POST["subfolder_title"]) && 'tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) $_SESSION["subfolder_title"] = ilUtil::stripSlashes($_POST['subfolder_title']);
if (empty($_POST['subfolder_title']))
{
ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"));
return $this->addSubFolder();
}
else if ($mobj_id = $this->mbox->addFolder($_GET["mobj_id"], ilUtil::stripSlashes($_POST["subfolder_title"])))
{
unset($_SESSION["subfolder_title"]);
ilUtil::sendInfo($this->lng->txt("mail_folder_created"), true);
$this->ctrl->setParameterByClass("ilMailGUI", 'mobj_id', $mobj_id);
$this->ctrl->redirectByClass("ilMailGUI");
}
else
{
ilUtil::sendFailure($this->lng->txt("mail_folder_exists"));
return $this->addSubFolder();
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::performDeleteSubFolder ( )

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

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

{
$new_parent = $this->mbox->getParentFolderId($_GET["mobj_id"]);
if ($this->mbox->deleteFolder($_GET["mobj_id"]))
{
ilUtil::sendInfo($this->lng->txt("mail_folder_deleted"),true);
$this->ctrl->setParameterByClass("ilMailGUI", "mobj_id", $new_parent);
$this->ctrl->redirectByClass("ilMailGUI");
}
else
{
ilUtil::sendFailure($this->lng->txt("mail_error_delete"));
return $this->showFolder();
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::performEmptyTrash ( )

empty Trash and return to folder

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

References $_GET, and ilUtil\sendInfo().

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

+ Here is the call graph for this function:

ilMailFolderGUI::performRenameSubFolder ( )

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

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

{
if (isset($_POST["subfolder_title"]) && 'tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) $_SESSION["subfolder_title"] = $_POST['subfolder_title'];
$tmp_data = $this->mbox->getFolderData($_GET["mobj_id"]);
if ($tmp_data["title"] != $_POST["subfolder_title"])
{
if ($_POST["subfolder_title"] == "")
{
ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"));
return $this->renameSubFolder();
}
else
{
if ($this->mbox->renameFolder($_GET["mobj_id"], ilUtil::stripSlashes($_POST["subfolder_title"])))
{
ilUtil::sendInfo($this->lng->txt("mail_folder_name_changed"), true);
unset($_SESSION["subfolder_title"]);
$this->ctrl->redirectByClass("ilMailGUI");
}
else
{
ilUtil::sendFailure($this->lng->txt("mail_folder_exists"));
return $this->renameSubFolder();
}
}
}
return $this->showFolder();
}

+ Here is the call graph for this function:

ilMailFolderGUI::resetFilter ( )

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

{
$sentFolderId = $this->mbox->getSentFolder();
$draftsFolderId = $this->mbox->getDraftsFolder();
$isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder();
$isSentFolder = $_GET['mobj_id'] == $sentFolderId;
$isDraftFolder = $_GET['mobj_id'] == $draftsFolderId;
$table = new ilMailFolderTableGUI($this, (int)$_GET['mobj_id'], 'showFolder');
$table->isSentFolder($isSentFolder)
->isDraftFolder($isDraftFolder)
->isTrashFolder($isTrashFolder)
->initFilter();
$table->resetOffset();
$table->resetFilter();
$this->showFolder();
}
ilMailFolderGUI::showUser ( )

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

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

{
global $ilCtrl, $ilToolbar;
$this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
$this->tpl->setTitle($this->lng->txt("mail"));
//$ilToolbar->addButton($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "showMail"));
$this->tpl->setVariable("TBL_TITLE", $this->lng->txt("profile_of")." ".
$this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath("icon_usr.png"));
$this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt("public_profile"));
include_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
$profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
$profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, "showMail"));
$this->tpl->setContent($ilCtrl->getHTML($profile_gui));
$this->tpl->show();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilMailFolderGUI::$ctrl = null
private

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

ilMailFolderGUI::$current_select_cmd
private

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

ilMailFolderGUI::$current_selected_cmd
private

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

ilMailFolderGUI::$errorDelete = false
private

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

ilMailFolderGUI::$lng = null
private

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

Referenced by __construct(), and add().

ilMailFolderGUI::$mbox = null

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

ilMailFolderGUI::$tpl = null
private

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

Referenced by __construct().

ilMailFolderGUI::$umail = null

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


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