ILIAS  Release_4_0_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 ()
 showFolder ()
 Shows current folder.
 deleteFolder ()
 confirmDeleteFolder ()
 performDeleteFolder ()
 cancelDeleteFolder ()
 cancelEnterFolderData ()
 saveFolderSettings ()
 saveSubFolderSettings ()
 addSubFolder ()
 enterFolderData ($cmd="saveFolderSettings", $confirmDelete=false)
 changeFolder ()
 editFolder ()
 confirmDeleteMails ()
 cancelDeleteMails ()
 showMail ()
 printMail ()
 deliverFile ()

Data Fields

 $umail = null
 $mbox = null

Private Attributes

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

Detailed Description

Constructor & Destructor Documentation

ilMailFolderGUI::__construct ( )

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

References $_GET, $_POST, $ilCtrl, $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();
}
$ilCtrl->saveParameter($this, 'mobj_id');
$ilCtrl->setParameter($this, 'mobj_id', $_GET['mobj_id']);
}

Member Function Documentation

ilMailFolderGUI::add ( )

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

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

{
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::addSubFolder ( )

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

References enterFolderData().

Referenced by saveSubFolderSettings().

{
$this->enterFolderData("saveSubFolderSettings");
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailFolderGUI::askForEmptyTrash ( )

confirmation message for empty trash action

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

References $_GET, ilUtil\sendQuestion(), and showFolder().

{
if($this->umail->countMailsOfFolder((int)$_GET['mobj_id']))
{
ilUtil::sendQuestion($this->lng->txt('mail_empty_trash_confirmation'));
$this->askForConfirmation = true;
}
$this->showFolder();
return true;
}

+ Here is the call graph for this function:

ilMailFolderGUI::cancelDeleteFolder ( )

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

References $_GET, $_SESSION, enterFolderData(), and ilUtil\redirect().

{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=enter_folderdata");
}
else
{
$this->enterFolderData();
return true;
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::cancelDeleteMails ( )

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

{
//$this->ctrl->setParameter($this, "offset", $_GET["offset"]);
$this->ctrl->redirect($this);
}
ilMailFolderGUI::cancelEmptyTrash ( )

cancel Empty Trash Action and return to folder

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

References showFolder().

{
$this->showFolder();
}

+ Here is the call graph for this function:

ilMailFolderGUI::cancelEnterFolderData ( )

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

References $_GET, $_SESSION, ilUtil\redirect(), and showFolder().

{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&target=ilmailfoldergui");
}
else
{
$this->showFolder();
return true;
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::changeFolder ( )

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

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

{
switch ($_POST["selected_cmd"])
{
default:
if(!(int)$_GET["mail_id"] || !(int)$_POST["selected_cmd"])
{
ilUtil::sendInfo($this->lng->txt("mail_move_error"));
return $this->showMail();
}
if ($this->umail->moveMailsToFolder(array($_GET["mail_id"]), $_POST["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::confirmDeleteFolder ( )

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

References enterFolderData(), and ilUtil\sendInfo().

{
ilUtil::sendInfo($this->lng->txt("mail_sure_delete_folder"));
$this->enterFolderData("saveFolderSettings", true);
return true;
}

+ Here is the call graph for this function:

ilMailFolderGUI::confirmDeleteMails ( )

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

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

{
// ONLY IF FOLDER IS TRASH, IT WAS ASKED FOR CONFIRMATION
if($this->mbox->getTrashFolder() == $_GET["mobj_id"])
{
if(!is_array($_POST["mail_id"]))
{
ilUtil::sendInfo($this->lng->txt("mail_select_one"));
}
else if($this->umail->deleteMails($_POST["mail_id"]))
{
$_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::deleteFolder ( )

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

References $_GET, $_SESSION, enterFolderData(), ilUtil\redirect(), and ilUtil\sendInfo().

{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=confirmdelete_folderdata");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_sure_delete_folder"));
$this->enterFolderData("saveFolderSettings", true);
return true;
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::deliverFile ( )

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

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

{
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 "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 599 of file class.ilMailFolderGUI.php.

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

{
switch ($_POST["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;
}
else
{
ilUtil::sendQuestion($this->lng->txt("mail_sure_delete"));
}
} // 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"],$_POST["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::enterFolderData (   $cmd = "saveFolderSettings",
  $confirmDelete = false 
)

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

References $_GET, $_POST, $_SESSION, $cmd, ilFrameTargetInfo\_getFrame(), ilUtil\prepareFormOutput(), ilTree\setTableNames(), and ilUtil\stripSlashes().

Referenced by addSubFolder(), cancelDeleteFolder(), confirmDeleteFolder(), deleteFolder(), performDeleteFolder(), saveFolderSettings(), and saveSubFolderSettings().

{
global $ilUser;
$mtree = new ilTree($ilUser->getId());
$mtree->setTableNames('mail_tree','mail_obj_data');
$folder_node = $mtree->getNodeData($_GET[mobj_id]);
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_edit_user_folder.html",'Services/Mail');
if ($confirmDelete)
{
$this->tpl->setCurrentBlock("confirm_delete");
$this->ctrl->setParameter($this, "cmd", "post");
$this->tpl->setVariable("ACTION_DELETE", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("FRAME_DELETE", ilFrameTargetInfo::_getFrame("MainContent"));
$this->ctrl->clearParameters($this);
$this->tpl->setVariable("TXT_DELETE_CONFIRM",$this->lng->txt("confirm"));
$this->tpl->setVariable("TXT_DELETE_CANCEL",$this->lng->txt("cancel"));
$this->tpl->parseCurrentBlock();
}
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("FRAME_ADD", ilFrameTargetInfo::_getFrame("MainContent"));
if ($cmd == "saveFolderSettings")
{
$this->tpl->setVariable("TXT_HEADLINE", $this->lng->txt('mail_folder_edit'));
$this->tpl->setVariable("TXT_TITLE", $this->lng->txt('name'));
$this->tpl->setVariable("TXT_DELETE", $this->lng->txt('delete'));
if (isset($_SESSION["folder_name_add"])) $title_value = ilUtil::prepareFormOutput($_SESSION["folder_name_add"], true);
else if (isset($_POST["folder_name_add"])) $title_value = ilUtil::prepareFormOutput($_POST["folder_name_add"], true);
else $title_value = ilUtil::stripSlashes($folder_node["title"]);
}
else
{
$this->tpl->setVariable("TXT_HEADLINE", $this->lng->txt('mail_add_subfolder'));
$this->tpl->setVariable("TXT_TITLE", $this->lng->txt('name'));
if (isset($_SESSION["folder_name_add"])) $title_value = ilUtil::prepareFormOutput($_SESSION["folder_name_add"], true);
else if (isset($_POST["folder_name_add"])) $title_value = ilUtil::prepareFormOutput($_POST["folder_name_add"], true);
}
unset($_SESSION["folder_name_add"]);
$this->tpl->setVariable("CMD_SUBMIT", $cmd);
$this->tpl->setVariable("TXT_SUBMIT", ($cmd == "saveSubFolderSettings" ? $this->lng->txt('save') : $this->lng->txt('rename')));
$this->tpl->setVariable("TITLE_VALUE", $title_value);
$this->tpl->setVariable("TXT_CANCEL", $this->lng->txt('cancel'));
$this->tpl->setVariable("HEADER", $this->lng->txt("mail"));
$this->tpl->show();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailFolderGUI::executeCommand ( )

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

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

{
if ($_POST["select_cmd"])
{
$_GET["cmd"] = 'editFolder';
}
/* User views mail and wants to delete it */
if ($_GET["selected_cmd"] == "deleteMails" && $_GET["mail_id"])
{
$_GET["cmd"] = "editFolder";
$_POST["selected_cmd"] = "deleteMails";
$_POST["mail_id"] = array($_GET["mail_id"]);
}
$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");
$profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
$ret = $this->ctrl->forwardCommand($profile_gui);
break;
default:
if (!($cmd = $this->ctrl->getCmd()))
{
$cmd = "showFolder";
}
$this->$cmd();
break;
}
return true;
}
ilMailFolderGUI::performDeleteFolder ( )

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

References $_GET, $_SESSION, enterFolderData(), ilUtil\redirect(), 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);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI");
}
else
{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::sendInfo($this->lng->txt("mail_error_delete"), true);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=confirmdelete_folderdata");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_error_delete"));
$this->enterFolderData();
return true;
}
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::performEmptyTrash ( )

empty Trash and return to folder

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

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

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

+ Here is the call graph for this function:

ilMailFolderGUI::printMail ( )

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

References $_GET, $login, $tpl, ilMail\_getAnonymousName(), ilDatePresentation\formatDate(), and IL_CAL_DATETIME.

{
$tplprint = new ilTemplate("Services/Mail/templates/default/tpl.mail_print.html",true,true,true);
$tplprint->setVariable("JSPATH",$tpl->tplPath);
//get the mail from user
$mailData = $this->umail->getMail($_GET["mail_id"]);
// SET MAIL DATA
// FROM
if($mailData["sender_id"] != ANONYMOUS_USER_ID)
{
$tmp_user = new ilObjUser($mailData["sender_id"]);
if(!($login = $tmp_user->getFullname()))
{
$login = $mailData["import_name"]." (".$this->lng->txt("user_deleted").")";
}
$tplprint->setVariable("FROM", $login);
}
else
{
$tplprint->setVariable('FROM', ilMail::_getAnonymousName());
}
$tplprint->setVariable('TXT_FROM', $this->lng->txt('from'));
// TO
$tplprint->setVariable("TXT_TO", $this->lng->txt("mail_to"));
$tplprint->setVariable("TO", $mailData["rcp_to"]);
// CC
if($mailData["rcp_cc"])
{
$tplprint->setCurrentBlock("cc");
$tplprint->setVariable("TXT_CC",$this->lng->txt("cc"));
$tplprint->setVariable("CC",$mailData["rcp_cc"]);
$tplprint->parseCurrentBlock();
}
// SUBJECT
$tplprint->setVariable("TXT_SUBJECT",$this->lng->txt("subject"));
$tplprint->setVariable("SUBJECT",htmlspecialchars($mailData["m_subject"]));
// DATE
$tplprint->setVariable("TXT_DATE", $this->lng->txt("date"));
$tplprint->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($mailData["send_time"],IL_CAL_DATETIME)));
// MESSAGE
$tplprint->setVariable("TXT_MESSAGE", $this->lng->txt("message"));
$tplprint->setVariable("MAIL_MESSAGE", nl2br(htmlspecialchars($mailData["m_message"])));
$tplprint->show();
}

+ Here is the call graph for this function:

ilMailFolderGUI::saveFolderSettings ( )

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

References $_GET, $_POST, $_SESSION, enterFolderData(), ilUtil\redirect(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

{
if (isset($_POST["folder_name_add"]) && $_SESSION["viewmode"] == "tree") $_SESSION["folder_name_add"] = $_POST['folder_name_add'];
$tmp_data = $this->mbox->getFolderData($_GET["mobj_id"]);
if ($tmp_data["title"] != $_POST["folder_name_add"])
{
if ($_POST["folder_name_add"] == "")
{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"), true);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=enter_folderdata");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"));
$this->enterFolderData();
return true;
}
}
else
{
if ($this->mbox->renameFolder($_GET["mobj_id"], ilUtil::stripSlashes($_POST["folder_name_add"])))
{
ilUtil::sendInfo($this->lng->txt("mail_folder_name_changed"), true);
unset($_SESSION["folder_name_add"]);
}
else
{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::sendInfo($this->lng->txt("mail_folder_exists"), true);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=enter_folderdata");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_folder_exists"));
$this->enterFolderData();
return true;
}
}
}
}
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=enter_folderdata");
}
else
{
$this->enterFolderData();
return true;
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::saveSubFolderSettings ( )

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

References $_GET, $_POST, $_SESSION, $ilCtrl, addSubFolder(), enterFolderData(), ilUtil\redirect(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

{
global $ilCtrl;
if (isset($_POST["folder_name_add"]) && $_SESSION["viewmode"] == "tree") $_SESSION["folder_name_add"] = ilUtil::stripSlashes($_POST['folder_name_add']);
if (empty($_POST['folder_name_add']))
{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"), true);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=add_subfolder");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_insert_folder_name"));
$this->addSubFolder();
return true;
}
}
else if ($_GET["mobj_id"] = $this->mbox->addFolder($_GET["mobj_id"], ilUtil::stripSlashes($_POST["folder_name_add"])))
{
$ilCtrl->saveParameter($this, 'mobj_id');
$ilCtrl->setParameter($this, 'mobj_id', $_GET['mobj_id']);
unset($_SESSION["folder_name_add"]);
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::sendInfo($this->lng->txt("mail_folder_created"), true);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]);
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_folder_created"));
$this->enterFolderData();
return true;
}
}
else
{
if ($_SESSION["viewmode"] == "tree")
{
ilUtil::sendInfo($this->lng->txt("mail_folder_exists"), true);
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$_GET["mobj_id"]."&type=add_subfolder");
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_folder_exists"));
$this->addSubFolder();
return true;
}
}
}

+ Here is the call graph for this function:

ilMailFolderGUI::showFolder ( )

Shows current folder.

Current Folder is determined by $_GET["mobj_id"]

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

References $_GET, $_POST, $_SESSION, and ilTree\setTableNames().

Referenced by askForEmptyTrash(), cancelEmptyTrash(), cancelEnterFolderData(), confirmDeleteMails(), editFolder(), and performEmptyTrash().

{
global $ilUser;
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail.html', 'Services/Mail');
$this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
include_once 'Services/Mail/classes/class.ilMailFolderTableGUI.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;
// BEGIN CONFIRM_DELETE
if($_POST['selected_cmd'] == 'deleteMails' &&
!$this->errorDelete &&
$_POST['selected_cmd'] != 'confirm' &&
$isTrashFolder)
{
if(isset($_REQUEST['mail_id']) && !is_array($_REQUEST['mail_id'])) $_REQUEST['mail_id'] = array($_REQUEST['mail_id']);
foreach((array)$_REQUEST['mail_id'] as $id)
{
$this->tpl->setCurrentBlock('mail_ids');
$this->tpl->setVariable('MAIL_ID_VALUE', $id);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock('confirm_delete');
$this->tpl->setVariable('ACTION', $this->ctrl->getFormAction($this, 'confirmDeleteMails'));
$this->tpl->setVariable('BUTTON_CONFIRM',$this->lng->txt('confirm'));
$this->tpl->setVariable('BUTTON_CANCEL',$this->lng->txt('cancel'));
$this->tpl->parseCurrentBlock();
}
$mailtable = new ilMailFolderTableGUI($this, (int)$_GET['mobj_id'], 'showFolder');
$mailtable->isSentFolder($isSentFolder)
->isDraftFolder($isDraftFolder)
->isTrashFolder($isTrashFolder)
->setSelectedItems($_POST['mail_id'])
->prepareHTML();
// SHOW_FOLDER ONLY IF viewmode is flatview
$folders = $this->mbox->getSubFolders();
$mtree = new ilTree($ilUser->getId());
$mtree->setTableNames('mail_tree', 'mail_obj_data');
if(!isset($_SESSION['viewmode']) || $_SESSION['viewmode'] == 'flat')
{
foreach($folders as $folder)
{
$this->tpl->setCurrentBLock('flat_select');
$folder_d = $mtree->getNodeData($folder['obj_id']);
if($folder['obj_id'] == $_GET['mobj_id'])
{
$this->tpl->setVariable('FLAT_SELECTED', ' selected="selected"');
}
$this->tpl->setVariable('FLAT_VALUE', $folder['obj_id']);
if($folder['type'] == 'user_folder')
{
$pre = '';
for ($i = 2; $i < $folder_d['depth'] - 1; $i++)
$pre .= '&nbsp';
if ($folder_d['depth'] > 1)
$pre .= '+';
$this->tpl->setVariable('FLAT_NAME', $pre.' '.$folder['title']);
}
else
{
$this->tpl->setVariable('FLAT_NAME', $this->lng->txt('mail_'.$folder['title']));
}
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock('show_folder');
$this->tpl->setVariable('TXT_FOLDERS', $this->lng->txt('mail_change_to_folder'));
//$this->tpl->setVariable('FOLDER_VALUE', $this->lng->txt('submit'));
$this->tpl->setVariable('FOLDER_VALUE', $this->lng->txt('change'));
$this->tpl->setVariable('ACTION_FLAT', $this->ctrl->getFormAction($this, 'showFolder'));
$this->tpl->parseCurrentBlock();
}
// END SHOW_FOLDER
// BEGIN Trash delete confirmation
if($mailtable->isTrashFolder() &&
$mailtable->getNumerOfMails() > 0)
{
if($this->askForConfirmation == true)
{
$this->tpl->setCurrentBlock('CONFIRM_EMPTY_TRASH');
$this->tpl->setVariable('ACTION_EMPTY_TRASH_CONFIRMATION', $this->ctrl->getFormAction($this, 'performEmptyTrash'));
$this->tpl->setVariable('BUTTON_CONFIRM_EMPTY_TRASH', $this->lng->txt('confirm'));
$this->tpl->setVariable('BUTTON_CANCEL_EMPTY_TRASH', $this->lng->txt('cancel'));
$this->tpl->parseCurrentBlock();
}
}
// END Trash delete confirmation
$this->tpl->setVariable('MAIL_TABLE', $mailtable->getHtml());
$this->tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailFolderGUI::showMail ( )

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

References $_GET, $_SESSION, $file, $key, $login, $tplbtn, ilMail\_getAnonymousName(), ilFrameTargetInfo\_getFrame(), ilObjUser\_lookupPref(), ilAccessKey\DELETE, ilDatePresentation\formatDate(), ilAccessKey\FORWARD_MAIL, ilUtil\getImagePath(), ilUtil\htmlencodePlainString(), IL_CAL_DATETIME, and ilAccessKey\REPLY.

Referenced by add(), changeFolder(), and deliverFile().

{
global $ilUser;
if ($_SESSION["mail_id"])
{
$_GET["mail_id"] = $_SESSION["mail_id"];
$_SESSION["mail_id"] = "";
}
$this->umail->markRead(array($_GET["mail_id"]));
$mailData = $this->umail->getMail($_GET["mail_id"]);
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_read.html", "Services/Mail");
$this->tpl->setVariable("HEADER",$this->lng->txt("mail_mails_of"));
if ($_SESSION["viewmode"] == "tree") $this->tpl->setVariable("FORM_TARGET", ilFrameTargetInfo::_getFrame("MainContent"));
include_once("./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
// buttons...
// reply
include_once("./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php");
$toolbar = new ilToolbarGUI();
if($mailData["sender_id"] &&
$mailData["sender_id"] != ANONYMOUS_USER_ID)
{
$this->ctrl->setParameterByClass("ilmailformgui", "mail_id", $_GET["mail_id"]);
$this->ctrl->setParameterByClass("ilmailformgui", "type", "reply");
$this->ctrl->clearParametersByClass("iliasmailformgui");
$toolbar->addButton($this->lng->txt("reply"), $this->ctrl->getLinkTargetByClass("ilmailformgui"),
}
// forward
$this->ctrl->setParameterByClass("ilmailformgui", "mail_id", $_GET["mail_id"]);
$this->ctrl->setParameterByClass("ilmailformgui", "type", "forward");
$this->ctrl->clearParametersByClass("iliasmailformgui");
$toolbar->addButton($this->lng->txt("forward"), $this->ctrl->getLinkTargetByClass("ilmailformgui"),
// print
$this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
$this->ctrl->setParameter($this, "cmd", "printMail");
$toolbar->addButton($this->lng->txt("print"), $this->ctrl->getLinkTarget($this),
"_blank");
$this->ctrl->clearParameters($this);
// delete
$this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
$this->ctrl->setParameter($this, "selected_cmd", "deleteMails");
$toolbar->addButton($this->lng->txt("delete"), $this->ctrl->getLinkTarget($this),
$this->ctrl->clearParameters($this);
$this->tpl->setVariable("BUTTONS2",$toolbar->getHTML());
$this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
$this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
$this->ctrl->clearParameters($this);
if ($mailData["sender_id"] &&
$mailData["sender_id"] != $ilUser->getId() &&
$mailData["sender_id"] != ANONYMOUS_USER_ID)
{
require_once "Services/Contact/classes/class.ilAddressbook.php";
$abook = new ilAddressbook($ilUser->getId());
$tmp_user = new ilObjUser($mailData["sender_id"]);
if ($abook->checkEntryByLogin($tmp_user->getLogin()) == 0)
{
$tplbtn = new ilTemplate("tpl.buttons.html", true, true);
$tplbtn->setCurrentBlock("btn_cell");
$this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]);
$this->ctrl->setParameter($this, "cmd", "add");
$tplbtn->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this));
$this->ctrl->clearParameters($this);
$tplbtn->setVariable("BTN_TXT", $this->lng->txt("mail_add_to_addressbook"));
$tplbtn->parseCurrentBlock();
$this->tpl->setVariable("ADD_USER_BTN",$tplbtn->get());
}
}
// SET MAIL DATA
$counter = 1;
// FROM
if($mailData["sender_id"] != ANONYMOUS_USER_ID)
{
$tmp_user = new ilObjUser($mailData['sender_id']);
$this->ctrl->setParameter($this, 'mail_id', $_GET['mail_id']);
$this->ctrl->setParameter($this, 'user', $tmp_user->getId());
if (in_array(ilObjUser::_lookupPref($mailData['sender_id'], 'public_profile'), array("y", "g")))
{
$this->tpl->setVariable('PROFILE_LINK_FROM', $this->ctrl->getLinkTarget($this, 'showUser'));
$this->tpl->setVariable('FROM', $tmp_user->getFullname());
}
$this->tpl->setCurrentBlock("pers_image");
$this->tpl->setVariable("IMG_SENDER", $tmp_user->getPersonalPicturePath("xsmall"));
$this->tpl->setVariable("ALT_SENDER", $tmp_user->getFullname());
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("adm_content");
if(!($login = $tmp_user->getLogin()))
{
$login = $mailData["import_name"]." (".$this->lng->txt("user_deleted").")";
}
$this->tpl->setVariable("MAIL_LOGIN",$login);
$this->tpl->setVariable("CSSROW_FROM", (++$counter) % 2 ? 'tblrow1' : 'tblrow2');
}
else
{
$tmp_user = new ilObjUser(ANONYMOUS_USER_ID);
$this->tpl->setVariable('MAIL_LOGIN', ilMail::_getAnonymousName());
$this->tpl->setCurrentBlock('pers_image');
$this->tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIcon.png'));
$this->tpl->setVariable('ALT_SENDER', ilMail::_getAnonymousName());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable('TXT_FROM', $this->lng->txt('from'));
// TO
$this->tpl->setVariable('TXT_TO', $this->lng->txt('mail_to'));
// Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
$this->tpl->setVariable('TO', ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false));
$this->tpl->setVariable('CSSROW_TO', (++$counter) % 2 ? 'tblrow1' : 'tblrow2');
// CC
if($mailData['rcp_cc'])
{
$this->tpl->setCurrentBlock('cc');
$this->tpl->setVariable('TXT_CC',$this->lng->txt('cc'));
// Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
$this->tpl->setVariable('CC', ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false));
$this->tpl->setVariable('CSSROW_CC', (++$counter) % 2 ? 'tblrow1' : 'tblrow2');
$this->tpl->parseCurrentBlock();
}
// SUBJECT
$this->tpl->setVariable('TXT_SUBJECT', $this->lng->txt('subject'));
// Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
$this->tpl->setVariable('SUBJECT', ilUtil::htmlencodePlainString($mailData['m_subject'], true));
$this->tpl->setVariable('CSSROW_SUBJ', (++$counter) % 2 ? 'tblrow1' : 'tblrow2');
// DATE
$this->tpl->setVariable('TXT_DATE', $this->lng->txt('date'));
$this->tpl->setVariable('DATE',ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'],IL_CAL_DATETIME)));
$this->tpl->setVariable('CSSROW_DATE', (++$counter) % 2 ? 'tblrow1' : 'tblrow2');
// ATTACHMENTS
if($mailData['attachments'])
{
$this->tpl->setCurrentBlock('attachment');
$this->tpl->setCurrentBlock('a_row');
$counter = 1;
foreach($mailData['attachments'] as $file)
{
$this->tpl->setVariable('A_CSSROW', (++$counter) % 2 ? 'tblrow1' : 'tblrow2');
$this->tpl->setVariable('FILE', md5($file));
$this->tpl->setVariable('FILE_NAME', $file);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable('TXT_ATTACHMENT', $this->lng->txt('attachments'));
$this->tpl->setVariable('TXT_DOWNLOAD', $this->lng->txt('download'));
$this->tpl->parseCurrentBlock();
}
// MESSAGE
$this->tpl->setVariable('TXT_MESSAGE', $this->lng->txt('message'));
// Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
$this->tpl->setVariable('MAIL_MESSAGE', ilUtil::htmlencodePlainString($mailData['m_message'], true));
$isTrashFolder = false;
if ($this->mbox->getTrashFolder() == $_GET['mobj_id'])
{
$isTrashFolder = true;
}
// Bottom toolbar
$oBottomToolbar = new ilToolbarGUI();
$selectOptions = array();
$actions = $this->mbox->getActions($_GET["mobj_id"]);
foreach($actions as $key => $action)
{
if($key == 'moveMails')
{
$folders = $this->mbox->getSubFolders();
foreach($folders as $folder)
{
if ($folder["type"] != 'trash' ||
!$isTrashFolder)
{
$optionText = '';
if($folder['type'] != 'user_folder')
{
$optionText = $action.' '.$this->lng->txt('mail_'.$folder['title']).($folder['type'] == 'trash' ? ' ('.$this->lng->txt('delete').')' : '');
}
else
{
$optionText = $action.' '.$folder['title'];
}
$selectOptions[$folder['obj_id']] = $optionText;
}
}
}
}
if(is_array($selectOptions) && count($selectOptions))
{
include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$oActionSelectBox = new ilSelectInputGUI('', 'selected_cmd');
$oActionSelectBox->setOptions($selectOptions);
$oBottomToolbar->addInputItem($oActionSelectBox);
$oBottomToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder');
}
// Navigation
$prevMail = $this->umail->getPreviousMail($_GET['mail_id']);
$nextMail = $this->umail->getNextMail($_GET['mail_id']);
if(is_array($prevMail) || is_array($nextMail))
{
$oBottomToolbar->addSeparator();
if($prevMail['mail_id'])
{
$this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']);
$this->ctrl->setParameter($this, 'cmd', 'showMail');
$oBottomToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this));
$this->ctrl->clearParameters($this);
}
if($nextMail['mail_id'])
{
$this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']);
$this->ctrl->setParameter($this, 'cmd', 'showMail');
$oBottomToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this));
$this->ctrl->clearParameters($this);
}
}
$this->tpl->setVariable('MAIL_NAVIGATION', $oBottomToolbar->getHTML());
$this->tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailFolderGUI::showUser ( )

Definition at line 191 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.gif"));
$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"]);
$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 43 of file class.ilMailFolderGUI.php.

ilMailFolderGUI::$errorDelete = false
private

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

ilMailFolderGUI::$lng = null
private

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

Referenced by __construct(), and add().

ilMailFolderGUI::$mbox = null

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

ilMailFolderGUI::$tpl = null
private

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

Referenced by __construct(), and printMail().

ilMailFolderGUI::$umail = null

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


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