ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMailGUI Class Reference

@ilCtrl_Calls ilMailGUI: ilMailFolderGUI, ilMailFormGUI, ilContactGUI, ilMailOptionsGUI, ilMailAttachmentGUI, ilMailSearchGUI, 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 ()
 
 toggleExplorerNodeState ()
 

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

Constructor & Destructor Documentation

◆ __construct()

ilMailGUI::__construct ( )

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

42 {
43 global $DIC;
44 $this->tpl = $DIC->ui()->mainTemplate();
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->user = $DIC->user();
48 $this->http = $DIC->http();
49 $this->refinery = $DIC->refinery();
50
51 $this->lng->loadLanguageModule('mail');
52
53 $this->mbox = new ilMailbox($this->user->getId());
54 $this->umail = new ilMail($this->user->getId());
55 if (
56 !$DIC->rbac()->system()->checkAccess(
57 'internal_mail',
58 $this->umail->getMailObjectReferenceId()
59 )
60 ) {
61 $DIC['ilErr']->raiseError($this->lng->txt('permission_denied'), $DIC['ilErr']->WARNING);
62 }
63
64 $this->initFolder();
65
66 $tool_context = $DIC->globalScreen()
67 ->tool()
68 ->context()
69 ->current();
70
71 $additional_data_exists = $tool_context->getAdditionalData()->exists(
72 MailGlobalScreenToolProvider::SHOW_MAIL_FOLDERS_TOOL
73 );
74 if ($additional_data_exists === false) {
75 $tool_context->addAdditionalData(MailGlobalScreenToolProvider::SHOW_MAIL_FOLDERS_TOOL, true);
76 }
77 }
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 97 of file class.ilMailGUI.php.

97 : void
98 {
99 $type = '';
100 if ($this->http->wrapper()->query()->has('type')) {
101 $type = $this->http->wrapper()->query()->retrieve('type', $this->refinery->kindlyTo()->string());
102 }
103 $mail_id = 0;
104 if ($this->http->wrapper()->query()->has('mail_id')) {
105 $mail_id = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
106 }
107
108 $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'mobj_id', $this->current_folder_id);
109 $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mobj_id', $this->current_folder_id);
110
112 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
113 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'searchResults');
114 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_ATTACH === $type) {
115 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
116 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'mailAttachment');
117 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_NEW === $type) {
118 foreach (['to', 'cc', 'bcc'] as $reciepient_type) {
119 $key = 'rcp_' . $reciepient_type;
120
121 $recipients = '';
122 if ($this->http->wrapper()->query()->has($key)) {
123 $recipients = $this->http->wrapper()->query()->retrieve(
124 $key,
125 $this->refinery->kindlyTo()->string()
126 );
127 }
128
129 ilSession::set($key, ilUtil::stripSlashes($recipients));
130
131 if (ilSession::get($key) === '' &&
132 ($recipients = ilMailFormCall::getRecipients($reciepient_type))) {
133 ilSession::set($key, implode(',', $recipients));
134 ilMailFormCall::setRecipients([], $reciepient_type);
135 }
136 }
137 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
138 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'mailUser');
139 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_REPLY === $type) {
140 $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'mail_id', $mail_id);
141 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'replyMail');
142 } elseif ($type === 'read') {
143 $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mail_id', $mail_id);
144 $this->ctrl->redirectByClass(ilMailFolderGUI::class, 'showMail');
145 } elseif ($type === 'deliverFile') {
146 $filename = '';
147 if ($this->http->wrapper()->post()->has('filename')) {
148 $filename = $this->http->wrapper()->post()->retrieve(
149 'filename',
150 $this->refinery->kindlyTo()->string()
151 );
152 } elseif ($this->http->wrapper()->query()->has('filename')) {
153 $filename = $this->http->wrapper()->query()->retrieve(
154 'filename',
155 $this->refinery->kindlyTo()->string()
156 );
157 }
158
160 $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mail_id', $mail_id);
161 $this->ctrl->redirectByClass(ilMailFolderGUI::class, 'deliverFile');
162 } elseif ($type === 'message_sent') {
163 $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_message_send'), true);
164 $this->ctrl->redirectByClass(ilMailFolderGUI::class);
165 } elseif (ilMailFormGUI::MAIL_FORM_TYPE_ROLE === $type) {
166 $roles = [];
167 if ($this->http->wrapper()->post()->has('roles')) {
168 $roles = $this->http->wrapper()->post()->retrieve(
169 'roles',
170 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
171 );
172 } elseif ($this->http->wrapper()->query()->has('role')) {
173 $roles = [$this->http->wrapper()->query()->retrieve('role', $this->refinery->kindlyTo()->string())];
174 }
175
176 if ($roles !== []) {
177 ilSession::set('mail_roles', $roles);
178 }
179
180 ilMailFormCall::storeReferer($this->http->request()->getQueryParams());
181 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'mailRole');
182 }
183
184 $view = '';
185 if ($this->http->wrapper()->query()->has('view')) {
186 $view = $this->http->wrapper()->query()->retrieve('view', $this->refinery->kindlyTo()->string());
187 }
188 if ($view === 'my_courses') {
189 $search_crs = '';
190 if ($this->http->wrapper()->query()->has('search_crs')) {
191 $search_crs = ilUtil::stripSlashes(
192 $this->http->wrapper()->query()->retrieve('search_crs', $this->refinery->kindlyTo()->string())
193 );
194 }
195 $this->ctrl->setParameter($this, 'search_crs', $search_crs);
196 $this->ctrl->redirectByClass(ilMailFormGUI::class, 'searchCoursesTo');
197 }
198
199 $this->forward_class = (string) $this->ctrl->getNextClass($this);
200 $this->showHeader();
201
202 switch (strtolower($this->forward_class)) {
203 case strtolower(ilMailFormGUI::class):
204 $this->ctrl->forwardCommand(new ilMailFormGUI());
205 break;
206
207 case strtolower(ilContactGUI::class):
208 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
209 $this->ctrl->forwardCommand(new ilContactGUI());
210 break;
211
212 case strtolower(ilMailAttachmentGUI::class):
213 $this->tpl->setTitle($this->lng->txt('mail'));
214 $gui = new ilMailAttachmentGUI();
215 $gui->manage();
216 $this->ctrl->forwardCommand($gui);
217 break;
218
219 case strtolower(ilMailOptionsGUI::class):
220 $this->tpl->setTitle($this->lng->txt('mail'));
221 $this->ctrl->forwardCommand(new ilMailOptionsGUI());
222 break;
223
224 case strtolower(ilMailFolderGUI::class):
225 $this->ctrl->forwardCommand(new ilMailFolderGUI());
226 break;
227
228 default:
229 if (!($cmd = $this->ctrl->getCmd()) || !method_exists($this, $cmd)) {
230 $cmd = 'setViewMode';
231 }
232
233 $this->{$cmd}();
234 break;
235 }
236 }
$filename
Definition: buildRTE.php:78
@ilCtrl_Calls ilMailFolderGUI:
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 79 of file class.ilMailGUI.php.

79 : void
80 {
81 if ($this->http->wrapper()->post()->has('mobj_id')) {
82 $folder_id = $this->http->wrapper()->post()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
83 } elseif ($this->http->wrapper()->query()->has('mobj_id')) {
84 $folder_id = $this->http->wrapper()->query()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
85 } else {
86 $folder_id = $this->refinery->byTrying([
87 $this->refinery->kindlyTo()->int(),
88 $this->refinery->always($this->current_folder_id),
89 ])->transform(ilSession::get('mobj_id'));
90 }
91 if ($folder_id === 0 || !$this->mbox->isOwnedFolder($folder_id)) {
92 $folder_id = $this->mbox->getInboxFolder();
93 }
94 $this->current_folder_id = $folder_id;
95 }

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 238 of file class.ilMailGUI.php.

238 : void
239 {
240 $target_class = ilMailFolderGUI::class;
241 if ($this->http->wrapper()->query()->has('target')) {
242 $target_class = $this->http->wrapper()->query()->retrieve(
243 'target',
244 $this->refinery->kindlyTo()->string()
245 );
246 }
247 $type = '';
248 if ($this->http->wrapper()->query()->has('type')) {
249 $type = $this->http->wrapper()->query()->retrieve('type', $this->refinery->kindlyTo()->string());
250 }
251 $mail_id = 0;
252 if ($this->http->wrapper()->query()->has('mail_id')) {
253 $mail_id = $this->http->wrapper()->query()->retrieve('mail_id', $this->refinery->kindlyTo()->int());
254 }
255
256 $this->ctrl->setParameterByClass($target_class, 'mobj_id', $this->current_folder_id);
257
258 if ($type === 'redirect_to_read') {
259 $this->ctrl->setParameterByClass(
260 ilMailFolderGUI::class,
261 'mail_id',
262 $mail_id
263 );
264 $this->ctrl->setParameterByClass(
265 ilMailFolderGUI::class,
266 'mobj_id',
267 $this->current_folder_id
268 );
269 $this->ctrl->redirectByClass(ilMailFolderGUI::class, 'showMail');
270 } elseif ($type === 'add_subfolder') {
271 $this->ctrl->redirectByClass($target_class, 'addSubFolder');
272 } elseif ($type === 'enter_folderdata') {
273 $this->ctrl->redirectByClass($target_class, 'enterFolderData');
274 } elseif ($type === 'confirmdelete_folderdata') {
275 $this->ctrl->redirectByClass($target_class, 'confirmDeleteFolder');
276 } else {
277 $this->ctrl->redirectByClass($target_class);
278 }
279 }

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 281 of file class.ilMailGUI.php.

281 : void
282 {
283 global $DIC;
284
285 $DIC['ilHelp']->setScreenIdComponent('mail');
286
287 $this->tpl->loadStandardTemplate();
288 $this->tpl->setTitleIcon(ilUtil::getImagePath('standard/icon_mail.svg'));
289
290 $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mobj_id', $this->current_folder_id);
291 $DIC->tabs()->addTarget('fold', $this->ctrl->getLinkTargetByClass(ilMailFolderGUI::class));
292 $this->ctrl->clearParametersByClass(ilMailFormGUI::class);
293
294 $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_NEW);
295 $this->ctrl->setParameterByClass(ilMailFormGUI::class, 'mobj_id', $this->current_folder_id);
296 $DIC->tabs()->addTarget('compose', $this->ctrl->getLinkTargetByClass(ilMailFormGUI::class));
297 $this->ctrl->clearParametersByClass(ilMailFormGUI::class);
298
299 $this->ctrl->setParameterByClass(ilContactGUI::class, 'mobj_id', $this->current_folder_id);
300 $DIC->tabs()->addTarget(
301 'mail_addressbook',
302 $this->ctrl->getLinkTargetByClass(ilContactGUI::class)
303 );
304 $this->ctrl->clearParametersByClass(ilContactGUI::class);
305
306 $this->ctrl->setParameterByClass(
307 ilMailAttachmentGUI::class,
308 'mobj_id',
309 $this->current_folder_id
310 );
311 $DIC->tabs()->addTarget(
312 'mail_manage_attachments',
313 $this->ctrl->getLinkTargetByClass([self::class, ilMailAttachmentGUI::class])
314 );
315 $this->ctrl->clearParametersByClass(ilMailAttachmentGUI::class);
316
317 if ($DIC->settings()->get('show_mail_settings', '0')) {
318 $this->ctrl->setParameterByClass(
319 ilMailOptionsGUI::class,
320 'mobj_id',
321 $this->current_folder_id
322 );
323 $DIC->tabs()->addTarget(
324 'options',
325 $this->ctrl->getLinkTargetByClass(ilMailOptionsGUI::class)
326 );
327 $this->ctrl->clearParametersByClass(ilMailOptionsGUI::class);
328 }
329
330 match (strtolower($this->forward_class)) {
331 strtolower(ilMailFormGUI::class) => $DIC->tabs()->setTabActive('compose'),
332 strtolower(ilContactGUI::class) => $DIC->tabs()->setTabActive('mail_addressbook'),
333 strtolower(ilMailOptionsGUI::class) => $DIC->tabs()->setTabActive('options'),
334 strtolower(ilMailAttachmentGUI::class) => $DIC->tabs()->setTabActive('mail_manage_attachments'),
335 default => $DIC->tabs()->setTabActive('fold'),
336 };
337
338 if ($this->http->wrapper()->query()->has('message_sent')) {
339 $DIC->tabs()->setTabActive('fold');
340 }
341 }
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(), ILIAS\FileDelivery\http(), and ilMailFormGUI\MAIL_FORM_TYPE_NEW.

Referenced by executeCommand().

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

◆ toggleExplorerNodeState()

ilMailGUI::toggleExplorerNodeState ( )
protected

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

343 : void
344 {
345 $exp = new ilMailExplorer($this, $this->user->getId());
346 $exp->toggleExplorerNodeState();
347 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

readonly ilCtrlInterface ilMailGUI::$ctrl
private

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

◆ $current_folder_id

int ilMailGUI::$current_folder_id = 0
private

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

◆ $forward_class

string ilMailGUI::$forward_class = ''
private

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

◆ $http

readonly GlobalHttpState ilMailGUI::$http
private

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

◆ $lng

readonly ilLanguage ilMailGUI::$lng
private

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

◆ $mbox

ilMailbox ilMailGUI::$mbox

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

◆ $refinery

readonly Refinery ilMailGUI::$refinery
private

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

◆ $tpl

readonly ilGlobalTemplateInterface ilMailGUI::$tpl
private

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

◆ $umail

ilMail ilMailGUI::$umail

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

◆ $user

readonly ilObjUser ilMailGUI::$user
private

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


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