ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilMailGUI Class Reference

@ilCtrl_Calls ilMailGUI: ilMailFolderGUI, ilMailFormGUI, ilContactGUI, ilMailOptionsGUI, ilMailAttachmentGUI, ilMailSearchGUI @ilCtrl_Calls ilMailGUI: ILIAS\User\Settings\PersonalSettingsGUI, ilObjUserGUI More...

+ Inheritance diagram for ilMailGUI:
+ Collaboration diagram for ilMailGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Data Fields

ilMail $umail
 
ilMailbox $mbox
 

Protected Member Functions

 initFolder ()
 

Private Member Functions

 setViewMode ()
 
 showHeader ()
 

Private Attributes

readonly ilGlobalTemplateInterface $tpl
 
readonly ilCtrlInterface $ctrl
 
readonly ilLanguage $lng
 
string $forward_class = ''
 
readonly GlobalHttpState $http
 
readonly Refinery $refinery
 
int $current_folder_id = 0
 
readonly ilObjUser $user
 

Detailed Description

@ilCtrl_Calls ilMailGUI: ilMailFolderGUI, ilMailFormGUI, ilContactGUI, ilMailOptionsGUI, ilMailAttachmentGUI, ilMailSearchGUI @ilCtrl_Calls ilMailGUI: ILIAS\User\Settings\PersonalSettingsGUI, ilObjUserGUI

Definition at line 30 of file class.ilMailGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailGUI::__construct ( )

Definition at line 43 of file class.ilMailGUI.php.

44 {
45 global $DIC;
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();
51 $this->refinery = $DIC->refinery();
52
53 $this->lng->loadLanguageModule('mail');
54
55 $this->mbox = new ilMailbox($this->user->getId());
56 $this->umail = new ilMail($this->user->getId());
57 if (
58 !$DIC->rbac()->system()->checkAccess(
59 'internal_mail',
60 $this->umail->getMailObjectReferenceId()
61 )
62 ) {
63 $DIC['ilErr']->raiseError($this->lng->txt('permission_denied'), $DIC['ilErr']->WARNING);
64 }
65
66 $this->initFolder();
67
68 $tool_context = $DIC->globalScreen()
69 ->tool()
70 ->context()
71 ->current();
72
73 $additional_data_exists = $tool_context->getAdditionalData()->exists(
74 MailGlobalScreenToolProvider::SHOW_MAIL_FOLDERS_TOOL
75 );
76 if ($additional_data_exists === false) {
77 $tool_context->addAdditionalData(MailGlobalScreenToolProvider::SHOW_MAIL_FOLDERS_TOOL, true);
78 }
79 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initFolder(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilMailGUI::executeCommand ( )

Definition at line 99 of file class.ilMailGUI.php.

99 : void
100 {
101 $type = '';
102 if ($this->http->wrapper()->query()->has('type')) {
103 $type = $this->http->wrapper()->query()->retrieve('type', $this->refinery->kindlyTo()->string());
104 }
105 $mail_id = 0;
106 if ($this->http->wrapper()->query()->has('mail_id')) {
107 $mail_id = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
108 }
109
110 $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'mobj_id', $this->current_folder_id);
111 $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mobj_id', $this->current_folder_id);
112
114 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
115 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'searchResults');
116 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_ATTACH === $type) {
117 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
118 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'mailAttachment');
119 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_NEW === $type) {
120 foreach (['to', 'cc', 'bcc'] as $reciepient_type) {
121 $key = 'rcp_' . $reciepient_type;
122
123 $recipients = '';
124 if ($this->http->wrapper()->query()->has($key)) {
125 $recipients = $this->http->wrapper()->query()->retrieve(
126 $key,
127 $this->refinery->kindlyTo()->string()
128 );
129 }
130
131 ilSession::set($key, ilUtil::stripSlashes($recipients));
132
133 if (ilSession::get($key) === '' &&
134 ($recipients = ilMailFormCall::getRecipients($reciepient_type))) {
135 ilSession::set($key, implode(',', $recipients));
136 ilMailFormCall::setRecipients([], $reciepient_type);
137 }
138 }
139 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
140 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'mailUser');
141 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_REPLY === $type) {
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') {
148 $filename = '';
149 if ($this->http->wrapper()->post()->has('filename')) {
150 $filename = $this->http->wrapper()->post()->retrieve(
151 'filename',
152 $this->refinery->kindlyTo()->string()
153 );
154 } elseif ($this->http->wrapper()->query()->has('filename')) {
155 $filename = $this->http->wrapper()->query()->retrieve(
156 'filename',
157 $this->refinery->kindlyTo()->string()
158 );
159 }
160
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);
167 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_ROLE === $type) {
168 $roles = [];
169 if ($this->http->wrapper()->post()->has('roles')) {
170 $roles = $this->http->wrapper()->post()->retrieve(
171 'roles',
172 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
173 );
174 } elseif ($this->http->wrapper()->query()->has('role')) {
175 $roles = [$this->http->wrapper()->query()->retrieve('role', $this->refinery->kindlyTo()->string())];
176 }
177
178 if ($roles !== []) {
179 ilSession::set('mail_roles', $roles);
180 }
181
182 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
183 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'mailRole');
184 }
185
186 $view = '';
187 if ($this->http->wrapper()->query()->has('view')) {
188 $view = $this->http->wrapper()->query()->retrieve('view', $this->refinery->kindlyTo()->string());
189 }
190 if ($view === 'my_courses') {
191 $search_crs = '';
192 if ($this->http->wrapper()->query()->has('search_crs')) {
193 $search_crs = ilUtil::stripSlashes(
194 $this->http->wrapper()->query()->retrieve('search_crs', $this->refinery->kindlyTo()->string())
195 );
196 }
197 $this->ctrl->setParameter($this, 'search_crs', $search_crs);
198 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'searchCoursesTo');
199 }
200
201 $this->forward_class = (string) $this->ctrl->getNextClass($this);
202 $this->showHeader();
203
204 switch (strtolower($this->forward_class)) {
205 case strtolower(ilMailFormGUI::class):
206 $this->ctrl->forwardCommand(new ilMailFormGUI());
207 break;
208
209 case strtolower(ilMailAttachmentGUI::class):
210 $this->tpl->setTitle($this->lng->txt('mail_attachments'));
211 $gui = new ilMailAttachmentGUI();
212 $gui->manage();
213 $this->ctrl->forwardCommand($gui);
214 break;
215
216 case strtolower(ilMailOptionsGUI::class):
217 $this->tpl->setTitle($this->lng->txt('mail_options'));
218 $this->ctrl->forwardCommand(new ilMailOptionsGUI());
219 break;
220
221 case strtolower(ilMailFolderGUI::class):
222 $this->ctrl->forwardCommand(new ilMailFolderGUI());
223 break;
224
225 default:
226 if (!($cmd = $this->ctrl->getCmd()) || !method_exists($this, $cmd)) {
227 $cmd = 'setViewMode';
228 }
229
230 $this->{$cmd}();
231 break;
232 }
233 }
$filename
Definition: buildRTE.php:78
@ilCtrl_Calls ilMailFolderGUI: ILIAS\User\Profile\PublicProfileGUI
static storeReferer(array $query_parameters)
static getRecipients(string $type='to')
static setRecipients(array $recipients, string $type='to')
@ilCtrl_Calls ilMailFormGUI: ilMailAttachmentGUI, ilMailSearchGUI, ilMailSearchCoursesGUI,...
final const string MAIL_FORM_TYPE_NEW
final const string MAIL_FORM_TYPE_ATTACH
final const string MAIL_FORM_TYPE_SEARCH_RESULT
final const string MAIL_FORM_TYPE_REPLY
final const string MAIL_FORM_TYPE_ROLE
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References $filename, ILIAS\Repository\ctrl(), ilSession\get(), ilMailFormCall\getRecipients(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilMailFormGUI\MAIL_FORM_TYPE_ATTACH, ilMailFormGUI\MAIL_FORM_TYPE_NEW, ilMailFormGUI\MAIL_FORM_TYPE_REPLY, ilMailFormGUI\MAIL_FORM_TYPE_ROLE, ilMailFormGUI\MAIL_FORM_TYPE_SEARCH_RESULT, ILIAS\Repository\refinery(), ilSession\set(), ilMailFormCall\setRecipients(), showHeader(), ilMailFormCall\storeReferer(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ initFolder()

ilMailGUI::initFolder ( )
protected

Definition at line 81 of file class.ilMailGUI.php.

81 : void
82 {
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());
87 } else {
88 $folder_id = $this->refinery->byTrying([
89 $this->refinery->kindlyTo()->int(),
90 $this->refinery->always($this->current_folder_id),
91 ])->transform(ilSession::get('mobj_id'));
92 }
93 if ($folder_id === 0 || !$this->mbox->isOwnedFolder($folder_id)) {
94 $folder_id = $this->mbox->getInboxFolder();
95 }
96 $this->current_folder_id = $folder_id;
97 }

References ilSession\get(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setViewMode()

ilMailGUI::setViewMode ( )
private

Definition at line 235 of file class.ilMailGUI.php.

235 : void
236 {
237 $target_class = ilMailFolderGUI::class;
238 if ($this->http->wrapper()->query()->has('target')) {
239 $target_class = $this->http->wrapper()->query()->retrieve(
240 'target',
241 $this->refinery->kindlyTo()->string()
242 );
243 }
244 $type = '';
245 if ($this->http->wrapper()->query()->has('type')) {
246 $type = $this->http->wrapper()->query()->retrieve('type', $this->refinery->kindlyTo()->string());
247 }
248 $mail_id = 0;
249 if ($this->http->wrapper()->query()->has('mail_id')) {
250 $mail_id = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
251 }
252
253 $this->ctrl->setParameterByClass($target_class, 'mobj_id', $this->current_folder_id);
254
255 if ($type === 'redirect_to_read') {
256 $this->ctrl->setParameterByClass(
257 ilMailFolderGUI::class,
258 'mail_id',
259 $mail_id
260 );
261 $this->ctrl->setParameterByClass(
262 ilMailFolderGUI::class,
263 'mobj_id',
264 $this->current_folder_id
265 );
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');
273 } else {
274 $this->ctrl->redirectByClass($target_class);
275 }
276 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ showHeader()

ilMailGUI::showHeader ( )
private

Definition at line 278 of file class.ilMailGUI.php.

278 : void
279 {
280 global $DIC;
281
282 $DIC['ilHelp']->setScreenIdComponent('mail');
283
284 $folder = $this->mbox->getFolderData($this->current_folder_id);
285 $type = 'mail';
286
287
288 if ($folder) {
289 switch ($folder->getType()) {
291 $type = "local";
292 break;
293
294 default:
295 switch (strtolower($this->ctrl->getCmdClass() ?? '')) {
296 case strtolower(ilMailFormGUI::class):
297 $type = 'mail';
298 break;
299
300 case strtolower(ilMailOptionsGUI::class):
301 $type = 'adm';
302 break;
303
304 case strtolower(ilMailAttachmentGUI::class):
305 $type = 'fils';
306 break;
307
308 default:
309 $type = $folder->getType()->value;
310 break;
311 }
312 break;
313 }
314 }
315
316 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_$type.svg"));
317 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References $DIC, ILIAS\Repository\ctrl(), ilUtil\getImagePath(), and ILIAS\Test\Results\Toplist\USER.

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

readonly ilCtrlInterface ilMailGUI::$ctrl
private

Definition at line 33 of file class.ilMailGUI.php.

◆ $current_folder_id

int ilMailGUI::$current_folder_id = 0
private

Definition at line 38 of file class.ilMailGUI.php.

◆ $forward_class

string ilMailGUI::$forward_class = ''
private

Definition at line 35 of file class.ilMailGUI.php.

◆ $http

readonly GlobalHttpState ilMailGUI::$http
private

Definition at line 36 of file class.ilMailGUI.php.

◆ $lng

readonly ilLanguage ilMailGUI::$lng
private

Definition at line 34 of file class.ilMailGUI.php.

◆ $mbox

ilMailbox ilMailGUI::$mbox

Definition at line 41 of file class.ilMailGUI.php.

◆ $refinery

readonly Refinery ilMailGUI::$refinery
private

Definition at line 37 of file class.ilMailGUI.php.

◆ $tpl

readonly ilGlobalTemplateInterface ilMailGUI::$tpl
private

Definition at line 32 of file class.ilMailGUI.php.

◆ $umail

ilMail ilMailGUI::$umail

Definition at line 40 of file class.ilMailGUI.php.

◆ $user

readonly ilObjUser ilMailGUI::$user
private

Definition at line 39 of file class.ilMailGUI.php.


The documentation for this class was generated from the following file: