24 require_once
'./Services/User/classes/class.ilObjUser.php';
25 require_once
"Services/Mail/classes/class.ilMailbox.php";
26 require_once
"Services/Mail/classes/class.ilMail.php";
55 $this->ctrl->saveParameter($this,
"mobj_id");
57 $this->umail =
new ilMail($ilUser->getId());
58 $this->mbox =
new ilMailBox($ilUser->getId());
60 if(isset($_POST[
'mobj_id']) && (int)$_POST[
'mobj_id'])
62 $_GET[
'mobj_id'] = $_POST[
'mobj_id'];
67 $_GET[
"mobj_id"] = $this->mbox->getInboxFolder();
74 if (
$_GET[
"action"] ==
"deleteMails" &&
77 $_GET[
"cmd"] =
"editFolder";
78 $_POST[
"action"] =
"deleteMails";
79 $_POST[
"mail_id"] = array(
$_GET[
"mail_id"]);
82 $forward_class = $this->ctrl->getNextClass($this);
83 switch($forward_class)
85 case 'ilmailaddressbookgui':
86 include_once
'Services/Mail/classes/class.ilMailAddressbookGUI.php';
91 case 'ilmailoptionsgui':
92 include_once
'Services/Mail/classes/class.ilMailOptionsGUI.php';
97 case 'ilpublicuserprofilegui':
98 include_once(
"./Services/User/classes/class.ilPublicUserProfileGUI.php");
100 $ret = $this->ctrl->forwardCommand($profile_gui);
104 if (!(
$cmd = $this->ctrl->getCmd()))
116 global
$lng, $ilUser;
118 if(
$_GET[
"mail_id"] !=
"")
120 if (is_array($mail_data = $this->umail->getMail(
$_GET[
"mail_id"])))
122 require_once
"Services/Mail/classes/class.ilAddressbook.php";
125 $tmp_user =
new ilObjUser($mail_data[
"sender_id"]);
126 if ($abook->checkEntryByLogin($tmp_user->getLogin()) > 0)
132 $abook->addEntry($tmp_user->getLogin(),
133 $tmp_user->getFirstname(),
134 $tmp_user->getLastname(),
135 $tmp_user->getEmail());
152 $this->umail->deleteMailsOfFolder(
$_GET[
"mobj_id"]);
162 if ($this->umail->countMailsOfFolder(
$_GET[
"mobj_id"]))
165 $this->askForConfirmation =
true;
177 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
179 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
181 $this->tpl->setCurrentBlock(
"btn_cell");
182 $this->ctrl->setParameter($this,
"mail_id",
$_GET[
"mail_id"]);
183 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTarget($this,
"showMail"));
184 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"back"));
185 $this->tpl->parseCurrentBlock();
188 $this->tpl->setVariable(
"TBL_TITLE", $this->lng->txt(
"profile_of").
" ".
191 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT", $this->lng->txt(
"public_profile"));
193 include_once
'./Services/User/classes/class.ilPublicUserProfileGUI.php';
195 $this->tpl->setContent($ilCtrl->getHTML($profile_gui));
212 static $userObjectCache = array();
214 if(isset($userObjectCache[$a_usr_id]))
return $userObjectCache[$a_usr_id];
216 $userObjectCache[$a_usr_id] =
new ilObjUser($a_usr_id);
218 return $userObjectCache[$a_usr_id];
225 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail.html",
"Services/Mail");
226 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
228 $this->ctrl->setParameter($this,
"offset",
$_GET[
"offset"]);;
229 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
230 $this->ctrl->clearParameters($this);
232 $sentFolderId = $this->mbox->getSentFolder();
233 $draftsFolderId = $this->mbox->getDraftsFolder();
235 $isTrashFolder =
$_GET[
'mobj_id'] == $this->mbox->getTrashFolder();
236 $isSentFolder =
$_GET[
'mobj_id'] == $sentFolderId;
237 $isDraftFolder =
$_GET[
'mobj_id'] == $draftsFolderId;
240 if($_POST[
"action"] ==
"deleteMails" &&
241 !$this->errorDelete &&
242 $_POST[
"action"] !=
"confirm" &&
245 $this->tpl->setCurrentBlock(
"CONFIRM_DELETE");
246 $this->tpl->setVariable(
"BUTTON_CONFIRM",$this->lng->txt(
"confirm"));
247 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
248 $this->tpl->parseCurrentBlock();
252 $actions = $this->mbox->getActions(
$_GET[
"mobj_id"]);
254 $this->tpl->setCurrentBlock(
"mailactions");
255 foreach($actions as $key => $action)
257 if($key ==
'moveMails')
259 $folders = $this->mbox->getSubFolders();
260 foreach($folders as $folder)
262 if ($folder[
"type"] !=
'trash' ||
265 $this->tpl->setVariable(
"MAILACTION_VALUE", $folder[
"obj_id"]);
266 if($folder[
"type"] !=
'user_folder')
268 $this->tpl->setVariable(
"MAILACTION_NAME",$action.
" ".$this->lng->txt(
"mail_".$folder[
"title"]).($folder[
"type"] ==
'trash' ?
" (".$this->lng->txt(
"delete").
")" :
""));
272 $this->tpl->setVariable(
"MAILACTION_NAME",$action.
" ".$folder[
"title"]);
274 $this->tpl->parseCurrentBlock();
280 if ($key !=
'deleteMails' ||
283 $this->tpl->setVariable(
"MAILACTION_NAME", $action);
284 $this->tpl->setVariable(
"MAILACTION_VALUE", $key);
285 $this->tpl->setVariable(
"MAILACTION_SELECTED",$_POST[
"action"] ==
'delete' ?
'selected' :
'');
286 $this->tpl->parseCurrentBlock();
297 $this->tpl->setCurrentBlock(
"show_folder");
298 $this->tpl->setCurrentBLock(
"flat_select");
300 foreach($folders as $folder)
302 if($folder[
"obj_id"] ==
$_GET[
"mobj_id"])
304 $this->tpl->setVariable(
"FLAT_SELECTED",
"selected");
306 $this->tpl->setVariable(
"FLAT_VALUE",$folder[
"obj_id"]);
307 if($folder[
"type"] ==
'user_folder')
309 $this->tpl->setVariable(
"FLAT_NAME", $folder[
"title"]);
313 $this->tpl->setVariable(
"FLAT_NAME", $this->lng->txt(
"mail_".$folder[
"title"]));
315 $this->tpl->parseCurrentBlock();
317 $this->tpl->setVariable(
"TXT_FOLDERS", $this->lng->txt(
"mail_change_to_folder"));
318 $this->tpl->setVariable(
"FOLDER_VALUE",$this->lng->txt(
"submit"));
319 $this->tpl->parseCurrentBlock();
321 #$this->ctrl->setParameter($this, "offset", $_GET["offset"]);
322 $this->tpl->setVariable(
"ACTION_FLAT", $this->ctrl->getFormAction($this,
'showFolder'));
323 #$this->ctrl->clearParameters($this);
328 $mailData = $this->umail->getMailsOfFolder(
$_GET[
"mobj_id"]);
329 $mail_count = count($mailData);
331 if($isTrashFolder && $mail_count > 0)
333 if ($this->askForConfirmation ==
true)
335 $this->tpl->setCurrentBlock(
"CONFIRM_EMPTY_TRASH");
336 $this->tpl->setVariable(
"ACTION_EMPTY_TRASH_CONFIRMATION", $this->ctrl->getFormAction($this,
'performEmptyTrash'));
337 $this->tpl->setVariable(
"BUTTON_CONFIRM_EMPTY_TRASH", $this->lng->txt(
"confirm"));
338 $this->tpl->setVariable(
"BUTTON_CANCEL_EMPTY_TRASH", $this->lng->txt(
"cancel"));
339 $this->tpl->parseCurrentBlock();
342 $this->tpl->setCurrentBlock(
"EMPTY_TRASH");
343 $this->tpl->setVariable(
"LINK_EMPTY_TRASH", $this->ctrl->getLinkTarget($this,
"askForEmptyTrash"));
344 $this->tpl->setVariable(
"TXT_EMPTY_TRASH", $this->lng->txt(
"mail_empty_trash"));
345 $this->tpl->parseCurrentBlock();
349 $mail_max_hits = $ilUser->getPref(
'hits_per_page');
351 foreach ($mailData as $mail)
360 if($mail_count > $mail_max_hits)
363 "mobj_id" =>
$_GET[
"mobj_id"]);
365 $start =
$_GET[
"offset"];
366 $linkbar =
ilUtil::Linkbar($this->ctrl->getLinkTarget($this),$mail_count,$mail_max_hits,$start,$params);
369 $this->tpl->setVariable(
"LINKBAR", $linkbar);
371 if($counter >= ($start+$mail_max_hits))
375 if($counter < $start)
383 $this->tpl->setCurrentBlock(
"mails");
384 $this->tpl->setVariable(
"ROWCOL",
"tblrow".(($counter % 2)+1));
385 $this->tpl->setVariable(
"MAIL_ID", $mail[
"mail_id"]);
387 if(is_array($_POST[
"mail_id"]))
389 $this->tpl->setVariable(
"CHECKBOX_CHECKED",in_array($mail[
"mail_id"],$_POST[
"mail_id"]) ?
'checked' :
"");
393 if($isSentFolder || $isDraftFolder)
395 $this->tpl->setVariable(
'MAIL_LOGIN', $this->umail->formatNamesForOutput($mail[
'rcp_to']));
399 if($mail[
"sender_id"] != ANONYMOUS_USER_ID)
404 $this->tpl->setVariable(
'MAIL_FROM', $tmp_user->getFullname());
406 if(!($login = $tmp_user->getLogin()))
408 $login = $mail[
"import_name"].
" (".$this->lng->txt(
"user_deleted").
")";
411 $this->tpl->setCurrentBlock(
"pers_image");
412 $this->tpl->setVariable(
"IMG_SENDER", $tmp_user->getPersonalPicturePath(
"xxsmall"));
413 $this->tpl->setVariable(
"ALT_SENDER", $login);
414 $this->tpl->parseCurrentBlock();
415 $this->tpl->setCurrentBlock(
"mails");
417 $this->tpl->setVariable(
"MAIL_LOGIN",$login);
423 $this->tpl->setCurrentBlock(
'pers_image');
424 $this->tpl->setVariable(
'IMG_SENDER', $tmp_user->getPersonalPicturePath(
'xxsmall'));
426 $this->tpl->parseCurrentBlock();
427 $this->tpl->setCurrentBlock(
'mails');
432 $this->tpl->setVariable(
"MAILCLASS", $mail[
"m_status"] ==
'read' ?
'mailread' :
'mailunread');
436 $this->ctrl->setParameterByClass(
"ilmailformgui",
"mail_id", $mail[
"mail_id"]);
437 $this->ctrl->setParameterByClass(
"ilmailformgui",
"type",
"draft");
438 $this->tpl->setVariable(
"MAIL_LINK_READ", $this->ctrl->getLinkTargetByClass(
"ilmailformgui"));
439 $this->ctrl->clearParametersByClass(
"ilmailformgui");
443 $this->ctrl->setParameter($this,
"mail_id", $mail[
"mail_id"]);
444 $this->ctrl->setParameter($this,
"cmd",
"showMail");
445 $this->tpl->setVariable(
"MAIL_LINK_READ", $this->ctrl->getLinkTarget($this));
446 $this->ctrl->clearParameters($this);
448 $this->tpl->setVariable(
"MAIL_SUBJECT", htmlspecialchars($mail[
"m_subject"]));
451 $this->tpl->parseCurrentBlock();
455 $mtree =
new ilTree($ilUser->getId());
457 $folder_node = $mtree->getNodeData(
$_GET[mobj_id]);
460 if($folder_node[
"type"] ==
'user_folder')
462 $this->tpl->setVariable(
"TXT_FOLDER", $folder_node[
"title"]);
467 $this->tpl->setVariable(
"TXT_FOLDER", $this->lng->txt(
"mail_".$folder_node[
"title"]));
468 $this->tpl->setVariable(
"IMG_FOLDER",
ilUtil::getImagePath(
"icon".substr($folder_node[
"title"], 1).
".gif"));
471 if ($folder_node[
"type"] ==
'user_folder' || $folder_node[
"type"] ==
'local')
473 if ($folder_node[
"type"] ==
'user_folder')
475 $this->ctrl->setParameter($this,
"cmd",
"enterFolderData");
476 $this->tpl->setVariable(
"LINK_EDIT_FOLDER", $this->ctrl->getLinkTarget($this));
477 $this->tpl->setVariable(
"TXT_EDIT_FOLDER", $this->lng->txt(
"edit"));
479 $this->tpl->setVariable(
"TXT_ADD_FOLDER", $this->lng->txt(
"mail_add_subfolder"));
482 $this->tpl->setVariable(
"TXT_MAIL", $this->lng->txt(
"mail"));
483 $this->tpl->setVariable(
"TXT_MAIL_S", $this->lng->txt(
"mail_s"));
484 $this->tpl->setVariable(
"TXT_UNREAD", $this->lng->txt(
"unread"));
485 $this->tpl->setVariable(
"TXT_SUBMIT",$this->lng->txt(
"submit"));
486 $this->tpl->setVariable(
"TXT_SELECT_ALL", $this->lng->txt(
"select_all"));
487 $this->tpl->setVariable(
"IMGPATH",$this->tpl->tplPath);
490 $mail_counter = $this->umail->getMailCounterData();
491 $this->tpl->setVariable(
"MAIL_COUNT", $mail_counter[
"total"]);
492 $this->tpl->setVariable(
"MAIL_COUNT_UNREAD", $mail_counter[
"unread"]);
493 $this->tpl->setVariable(
"TXT_UNREAD_MAIL_S",$this->lng->txt(
"mail_s_unread"));
494 $this->tpl->setVariable(
"TXT_MAIL_S",$this->lng->txt(
"mail_s"));
497 if($isSentFolder || $isDraftFolder)
499 $this->tpl->setVariable(
"TXT_SENDER", $this->lng->txt(
"recipient"));
503 $this->tpl->setVariable(
"TXT_SENDER", $this->lng->txt(
"sender"));
505 $this->tpl->setVariable(
"TXT_SUBJECT", $this->lng->txt(
"subject"));
507 $this->tpl->setVariable(
"TXT_DATE",$this->lng->txt(
"date"));
508 $this->tpl->setVariable(
"DIRECTION",
"up");
517 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&type=confirmdelete_folderdata");
538 $new_parent = $this->mbox->getParentFolderId(
$_GET[
"mobj_id"]);
540 if ($this->mbox->deleteFolder(
$_GET[
"mobj_id"]))
550 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&type=confirmdelete_folderdata");
566 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&type=enter_folderdata");
579 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&target=ilmailfoldergui");
590 if (isset($_POST[
"folder_name_add"]) &&
$_SESSION[
"viewmode"] ==
"tree")
$_SESSION[
"folder_name_add"] = $_POST[
'folder_name_add'];
592 $tmp_data = $this->mbox->getFolderData(
$_GET[
"mobj_id"]);
593 if ($tmp_data[
"title"] != $_POST[
"folder_name_add"])
595 if ($_POST[
"folder_name_add"] ==
"")
600 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&type=enter_folderdata");
621 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&type=enter_folderdata");
635 ilUtil::redirect(
"ilias.php?baseClass=ilMailGUI&mobj_id=".
$_GET[
"mobj_id"].
"&type=enter_folderdata");
648 if (empty($_POST[
'folder_name_add']))
705 $mtree =
new ilTree($ilUser->getId());
707 $folder_node = $mtree->getNodeData(
$_GET[mobj_id]);
709 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_edit_user_folder.html",
'Services/Mail');
713 $this->tpl->setCurrentBlock(
"confirm_delete");
714 $this->ctrl->setParameter($this,
"cmd",
"post");
715 $this->tpl->setVariable(
"ACTION_DELETE", $this->ctrl->getFormAction($this));
717 $this->ctrl->clearParameters($this);
718 $this->tpl->setVariable(
"TXT_DELETE_CONFIRM",$this->lng->txt(
"confirm"));
719 $this->tpl->setVariable(
"TXT_DELETE_CANCEL",$this->lng->txt(
"cancel"));
720 $this->tpl->parseCurrentBlock();
723 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
725 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
728 if (
$cmd ==
"saveFolderSettings")
730 $this->tpl->setVariable(
"TXT_HEADLINE", $this->lng->txt(
'mail_folder_edit'));
731 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
'name'));
732 $this->tpl->setVariable(
"TXT_DELETE", $this->lng->txt(
'delete'));
740 $this->tpl->setVariable(
"TXT_HEADLINE", $this->lng->txt(
'mail_add_subfolder'));
741 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
'name'));
749 $this->tpl->setVariable(
"CMD_SUBMIT",
$cmd);
750 $this->tpl->setVariable(
"TXT_SUBMIT", (
$cmd ==
"saveSubFolderSettings" ? $this->lng->txt(
'save') : $this->lng->txt(
'rename')));
751 $this->tpl->setVariable(
"TITLE_VALUE", $title_value);
752 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
'cancel'));
761 switch ($_POST[
"action"])
764 if ($this->umail->moveMailsToFolder(array(
$_GET[
"mail_id"]), $_POST[
"action"]))
767 $this->ctrl->redirectByClass(
"ilMailGUI");
783 switch ($_POST[
"action"])
785 case 'markMailsRead':
786 if(is_array($_POST[
"mail_id"]))
788 $this->umail->markRead($_POST[
"mail_id"]);
795 case 'markMailsUnread':
796 if(is_array($_POST[
"mail_id"]))
798 $this->umail->markUnread($_POST[
"mail_id"]);
808 if($this->mbox->getTrashFolder() ==
$_GET[
"mobj_id"])
810 if(!is_array($_POST[
"mail_id"]))
813 $this->errorDelete =
true;
823 if(!is_array($_POST[
"mail_id"]))
827 else if($this->umail->moveMailsToFolder($_POST[
"mail_id"], $this->mbox->getTrashFolder()))
840 $this->ctrl->setParameterByClass(
"ilmailoptionsgui",
"cmd",
"add");
841 $this->ctrl->redirectByClass(
"ilmailoptionsgui");
845 if(!is_array($_POST[
"mail_id"]))
849 else if($this->umail->moveMailsToFolder($_POST[
"mail_id"],$_POST[
"action"]))
866 if($this->mbox->getTrashFolder() ==
$_GET[
"mobj_id"])
868 if(!is_array($_POST[
"mail_id"]))
872 else if($this->umail->deleteMails($_POST[
"mail_id"]))
888 $this->ctrl->setParameter($this,
"offset",
$_GET[
"offset"]);
889 $this->ctrl->redirect($this);
902 $this->umail->markRead(array(
$_GET[
"mail_id"]));
904 $mailData = $this->umail->getMail(
$_GET[
"mail_id"]);
906 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_read.html",
"Services/Mail");
907 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
"mail_mails_of"));
911 if($mailData[
"sender_id"] &&
912 $mailData[
"sender_id"] != ANONYMOUS_USER_ID)
914 $tplbtn->setCurrentBlock(
"btn_cell");
915 $this->ctrl->setParameterByClass(
"ilmailformgui",
"mail_id",
$_GET[
"mail_id"]);
916 $this->ctrl->setParameterByClass(
"ilmailformgui",
"type",
"reply");
917 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTargetByClass(
"ilmailformgui"));
918 $this->ctrl->clearParametersByClass(
"iliasmailformgui");
919 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"reply"));
922 $tplbtn->setCurrentBlock(
"btn_cell");
923 $this->ctrl->setParameterByClass(
"ilmailformgui",
"mail_id",
$_GET[
"mail_id"]);
924 $this->ctrl->setParameterByClass(
"ilmailformgui",
"type",
"forward");
925 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTargetByClass(
"ilmailformgui"));
926 $this->ctrl->clearParametersByClass(
"iliasmailformgui");
927 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"forward"));
929 $tplbtn->setCurrentBlock(
"btn_cell");
930 $this->ctrl->setParameter($this,
"mail_id",
$_GET[
"mail_id"]);
931 $this->ctrl->setParameter($this,
"cmd",
"printMail");
932 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this));
933 $this->ctrl->clearParameters($this);
934 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"print"));
935 $tplbtn->setVariable(
"BTN_TARGET",
"target=\"_blank\"");
938 $tplbtn->setCurrentBlock(
"btn_cell");
939 $this->ctrl->setParameter($this,
"mail_id",
$_GET[
"mail_id"]);
940 $this->ctrl->setParameter($this,
"action",
"deleteMails");
941 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this));
942 $this->ctrl->clearParameters($this);
943 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"delete"));
946 $tplbtn->setCurrentBlock(
"btn_row");
949 $this->tpl->setVariable(
"BUTTONS2",
$tplbtn->get());
950 $this->ctrl->setParameter($this,
"mail_id",
$_GET[
"mail_id"]);
951 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
952 $this->ctrl->clearParameters($this);
954 if ($mailData[
"sender_id"] &&
955 $mailData[
"sender_id"] != $ilUser->getId() &&
956 $mailData[
"sender_id"] != ANONYMOUS_USER_ID)
958 require_once
"Services/Mail/classes/class.ilAddressbook.php";
961 $tmp_user =
new ilObjUser($mailData[
"sender_id"]);
962 if ($abook->checkEntryByLogin($tmp_user->getLogin()) == 0)
966 $tplbtn->setCurrentBlock(
"btn_cell");
967 $this->ctrl->setParameter($this,
"mail_id",
$_GET[
"mail_id"]);
968 $this->ctrl->setParameter($this,
"cmd",
"add");
969 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this));
970 $this->ctrl->clearParameters($this);
971 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"mail_add_to_addressbook"));
974 $this->tpl->setVariable(
"ADD_USER_BTN",
$tplbtn->get());
982 if($mailData[
"sender_id"] != ANONYMOUS_USER_ID)
984 $tmp_user =
new ilObjUser($mailData[
'sender_id']);
985 $this->ctrl->setParameter($this,
'mail_id',
$_GET[
'mail_id']);
986 $this->ctrl->setParameter($this,
'user', $tmp_user->getId());
989 $this->tpl->setVariable(
'PROFILE_LINK_FROM', $this->ctrl->getLinkTarget($this,
'showUser'));
990 $this->tpl->setVariable(
'FROM', $tmp_user->getFullname());
992 $this->tpl->setCurrentBlock(
"pers_image");
993 $this->tpl->setVariable(
"IMG_SENDER", $tmp_user->getPersonalPicturePath(
"xsmall"));
994 $this->tpl->setVariable(
"ALT_SENDER", $tmp_user->getFullname());
995 $this->tpl->parseCurrentBlock();
996 $this->tpl->setCurrentBlock(
"adm_content");
997 if(!($login = $tmp_user->getLogin()))
999 $login = $mailData[
"import_name"].
" (".$this->lng->txt(
"user_deleted").
")";
1001 $this->tpl->setVariable(
"MAIL_LOGIN",$login);
1002 $this->tpl->setVariable(
"CSSROW_FROM", (++$counter) % 2 ?
'tblrow1' :
'tblrow2');
1006 $tmp_user =
new ilObjUser(ANONYMOUS_USER_ID);
1008 $this->tpl->setCurrentBlock(
'pers_image');
1009 $this->tpl->setVariable(
'IMG_SENDER', $tmp_user->getPersonalPicturePath(
'xsmall'));
1011 $this->tpl->parseCurrentBlock();
1015 $this->tpl->setVariable(
'TXT_TO', $this->lng->txt(
'mail_to'));
1018 $this->tpl->setVariable(
'CSSROW_TO', (++$counter) % 2 ?
'tblrow1' :
'tblrow2');
1021 if($mailData[
'rcp_cc'])
1023 $this->tpl->setCurrentBlock(
'cc');
1024 $this->tpl->setVariable(
'TXT_CC',$this->lng->txt(
'cc'));
1027 $this->tpl->setVariable(
'CSSROW_CC', (++$counter) % 2 ?
'tblrow1' :
'tblrow2');
1028 $this->tpl->parseCurrentBlock();
1032 $this->tpl->setVariable(
'TXT_SUBJECT', $this->lng->txt(
'subject'));
1035 $this->tpl->setVariable(
'CSSROW_SUBJ', (++$counter) % 2 ?
'tblrow1' :
'tblrow2');
1038 $this->tpl->setVariable(
'TXT_DATE', $this->lng->txt(
'date'));
1040 $this->tpl->setVariable(
'CSSROW_DATE', (++$counter) % 2 ?
'tblrow1' :
'tblrow2');
1043 if($mailData[
"attachments"])
1045 $this->tpl->setCurrentBlock(
"attachment");
1046 $this->tpl->setCurrentBlock(
"a_row");
1048 foreach($mailData[
"attachments"] as
$file)
1050 $this->tpl->setVariable(
"A_CSSROW",++$counter%2 ?
'tblrow1' :
'tblrow2');
1051 $this->tpl->setVariable(
"FILE",md5($file));
1052 $this->tpl->setVariable(
"FILE_NAME",$file);
1053 $this->tpl->parseCurrentBlock();
1055 $this->tpl->setVariable(
"TXT_ATTACHMENT",$this->lng->txt(
"attachments"));
1056 $this->tpl->setVariable(
"TXT_DOWNLOAD",$this->lng->txt(
"download"));
1057 $this->tpl->parseCurrentBlock();
1061 $this->tpl->setVariable(
"TXT_MESSAGE", $this->lng->txt(
"message"));
1066 $isTrashFolder =
false;
1067 if ($this->mbox->getTrashFolder() ==
$_GET[
"mobj_id"])
1069 $isTrashFolder =
true;
1071 $actions = $this->mbox->getActions(
$_GET[
"mobj_id"]);
1072 foreach($actions as $key => $action)
1074 if($key ==
'moveMails')
1076 $folders = $this->mbox->getSubFolders();
1077 foreach($folders as $folder)
1079 if ($folder[
"type"] !=
'trash' ||
1082 $this->tpl->setCurrentBlock(
"movemail");
1083 $this->tpl->setVariable(
"MOVEMAIL_VALUE", $folder[
"obj_id"]);
1084 if($folder[
"type"] !=
'user_folder')
1086 $this->tpl->setVariable(
"MOVEMAIL_NAME",$action.
" ".$this->lng->txt(
"mail_".$folder[
"title"]).($folder[
"type"] ==
'trash' ?
" (".$this->lng->txt(
"delete").
")" :
""));
1090 $this->tpl->setVariable(
"MOVEMAIL_NAME",$action.
" ".$folder[
"title"]);
1092 $this->tpl->parseCurrentBlock();
1098 $this->tpl->setVariable(
"TXT_MOVEMAIL_SEND", $this->lng->txt(
'submit'));
1102 $prevMail = $this->umail->getPreviousMail(
$_GET[
"mail_id"]);
1103 $nextMail = $this->umail->getNextMail(
$_GET[
"mail_id"]);
1105 if (is_array($prevMail) || is_array($nextMail))
1111 if ($prevMail[
"mail_id"])
1115 $tplbtn->setCurrentBlock(
"btn_cell");
1116 $this->ctrl->setParameter($this,
"mail_id", $prevMail[
"mail_id"]);
1117 $this->ctrl->setParameter($this,
"cmd",
"showMail");
1118 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this));
1119 $this->ctrl->clearParameters($this);
1120 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"previous"));
1124 if ($nextMail[
"mail_id"])
1128 $tplbtn->setCurrentBlock(
"btn_cell");
1129 $this->ctrl->setParameter($this,
"mail_id", $nextMail[
"mail_id"]);
1130 $this->ctrl->setParameter($this,
"cmd",
"showMail");
1131 $tplbtn->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this));
1132 $this->ctrl->clearParameters($this);
1133 $tplbtn->setVariable(
"BTN_TXT", $this->lng->txt(
"next"));
1137 if ($show ==
true)$this->tpl->setVariable(
"NAV_BUTTONS",
$tplbtn->get());
1145 $tplprint =
new ilTemplate(
"Services/Mail/templates/default/tpl.mail_print.html",
true,
true,
true);
1146 $tplprint->setVariable(
"JSPATH",
$tpl->tplPath);
1149 $mailData = $this->umail->getMail(
$_GET[
"mail_id"]);
1153 if($mailData[
"sender_id"] != ANONYMOUS_USER_ID)
1155 $tmp_user =
new ilObjUser($mailData[
"sender_id"]);
1156 if(!($login = $tmp_user->getFullname()))
1158 $login = $mailData[
"import_name"].
" (".$this->lng->txt(
"user_deleted").
")";
1160 $tplprint->setVariable(
"FROM", $login);
1168 $tplprint->setVariable(
"TXT_TO", $this->lng->txt(
"mail_to"));
1169 $tplprint->setVariable(
"TO", $mailData[
"rcp_to"]);
1172 if($mailData[
"rcp_cc"])
1174 $tplprint->setCurrentBlock(
"cc");
1175 $tplprint->setVariable(
"TXT_CC",$this->lng->txt(
"cc"));
1176 $tplprint->setVariable(
"CC",$mailData[
"rcp_cc"]);
1177 $tplprint->parseCurrentBlock();
1180 $tplprint->setVariable(
"TXT_SUBJECT",$this->lng->txt(
"subject"));
1181 $tplprint->setVariable(
"SUBJECT",htmlspecialchars($mailData[
"m_subject"]));
1184 $tplprint->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
1189 $tplprint->setVariable(
"TXT_MESSAGE", $this->lng->txt(
"message"));
1190 $tplprint->setVariable(
"MAIL_MESSAGE", nl2br(htmlspecialchars($mailData[
"m_message"])));
1206 : ($_POST[
"filename"]
1207 ? $_POST[
"filename"]
1208 :
$_GET[
"filename"]));
1213 require_once
"classes/class.ilFileDataMail.php";
1219 if(!is_array(
$file = $mfile->getAttachmentPathByMD5Filename(
$filename,
$_GET[
'mail_id'])))