19declare(strict_types=1);
46 $this->tpl =
$DIC->ui()->mainTemplate();
47 $this->
ctrl = $DIC->ctrl();
48 $this->
lng = $DIC->language();
49 $this->
user = $DIC->user();
50 $this->
http = $DIC->http();
53 $this->
lng->loadLanguageModule(
'mail');
56 $this->umail =
new ilMail($this->
user->getId());
58 !$DIC->rbac()->system()->checkAccess(
60 $this->umail->getMailObjectReferenceId()
63 $DIC[
'ilErr']->raiseError($this->
lng->txt(
'permission_denied'), $DIC[
'ilErr']->WARNING);
68 $tool_context =
$DIC->globalScreen()
73 $additional_data_exists = $tool_context->getAdditionalData()->exists(
74 MailGlobalScreenToolProvider::SHOW_MAIL_FOLDERS_TOOL
76 if ($additional_data_exists ===
false) {
77 $tool_context->addAdditionalData(MailGlobalScreenToolProvider::SHOW_MAIL_FOLDERS_TOOL,
true);
83 if ($this->
http->wrapper()->post()->has(
'mobj_id')) {
84 $folder_id = $this->
http->wrapper()->post()->retrieve(
'mobj_id', $this->
refinery->kindlyTo()->int());
85 } elseif ($this->
http->wrapper()->query()->has(
'mobj_id')) {
86 $folder_id = $this->
http->wrapper()->query()->retrieve(
'mobj_id', $this->
refinery->kindlyTo()->int());
88 $folder_id = $this->
refinery->byTrying([
90 $this->refinery->always($this->current_folder_id),
93 if ($folder_id === 0 || !$this->mbox->isOwnedFolder($folder_id)) {
94 $folder_id = $this->mbox->getInboxFolder();
96 $this->current_folder_id = $folder_id;
102 if ($this->
http->wrapper()->query()->has(
'type')) {
103 $type = $this->
http->wrapper()->query()->retrieve(
'type', $this->
refinery->kindlyTo()->string());
106 if ($this->
http->wrapper()->query()->has(
'mail_id')) {
107 $mail_id = $this->
http->wrapper()->query()->retrieve(
'mail_id', $this->
refinery->kindlyTo()->int());
110 $this->
ctrl->setParameterByClass(ilMailFormGUI::class,
'mobj_id', $this->current_folder_id);
111 $this->
ctrl->setParameterByClass(ilMailFolderGUI::class,
'mobj_id', $this->current_folder_id);
115 $this->
ctrl->redirectByClass(ilMailFormGUI::class,
'searchResults');
118 $this->
ctrl->redirectByClass(ilMailFormGUI::class,
'mailAttachment');
120 foreach ([
'to',
'cc',
'bcc'] as $reciepient_type) {
121 $key =
'rcp_' . $reciepient_type;
124 if ($this->
http->wrapper()->query()->has($key)) {
125 $recipients = $this->
http->wrapper()->query()->retrieve(
127 $this->
refinery->kindlyTo()->string()
140 $this->
ctrl->redirectByClass(ilMailFormGUI::class,
'mailUser');
142 $this->
ctrl->setParameterByClass(ilMailFormGUI::class,
'mail_id', $mail_id);
143 $this->
ctrl->redirectByClass(ilMailFormGUI::class,
'replyMail');
144 } elseif ($type ===
'read') {
145 $this->
ctrl->setParameterByClass(ilMailFolderGUI::class,
'mail_id', $mail_id);
146 $this->
ctrl->redirectByClass(ilMailFolderGUI::class,
'showMail');
147 } elseif ($type ===
'deliverFile') {
149 if ($this->
http->wrapper()->post()->has(
'filename')) {
152 $this->
refinery->kindlyTo()->string()
154 } elseif ($this->
http->wrapper()->query()->has(
'filename')) {
157 $this->
refinery->kindlyTo()->string()
162 $this->
ctrl->setParameterByClass(ilMailFolderGUI::class,
'mail_id', $mail_id);
163 $this->
ctrl->redirectByClass(ilMailFolderGUI::class,
'deliverFile');
164 } elseif ($type ===
'message_sent') {
165 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'mail_message_send'),
true);
166 $this->
ctrl->redirectByClass(ilMailFolderGUI::class);
169 if ($this->
http->wrapper()->post()->has(
'roles')) {
170 $roles = $this->
http->wrapper()->post()->retrieve(
172 $this->
refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
174 } elseif ($this->
http->wrapper()->query()->has(
'role')) {
175 $roles = [$this->
http->wrapper()->query()->retrieve(
'role', $this->
refinery->kindlyTo()->string())];
183 $this->
ctrl->redirectByClass(ilMailFormGUI::class,
'mailRole');
187 if ($this->
http->wrapper()->query()->has(
'view')) {
188 $view = $this->
http->wrapper()->query()->retrieve(
'view', $this->
refinery->kindlyTo()->string());
190 if ($view ===
'my_courses') {
192 if ($this->
http->wrapper()->query()->has(
'search_crs')) {
194 $this->
http->wrapper()->query()->retrieve(
'search_crs', $this->refinery->kindlyTo()->string())
197 $this->
ctrl->setParameter($this,
'search_crs', $search_crs);
198 $this->
ctrl->redirectByClass(ilMailFormGUI::class,
'searchCoursesTo');
201 $this->forward_class = (string) $this->
ctrl->getNextClass($this);
204 switch (strtolower($this->forward_class)) {
205 case strtolower(ilMailFormGUI::class):
209 case strtolower(ilMailAttachmentGUI::class):
210 $this->tpl->setTitle($this->
lng->txt(
'mail_attachments'));
213 $this->
ctrl->forwardCommand($gui);
216 case strtolower(ilMailOptionsGUI::class):
217 $this->tpl->setTitle($this->
lng->txt(
'mail_options'));
221 case strtolower(ilMailFolderGUI::class):
226 if (!($cmd = $this->
ctrl->getCmd()) || !method_exists($this, $cmd)) {
227 $cmd =
'setViewMode';
237 $target_class = ilMailFolderGUI::class;
238 if ($this->
http->wrapper()->query()->has(
'target')) {
239 $target_class = $this->
http->wrapper()->query()->retrieve(
241 $this->
refinery->kindlyTo()->string()
245 if ($this->
http->wrapper()->query()->has(
'type')) {
246 $type = $this->
http->wrapper()->query()->retrieve(
'type', $this->
refinery->kindlyTo()->string());
249 if ($this->
http->wrapper()->query()->has(
'mail_id')) {
250 $mail_id = $this->
http->wrapper()->query()->retrieve(
'mail_id', $this->
refinery->kindlyTo()->int());
253 $this->
ctrl->setParameterByClass($target_class,
'mobj_id', $this->current_folder_id);
255 if ($type ===
'redirect_to_read') {
256 $this->
ctrl->setParameterByClass(
257 ilMailFolderGUI::class,
261 $this->
ctrl->setParameterByClass(
262 ilMailFolderGUI::class,
264 $this->current_folder_id
266 $this->
ctrl->redirectByClass(ilMailFolderGUI::class,
'showMail');
267 } elseif ($type ===
'add_subfolder') {
268 $this->
ctrl->redirectByClass($target_class,
'addSubFolder');
269 } elseif ($type ===
'enter_folderdata') {
270 $this->
ctrl->redirectByClass($target_class,
'enterFolderData');
271 } elseif ($type ===
'confirmdelete_folderdata') {
272 $this->
ctrl->redirectByClass($target_class,
'confirmDeleteFolder');
274 $this->
ctrl->redirectByClass($target_class);
282 $DIC[
'ilHelp']->setScreenIdComponent(
'mail');
284 $folder = $this->mbox->getFolderData($this->current_folder_id);
289 switch ($folder->getType()) {
295 switch (strtolower($this->
ctrl->getCmdClass() ??
'')) {
296 case strtolower(ilMailFormGUI::class):
300 case strtolower(ilMailOptionsGUI::class):
304 case strtolower(ilMailAttachmentGUI::class):
309 $type = $folder->getType()->value;
@ilCtrl_Calls ilMailFolderGUI: ILIAS\User\Profile\PublicProfileGUI
@ilCtrl_Calls ilMailGUI: ilMailFolderGUI, ilMailFormGUI, ilContactGUI, ilMailOptionsGUI,...
readonly Refinery $refinery
readonly ilGlobalTemplateInterface $tpl
readonly ilCtrlInterface $ctrl
readonly GlobalHttpState $http
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Interface GlobalHttpState.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.