19declare(strict_types=1);
41 $this->
lng = $DIC->language();
42 $this->rbacsystem =
$DIC->rbac()->system();
43 $this->
ilias = $DIC[
'ilias'];
44 $this->
user = $DIC->user();
45 $this->
http = $DIC->http();
49 public function getPDMailHTML(
int $a_mail_id,
int $a_mobj_id): string
51 $this->
lng->loadLanguageModule(
'mail');
57 if (!$this->rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId())) {
58 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->WARNING);
61 $umail->markRead([$a_mail_id]);
62 $mail_data = $umail->getMail($a_mail_id);
64 $tpl =
new ilTemplate(
'tpl.pd_mail.html',
true,
true,
'Services/Mail');
66 if ($mail_data[
'attachments']) {
68 if ($this->
http->wrapper()->query()->has(
'mail_id')) {
69 $mailId = $this->
http->wrapper()->query()->retrieve(
'mail_id', $this->
refinery->kindlyTo()->int());
71 foreach ($mail_data[
'attachments'] as $file) {
72 $tpl->setCurrentBlock(
'a_row');
75 'ilias.php?baseClass=ilMailGUI&type=deliverFile&mail_id='
77 '&filename=' . md5($file)
79 $tpl->setVariable(
'FILE_NAME', $file);
80 $tpl->setVariable(
'TXT_DOWNLOAD', $this->
lng->txt(
'download'));
81 $tpl->parseCurrentBlock();
83 $tpl->setCurrentBlock(
'attachment');
84 $tpl->setVariable(
'TXT_ATTACHMENT', $this->
lng->txt(
'attachments'));
85 $tpl->parseCurrentBlock();
88 $tpl->setVariable(
'TXT_FROM', $this->
lng->txt(
'from'));
93 $tpl->setCurrentBlock(
'pers_image');
94 $tpl->setVariable(
'IMG_SENDER', $sender->getPersonalPicturePath(
'xsmall'));
95 $tpl->setVariable(
'ALT_SENDER', htmlspecialchars($sender->getPublicName()));
96 $tpl->parseCurrentBlock();
98 $tpl->setVariable(
'PUBLIC_NAME', $sender->getPublicName());
99 } elseif (
null === $sender) {
102 trim(($mail_data[
'import_name'] ??
'') .
' (' . $this->
lng->txt(
'user_deleted') .
')')
105 $tpl->setCurrentBlock(
'pers_image');
107 $tpl->setVariable(
'ALT_SENDER', htmlspecialchars(ilMail::_getIliasMailerName()));
108 $tpl->parseCurrentBlock();
109 $tpl->setVariable(
'PUBLIC_NAME', ilMail::_getIliasMailerName());
112 $tpl->setVariable(
'TXT_TO', $this->
lng->txt(
'mail_to'));
113 $tpl->setVariable(
'TO', $umail->formatNamesForOutput((
string) $mail_data[
'rcp_to']));
115 if ($mail_data[
'rcp_cc']) {
116 $tpl->setCurrentBlock(
'cc');
117 $tpl->setVariable(
'TXT_CC', $this->
lng->txt(
'mail_cc'));
118 $tpl->setVariable(
'CC', $umail->formatNamesForOutput((
string) $mail_data[
'rcp_cc']));
119 $tpl->parseCurrentBlock();
122 $tpl->setVariable(
'TXT_SUBJECT', $this->
lng->txt(
'subject'));
123 $tpl->setVariable(
'SUBJECT', htmlspecialchars($mail_data[
'm_subject']));
125 $tpl->setVariable(
'TXT_DATE', $this->
lng->txt(
'date'));
131 $tpl->setVariable(
'TXT_MESSAGE', $this->
lng->txt(
'message'));
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Mail User Interface class.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
special template class to simplify handling of ITX/PEAR
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static makeClickable(string $a_text, bool $detectGotoLinks=false)
static securePlainString(string $a_str)
Interface GlobalHttpState.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static http()
Fetches the global http state from ILIAS.
Class ChatMainBarProvider \MainMenu\Provider.
header include for all ilias files.