Get Mail HTML for Personal Desktop Mail Display.
{
global
$lng, $rbacsystem, $ilias;
$lng->loadLanguageModule("mail");
if (!$rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
{
$ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->WARNING);
}
$umail->markRead(array($a_mail_id));
$mail_data = $umail->getMail($a_mail_id);
$counter = 1;
$tpl =
new ilTemplate(
"tpl.pd_mail.html",
true,
true,
"Services/Mail");
if($mail_data["attachments"])
{
foreach($mail_data[
"attachments"] as
$file)
{
$tpl->setCurrentBlock(
"a_row");
$tpl->setVariable(
"HREF_DOWNLOAD",
"ilias.php?baseClass=ilMailGUI&type=deliverFile&mail_id=".
$_GET[
"mail_id"].
"&filename=".md5($file));
$tpl->setVariable(
"FILE_NAME", $file);
$tpl->setVariable(
"TXT_DOWNLOAD", $lng->txt(
"download"));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock(
"attachment");
$tpl->setVariable(
"TXT_ATTACHMENT", $lng->txt(
"attachments"));
$tpl->parseCurrentBlock();
}
$tpl->setVariable(
"TXT_FROM", $lng->txt(
"from"));
$tmp_user =
new ilObjUser($mail_data[
"sender_id"]);
if($mail_data['sender_id'] != ANONYMOUS_USER_ID)
{
$tpl->setCurrentBlock(
"pers_image");
$tpl->setVariable(
"IMG_SENDER", $tmp_user->getPersonalPicturePath(
"xsmall"));
$tpl->setVariable(
"ALT_SENDER", $tmp_user->getFullname());
$tpl->parseCurrentBlock();
{
$tpl->setVariable(
"FROM", $tmp_user->getFullname());
}
if(!(
$login = $tmp_user->getLogin()))
{
$login = $mail_data[
"import_name"].
" (".$lng->txt(
"user_deleted").
")";
}
}
else
{
$tpl->setCurrentBlock(
'pers_image');
$tpl->setVariable(
'IMG_SENDER', $tmp_user->getPersonalPicturePath(
'xsmall'));
$tpl->parseCurrentBlock();
}
$tpl->setVariable(
"TXT_TO", $lng->txt(
"mail_to"));
$tpl->setVariable(
"TO", $umail->formatNamesForOutput($mail_data[
'rcp_to']));
if($mail_data["rcp_cc"])
{
$tpl->setCurrentBlock(
"cc");
$tpl->setVariable(
"TXT_CC",$lng->txt(
"cc"));
$tpl->setVariable(
"CC", $umail->formatNamesForOutput($mail_data[
'rcp_cc']));
$tpl->parseCurrentBlock();
}
$tpl->setVariable(
"TXT_SUBJECT",$lng->txt(
"subject"));
$tpl->setVariable(
"SUBJECT",htmlspecialchars($mail_data[
"m_subject"]));
$tpl->setVariable(
"TXT_DATE", $lng->txt(
"date"));
$tpl->setVariable(
"TXT_MESSAGE", $lng->txt(
"message"));
}