51 $this->tpl = $DIC->ui()->mainTemplate();
52 $this->ctrl = $DIC->ctrl();
53 $this->lng = $DIC->language();
54 $this->
user = $DIC->user();
55 $this->httpRequest = $DIC->http()->request();
57 $this->lng->loadLanguageModule(
'mail');
60 $this->umail = new \ilMail($this->
user->getId());
61 if (!$DIC->rbac()->system()->checkAccess(
'internal_mail', $this->umail->getMailObjectReferenceId())) {
62 $DIC[
'ilErr']->raiseError($this->lng->txt(
"permission_denied"), $DIC[
'ilErr']->WARNING);
73 $folderId = $this->httpRequest->getParsedBody()[
'mobj_id'] ?? 0;
74 if (!is_numeric($folderId) || 0 == $folderId) {
75 $folderId = $this->httpRequest->getQueryParams()[
'mobj_id'] ?? 0;
77 if (!is_numeric($folderId) || 0 == $folderId || !$this->mbox->isOwnedFolder($folderId)) {
78 $folderId = $this->mbox->getInboxFolder();
80 $this->currentFolderId = (int) $folderId;
88 $type = $this->httpRequest->getQueryParams()[
'type'] ??
'';
89 $mailId = (int) ($this->httpRequest->getQueryParams()[
'mail_id'] ?? 0);
91 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mobj_id', $this->currentFolderId);
92 $this->ctrl->setParameterByClass(
'ilmailfoldergui',
'mobj_id', $this->currentFolderId);
94 if (
'search_res' ===
$type) {
96 $this->ctrl->redirectByClass(
'ilmailformgui',
'searchResults');
97 } elseif (
'attach' ===
$type) {
99 $this->ctrl->redirectByClass(
'ilmailformgui',
'mailAttachment');
100 } elseif (
'new' ===
$type) {
101 $to = $this->httpRequest->getQueryParams()[
'rcp_to'] ??
'';
108 $cc = $this->httpRequest->getQueryParams()[
'rcp_cc'] ??
'';
109 $bcc = $this->httpRequest->getQueryParams()[
'rcp_bcc'] ??
'';
114 $this->ctrl->redirectByClass(
'ilmailformgui',
'mailUser');
115 } elseif (
'reply' ===
$type) {
117 $this->ctrl->redirectByClass(
'ilmailformgui',
'replyMail');
118 } elseif (
'read' ===
$type) {
120 $this->ctrl->redirectByClass(
'ilmailfoldergui',
'showMail');
121 } elseif (
'deliverFile' ===
$type) {
125 if (isset($this->httpRequest->getParsedBody()[
'filename'])) {
126 $fileName = $this->httpRequest->getParsedBody()[
'filename'];
127 } elseif (isset($this->httpRequest->getQueryParams()[
'filename'])) {
128 $fileName = $this->httpRequest->getQueryParams()[
'filename'];
132 $this->ctrl->redirectByClass(
'ilmailfoldergui',
'deliverFile');
133 } elseif (
'message_sent' ===
$type) {
134 \ilUtil::sendSuccess($this->lng->txt(
'mail_message_send'),
true);
135 $this->ctrl->redirectByClass(
'ilmailfoldergui');
136 } elseif (
'role' ===
$type) {
137 $roles = $this->httpRequest->getParsedBody()[
'roles'] ?? [];
138 if (is_array($roles) && count($roles) > 0) {
140 } elseif (isset($this->httpRequest->getQueryParams()[
'role'])) {
141 \ilSession::set(
'mail_roles', [$this->httpRequest->getQueryParams()[
'role']]);
145 $this->ctrl->redirectByClass(
'ilmailformgui',
'mailRole');
148 if (
'my_courses' === $this->httpRequest->getQueryParams()[
'view']) {
150 $this->ctrl->redirectByClass(
'ilmailformgui',
'searchCoursesTo');
153 if (isset($this->httpRequest->getQueryParams()[
'viewmode'])) {
154 \ilSession::set(self::VIEWMODE_SESSION_KEY, $this->httpRequest->getQueryParams()[
'viewmode']);
155 $this->ctrl->setCmd(
'setViewMode');
158 $this->forwardClass = $this->ctrl->getNextClass($this);
161 if (
'tree' ===
ilSession::get(self::VIEWMODE_SESSION_KEY) && $this->ctrl->getCmd() !==
'showExplorer') {
165 switch ($this->forwardClass) {
166 case 'ilmailformgui':
171 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
175 case 'ilmailoptionsgui':
176 $this->tpl->setTitle($this->lng->txt(
'mail'));
180 case 'ilmailfoldergui':
185 if (!($cmd = $this->ctrl->getCmd()) || !method_exists($this, $cmd)) {
186 $cmd =
'setViewMode';
199 $targetClass = $this->httpRequest->getQueryParams()[
'target'] ??
'ilmailfoldergui';
200 $type = $this->httpRequest->getQueryParams()[
'type'] ??
'';
201 $mailId = (int) ($this->httpRequest->getQueryParams()[
'mail_id'] ?? 0);
203 $this->ctrl->setParameterByClass($targetClass,
'mobj_id', $this->currentFolderId);
205 if (
'redirect_to_read' ===
$type) {
206 $this->ctrl->setParameterByClass(
211 $this->ctrl->setParameterByClass(
'ilmailfoldergui',
'mobj_id', $this->currentFolderId);
212 $this->ctrl->redirectByClass(
'ilMailFolderGUI',
'showMail');
213 } elseif (
'add_subfolder' ===
$type) {
214 $this->ctrl->redirectByClass($targetClass,
'addSubFolder');
215 } elseif (
'enter_folderdata' ===
$type) {
216 $this->ctrl->redirectByClass($targetClass,
'enterFolderData');
217 } elseif (
'confirmdelete_folderdata' ===
$type) {
218 $this->ctrl->redirectByClass($targetClass,
'confirmDeleteFolder');
220 $this->ctrl->redirectByClass($targetClass);
231 $DIC[
'ilHelp']->setScreenIdComponent(
"mail");
232 $DIC[
'ilMainMenu']->setActive(
"mail");
234 $this->tpl->getStandardTemplate();
239 $this->ctrl->setParameterByClass(
'ilmailfoldergui',
'mobj_id', $this->currentFolderId);
240 $DIC->tabs()->addTarget(
'fold', $this->ctrl->getLinkTargetByClass(
'ilmailfoldergui'));
241 $this->ctrl->clearParametersByClass(
'ilmailformgui');
243 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'new');
244 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mobj_id', $this->currentFolderId);
245 $DIC->tabs()->addTarget(
'compose', $this->ctrl->getLinkTargetByClass(
'ilmailformgui'));
246 $this->ctrl->clearParametersByClass(
'ilmailformgui');
248 $this->ctrl->setParameterByClass(
'ilcontactgui',
'mobj_id', $this->currentFolderId);
249 $DIC->tabs()->addTarget(
'mail_addressbook', $this->ctrl->getLinkTargetByClass(
'ilcontactgui'));
250 $this->ctrl->clearParametersByClass(
'ilcontactgui');
252 if ($DIC->settings()->get(
'show_mail_settings')) {
253 $this->ctrl->setParameterByClass(
'ilmailoptionsgui',
'mobj_id', $this->currentFolderId);
254 $DIC->tabs()->addTarget(
'options', $this->ctrl->getLinkTargetByClass(
'ilmailoptionsgui'));
255 $this->ctrl->clearParametersByClass(
'ilmailoptionsgui');
258 switch ($this->forwardClass) {
259 case 'ilmailformgui':
260 $DIC->tabs()->setTabActive(
'compose');
264 $DIC->tabs()->setTabActive(
'mail_addressbook');
267 case 'ilmailoptionsgui':
268 $DIC->tabs()->setTabActive(
'options');
271 case 'ilmailfoldergui':
273 $DIC->tabs()->setTabActive(
'fold');
277 if (isset($this->httpRequest->getQueryParams()[
'message_sent'])) {
278 $DIC->tabs()->setTabActive(
'fold');
281 $folderTreeState =
'flat';
283 $folderTreeState =
'tree';
287 $this->ctrl->setParameter($this,
'mail_id', (
int) $this->httpRequest->getQueryParams()[
'mail_id']);
288 $this->ctrl->setParameter($this,
'type',
'redirect_to_read');
290 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
291 $this->ctrl->setParameter($this,
'viewmode', $folderTreeState);
292 $this->tpl->setTreeFlatIcon($this->ctrl->getLinkTarget($this), $folderTreeState);
293 $this->ctrl->clearParameters($this);
295 $this->tpl->setCurrentBlock(
'tree_icons');
296 $this->tpl->parseCurrentBlock();
305 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
306 if (!is_numeric($mailId) || 0 == $mailId) {
310 return in_array(strtolower($cmd), [
'showmail']);
318 $exp = new \ilMailExplorer($this,
'showExplorer', $this->
user->getId());
319 if (!$exp->handleCommand()) {
320 $this->tpl->setLeftNavContent($exp->getHTML());
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
const VIEWMODE_SESSION_KEY
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Mail Box class Base class for creating and handling mail boxes.
static infoPanel($a_keep=true)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct()
ilMailGUI constructor.
isMailDetailCommand(string $cmd)