Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #require_once "./include/inc.mail.php";
00025 require_once './Services/User/classes/class.ilObjUser.php';
00026 require_once "Services/Mail/classes/class.ilMail.php";
00027
00035 class ilPDMailGUI
00036 {
00037
00041 function getPDMailHTML($a_mail_id, $a_mobj_id)
00042 {
00043 global $lng, $rbacsystem, $ilias;
00044
00045 $lng->loadLanguageModule("mail");
00046
00047
00048 $umail = new ilMail($_SESSION["AccountId"]);
00049
00050
00051 if (!$rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
00052 {
00053 $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->WARNING);
00054 }
00055
00056 $umail->markRead(array($a_mail_id));
00057 $mail_data = $umail->getMail($a_mail_id);
00058
00059
00060 $counter = 1;
00061
00062 $tpl = new ilTemplate("tpl.pd_mail.html", true, true, "Services/Mail");
00063
00064
00065 if($mail_data["attachments"])
00066 {
00067 foreach($mail_data["attachments"] as $file)
00068 {
00069 $tpl->setCurrentBlock("a_row");
00070 $tpl->setVariable("HREF_DOWNLOAD",
00071 "ilias.php?baseClass=ilMailGUI&type=deliverFile&mail_id=".$_GET["mail_id"].
00072 "&filename=".rawurlencode($file));
00073 $tpl->setVariable("FILE_NAME", $file);
00074 $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
00075 $tpl->parseCurrentBlock();
00076 }
00077 $tpl->setCurrentBlock("attachment");
00078 $tpl->setVariable("TXT_ATTACHMENT", $lng->txt("attachments"));
00079 $tpl->parseCurrentBlock();
00080 }
00081
00082
00083 $tpl->setVariable("TXT_FROM", $lng->txt("from"));
00084 $tmp_user = new ilObjUser($mail_data["sender_id"]);
00085 if($mail_data['sender_id'] != ANONYMOUS_USER_ID)
00086 {
00087
00088 $tpl->setCurrentBlock("pers_image");
00089 $tpl->setVariable("IMG_SENDER", $tmp_user->getPersonalPicturePath("xsmall"));
00090 $tpl->setVariable("ALT_SENDER", $tmp_user->getFullname());
00091 $tpl->parseCurrentBlock();
00092 if(ilObjUser::_lookupPref($mail_data['sender_id'], 'public_profile') == 'y')
00093 {
00094 $tpl->setVariable("FROM", $tmp_user->getFullname());
00095 }
00096
00097 if(!($login = $tmp_user->getLogin()))
00098 {
00099 $login = $mail_data["import_name"]." (".$lng->txt("user_deleted").")";
00100 }
00101 $tpl->setVariable("MAIL_LOGIN",$login);
00102 }
00103 else
00104 {
00105
00106 $tpl->setCurrentBlock('pers_image');
00107 $tpl->setVariable('IMG_SENDER', $tmp_user->getPersonalPicturePath('xsmall'));
00108 $tpl->setVariable('ALT_SENDER', ilMail::_getAnonymousName());
00109 $tpl->parseCurrentBlock();
00110
00111 $tpl->setVariable('MAIL_LOGIN', ilMail::_getAnonymousName());
00112
00113 }
00114
00115
00116 $tpl->setVariable("TXT_TO", $lng->txt("mail_to"));
00117 $tpl->setVariable("TO", $umail->formatNamesForOutput($mail_data['rcp_to']));
00118
00119
00120 if($mail_data["rcp_cc"])
00121 {
00122 $tpl->setCurrentBlock("cc");
00123 $tpl->setVariable("TXT_CC",$lng->txt("cc"));
00124 $tpl->setVariable("CC", $umail->formatNamesForOutput($mail_data['rcp_cc']));
00125 $tpl->parseCurrentBlock();
00126 }
00127
00128 $tpl->setVariable("TXT_SUBJECT",$lng->txt("subject"));
00129 $tpl->setVariable("SUBJECT",htmlspecialchars($mail_data["m_subject"]));
00130
00131
00132 $tpl->setVariable("TXT_DATE", $lng->txt("date"));
00133 $tpl->setVariable("DATE", ilFormat::formatDate($mail_data["send_time"]));
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 $tpl->setVariable("TXT_MESSAGE", $lng->txt("message"));
00156 $tpl->setVariable("MAIL_MESSAGE", nl2br(ilUtil::makeClickable(ilUtil::secureString($mail_data["m_message"]))));
00157
00158 return $tpl->get();
00159 }
00160 }
00161 ?>