ILIAS  release_8 Revision v8.24
class.ilObjMailGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 public const SETTINGS_SUB_TAB_ID_GENERAL = 'settings_general';
29 public const SETTINGS_SUB_TAB_ID_EXTERNAL = 'settings_external';
30 public const PASSWORD_PLACE_HOLDER = '***********************';
31 protected ilTabsGUI $tabs;
32
33 public function __construct($a_data, int $a_id, bool $a_call_by_reference)
34 {
35 global $DIC;
36 $this->type = 'mail';
37 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
38
39 $this->tabs = $DIC->tabs();
40
41 $this->lng->loadLanguageModule('mail');
42 }
43
44 public function executeCommand(): void
45 {
46 $next_class = $this->ctrl->getNextClass($this);
47 $cmd = $this->ctrl->getCmd();
48 $this->prepareOutput();
49
50 switch (strtolower($next_class)) {
51 case strtolower(ilPermissionGUI::class):
52 $perm_gui = new ilPermissionGUI($this);
53 $this->ctrl->forwardCommand($perm_gui);
54 break;
55
56 case strtolower(ilMailTemplateGUI::class):
57 if (!$this->isViewAllowed()) {
58 $this->ilias->raiseError(
59 $this->lng->txt('msg_no_perm_write'),
60 $this->ilias->error_obj->WARNING
61 );
62 }
63
64 $this->ctrl->forwardCommand(new ilMailTemplateGUI($this->object));
65 break;
66
67 default:
68 if (!$cmd) {
69 $cmd = 'view';
70 }
71 $cmd .= 'Object';
72 $this->$cmd();
73 break;
74 }
75 }
76
77 private function isEditingAllowed(): bool
78 {
79 return $this->rbac_system->checkAccess('write', $this->object->getRefId());
80 }
81
82 private function isViewAllowed(): bool
83 {
84 return $this->rbac_system->checkAccess('read', $this->object->getRefId());
85 }
86
87 private function isPermissionChangeAllowed(): bool
88 {
89 return $this->rbac_system->checkAccess('edit_permission', $this->object->getRefId());
90 }
91
92 public function getAdminTabs(): void
93 {
94 $this->getTabs();
95 }
96
97 protected function getTabs(): void
98 {
99 if ($this->isViewAllowed()) {
100 $this->tabs->addTarget(
101 'settings',
102 $this->ctrl->getLinkTarget($this, 'view'),
103 [
104 'view',
105 'save',
106 '',
107 'showExternalSettingsForm',
108 'saveExternalSettingsForm',
109 'sendTestUserMail',
110 'sendTestSystemMail',
111 ]
112 );
113 }
114
115 if ($this->isViewAllowed()) {
116 $this->tabs->addTarget(
117 'mail_templates',
118 $this->ctrl->getLinkTargetByClass(ilMailTemplateGUI::class, 'showTemplates'),
119 '',
120 ilMailTemplateGUI::class
121 );
122 }
123
124 if ($this->isPermissionChangeAllowed()) {
125 $this->tabs->addTarget(
126 'perm_settings',
127 $this->ctrl->getLinkTargetByClass([get_class($this), ilPermissionGUI::class], 'perm'),
128 ['perm', 'info', 'owner'],
129 ilPermissionGUI::class
130 );
131 }
132 }
133
134 protected function buildSettingsSubTabs(string $activeSubTab): void
135 {
136 if ($this->isViewAllowed()) {
137 $this->tabs->addSubTab(
138 self::SETTINGS_SUB_TAB_ID_GENERAL,
139 $this->lng->txt('mail_settings_general_tab'),
140 $this->ctrl->getLinkTarget($this, 'view')
141 );
142
143 if ($this->settings->get('mail_allow_external', '0')) {
144 $this->tabs->addSubTab(
145 self::SETTINGS_SUB_TAB_ID_EXTERNAL,
146 $this->lng->txt('mail_settings_external_tab'),
147 $this->ctrl->getLinkTarget($this, 'showExternalSettingsForm')
148 );
149 }
150
151 $this->tabs->activateSubTab($activeSubTab);
152 }
153 }
154
155 public function viewObject(): void
156 {
158 }
159
160 protected function showGeneralSettingsForm(ilPropertyFormGUI $form = null): void
161 {
162 if (!$this->isViewAllowed()) {
163 $this->ilias->raiseError($this->lng->txt('msg_no_perm_write'), $this->ilias->error_obj->WARNING);
164 }
165
166 $this->buildSettingsSubTabs(self::SETTINGS_SUB_TAB_ID_GENERAL);
167
168 if ($form === null) {
169 $form = $this->getGeneralSettingsForm();
170 $this->populateGeneralSettingsForm($form);
171 }
172
173 $this->tpl->setContent($form->getHTML());
174 }
175
177 {
178 $form = new ilPropertyFormGUI();
179
180 $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
181 $form->setTitle($this->lng->txt('general_settings'));
182
183 $cb = new ilCheckboxInputGUI($this->lng->txt('mail_allow_external'), 'mail_allow_external');
184 $cb->setInfo($this->lng->txt('mail_allow_external_info'));
185 $cb->setValue('1');
186 $cb->setDisabled(!$this->isEditingAllowed());
187 $form->addItem($cb);
188
189 $incoming_mail_gui = new ilIncomingMailInputGUI(
190 $this->lng->txt('mail_incoming'),
191 'incoming_type'
192 );
193 $incoming_mail_gui->setDisabled(!$this->isEditingAllowed());
194 $this->ctrl->setParameterByClass(ilObjUserFolderGUI::class, 'ref_id', USER_FOLDER_ID);
195 $incoming_mail_gui->setInfo(sprintf(
196 $this->lng->txt('mail_settings_incoming_type_see_also'),
197 $this->ctrl->getLinkTargetByClass(ilObjUserFolderGUI::class, 'settings')
198 ));
199 $this->ctrl->clearParametersByClass(ilObjUserFolderGUI::class);
200 $form->addItem($incoming_mail_gui);
201
202 $show_mail_settings_gui = new ilCheckboxInputGUI(
203 $this->lng->txt('show_mail_settings'),
204 'show_mail_settings'
205 );
206 $show_mail_settings_gui->setInfo($this->lng->txt('show_mail_settings_info'));
207 $show_mail_settings_gui->setValue('1');
208 $form->addItem($show_mail_settings_gui);
209
210 $ti = new ilNumberInputGUI($this->lng->txt('mail_maxsize_attach'), 'mail_maxsize_attach');
211 $ti->setSuffix($this->lng->txt('kb'));
212 $ti->setInfo($this->lng->txt('mail_max_size_attachments_total'));
213 $ti->setMaxLength(10);
214 $ti->setSize(10);
215 $ti->setDisabled(!$this->isEditingAllowed());
216 $form->addItem($ti);
217
218 $mn = new ilFormSectionHeaderGUI();
219 $mn->setTitle($this->lng->txt('mail_member_notification'));
220 $form->addItem($mn);
221
222 $cron_mail = new ilSelectInputGUI(
223 $this->lng->txt('cron_mail_notification'),
224 'mail_notification'
225 );
226 $cron_options = [
227 0 => $this->lng->txt('cron_mail_notification_never'),
228 1 => $this->lng->txt('cron_mail_notification_cron'),
229 ];
230 $cron_mail->setOptions($cron_options);
231 $cron_mail->setInfo(sprintf(
232 $this->lng->txt('cron_mail_notification_desc'),
233 $this->lng->txt('mail_allow_external')
234 ));
235 $cron_mail->setDisabled(!$this->isEditingAllowed());
236 $form->addItem($cron_mail);
237
240 $form,
241 $this
242 );
243
244 if ($this->isEditingAllowed()) {
245 $form->addCommandButton('save', $this->lng->txt('save'));
246 }
247
248 return $form;
249 }
250
251 protected function populateGeneralSettingsForm(ilPropertyFormGUI $form): void
252 {
253 $form->setValuesByArray([
254 'mail_allow_external' => (bool) $this->settings->get('mail_allow_external', '0'),
255 'incoming_type' => (string) $this->settings->get('mail_incoming_mail', '0'),
256 'mail_address_option' => $this->settings->get('mail_address_option', '') !== '' ?
257 $this->settings->get('mail_address_option') :
259 'mail_address_option_both' => $this->settings->get('mail_address_option', '') !== '' ?
260 $this->settings->get('mail_address_option') :
262 'show_mail_settings' => (bool) $this->settings->get('show_mail_settings', '1'),
263 'mail_maxsize_attach' => $this->settings->get('mail_maxsize_attach', ''),
264 'mail_notification' => $this->settings->get('mail_notification', ''),
265 ]);
266 }
267
268 public function saveObject(): void
269 {
270 if (!$this->isEditingAllowed()) {
271 $this->ilias->raiseError($this->lng->txt('msg_no_perm_write'), $this->ilias->error_obj->WARNING);
272 }
273
274 $form = $this->getGeneralSettingsForm();
275 if ($form->checkInput()) {
276 $incoming_type = (int) $form->getInput('incoming_type');
277
278 $mail_address_option = ilMailOptions::FIRST_EMAIL;
279 if ($incoming_type === ilMailOptions::INCOMING_EMAIL) {
280 $mail_address_option = (int) $form->getInput('mail_address_option');
281 } elseif ($incoming_type === ilMailOptions::INCOMING_BOTH) {
282 $mail_address_option = (int) $form->getInput('mail_address_option_both');
283 }
284
285 $this->settings->set('mail_allow_external', (string) ((int) $form->getInput('mail_allow_external')));
286 $this->settings->set('mail_incoming_mail', (string) $incoming_type);
287 $this->settings->set('show_mail_settings', (string) ((int) $form->getInput('show_mail_settings')));
288 $this->settings->set('mail_address_option', (string) $mail_address_option);
289 $this->settings->set('mail_maxsize_attach', (string) $form->getInput('mail_maxsize_attach'));
290 $this->settings->set('mail_notification', (string) ((int) $form->getInput('mail_notification')));
291
292 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
293 $this->ctrl->redirect($this);
294 }
295
296 $form->setValuesByPost();
297 $this->showGeneralSettingsForm($form);
298 }
299
300 protected function showExternalSettingsFormObject(ilPropertyFormGUI $form = null): void
301 {
302 if (!$this->isViewAllowed()) {
303 $this->ilias->raiseError($this->lng->txt('msg_no_perm_write'), $this->ilias->error_obj->WARNING);
304 }
305
306 $this->buildSettingsSubTabs(self::SETTINGS_SUB_TAB_ID_EXTERNAL);
307
308 if ($form === null) {
309 $form = $this->getExternalSettingsForm();
310 $this->populateExternalSettingsForm($form);
311 }
312
313 if ($this->user->getEmail() !== '') {
315 $btn->setUrl($this->ctrl->getLinkTarget($this, 'sendTestUserMail'));
316 $btn->setCaption('mail_external_send_test_usr');
317 $this->toolbar->addButtonInstance($btn);
318
320 $btn->setUrl($this->ctrl->getLinkTarget($this, 'sendTestSystemMail'));
321 $btn->setCaption('mail_external_send_test_sys');
322 $this->toolbar->addButtonInstance($btn);
323 }
324
325 $this->tpl->setContent($form->getHTML());
326 }
327
328 protected function sendTestUserMailObject(): void
329 {
330 $this->sendTestMail(true);
331 }
332
333 protected function sendTestSystemMailObject(): void
334 {
335 $this->sendTestMail();
336 }
337
338 protected function sendTestMail(bool $isManualMail = false): void
339 {
340 if (!$this->isViewAllowed()) {
341 $this->ilias->raiseError($this->lng->txt('msg_no_perm_write'), $this->ilias->error_obj->WARNING);
342 }
343
344 if ($this->user->getEmail() === '') {
346 return;
347 }
348
349 if ($isManualMail) {
350 $mail = new ilMail($this->user->getId());
351 } else {
352 $mail = new ilMail(ANONYMOUS_USER_ID);
353 }
354
355 $mail->setSaveInSentbox(false);
356 $mail->appendInstallationSignature(true);
357
358 $lngVariablePrefix = 'sys';
359 if ($isManualMail) {
360 $lngVariablePrefix = 'usr';
361 }
362
363 $mail->enqueue(
364 $this->user->getEmail(),
365 '',
366 '',
367 $this->lng->txt('mail_email_' . $lngVariablePrefix . '_subject'),
368 $this->lng->txt('mail_email_' . $lngVariablePrefix . '_body'),
369 []
370 );
371
372 $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_external_test_sent'));
374 }
375
377 {
378 $form = new ilPropertyFormGUI();
379
380 $form->setFormAction($this->ctrl->getFormAction($this, 'saveExternalSettingsForm'));
381 $form->setTitle($this->lng->txt('mail_settings_external_frm_head'));
382
383 $smtp = new ilCheckboxInputGUI($this->lng->txt('mail_smtp_status'), 'mail_smtp_status');
384 $smtp->setInfo($this->lng->txt('mail_smtp_status_info'));
385 $smtp->setValue('1');
386 $smtp->setDisabled(!$this->isEditingAllowed());
387 $form->addItem($smtp);
388
389 $host = new ilTextInputGUI($this->lng->txt('mail_smtp_host'), 'mail_smtp_host');
390 $host->setInfo($this->lng->txt('mail_smtp_host_info'));
391 $host->setRequired(true);
392 $host->setDisabled(!$this->isEditingAllowed());
393 $smtp->addSubItem($host);
394
395 $port = new ilNumberInputGUI($this->lng->txt('mail_smtp_port'), 'mail_smtp_port');
396 $port->setInfo($this->lng->txt('mail_smtp_port_info'));
397 $port->allowDecimals(false);
398 $port->setMinValue(0);
399 $port->setMinValue(0);
400 $port->setRequired(true);
401 $port->setDisabled(!$this->isEditingAllowed());
402 $smtp->addSubItem($port);
403
404 $encryption = new ilSelectInputGUI(
405 $this->lng->txt('mail_smtp_encryption'),
406 'mail_smtp_encryption'
407 );
408 $encryptionOptions = [
409 '' => $this->lng->txt('please_choose'),
410 'tls' => $this->lng->txt('mail_smtp_encryption_tls'),
411 'ssl' => $this->lng->txt('mail_smtp_encryption_ssl'),
412 ];
413
414 $encryption->setOptions($encryptionOptions);
415 $encryption->setDisabled(!$this->isEditingAllowed());
416 $smtp->addSubItem($encryption);
417
418 $user = new ilTextInputGUI($this->lng->txt('mail_smtp_user'), 'mail_smtp_user');
419 $user->setDisabled(!$this->isEditingAllowed());
420 $user->setDisableHtmlAutoComplete(true);
421 $smtp->addSubItem($user);
422
423 $password = new ilPasswordInputGUI(
424 $this->lng->txt('mail_smtp_password'),
425 'mail_smtp_password'
426 );
427 $password->setRetype(false);
428 $password->setSkipSyntaxCheck(true);
429 $password->setDisabled(!$this->isEditingAllowed());
430 $password->setDisableHtmlAutoComplete(true);
431 $smtp->addSubItem($password);
432
433 $pre = new ilTextInputGUI($this->lng->txt('mail_subject_prefix'), 'mail_subject_prefix');
434 $pre->setSize(12);
435 $pre->setMaxLength(32);
436 $pre->setInfo($this->lng->txt('mail_subject_prefix_info'));
437 $pre->setDisabled(!$this->isEditingAllowed());
438 $form->addItem($pre);
439
440 $send_html = new ilCheckboxInputGUI($this->lng->txt('mail_send_html'), 'mail_send_html');
441 $send_html->setInfo($this->lng->txt('mail_send_html_info'));
442 $send_html->setValue('1');
443 $send_html->setDisabled(!$this->isEditingAllowed());
444 $form->addItem($send_html);
445
446 $sh = new ilFormSectionHeaderGUI();
447 $sh->setTitle($this->lng->txt('mail_settings_user_frm_head'));
448 $form->addItem($sh);
449
450 $user_from_address = new ilEMailInputGUI(
451 $this->lng->txt('mail_system_usr_from_addr'),
452 'mail_system_usr_from_addr'
453 );
454 $user_from_address->setInfo($this->lng->txt('mail_system_usr_from_addr_info'));
455 $user_from_address->setRequired(true);
456 $user_from_address->setDisabled(!$this->isEditingAllowed());
457 $form->addItem($user_from_address);
458
459 $useGlobalReplyToAddress = new ilCheckboxInputGUI(
460 $this->lng->txt('mail_use_global_reply_to_addr'),
461 'use_global_reply_to_addr'
462 );
463 $useGlobalReplyToAddress->setInfo($this->lng->txt('mail_use_global_reply_to_addr_info'));
464 $useGlobalReplyToAddress->setValue('1');
465 $useGlobalReplyToAddress->setDisabled(!$this->isEditingAllowed());
466 $form->addItem($useGlobalReplyToAddress);
467 $globalReplyTo = new ilEMailInputGUI(
468 $this->lng->txt('mail_global_reply_to_addr'),
469 'global_reply_to_addr'
470 );
471 $globalReplyTo->setInfo($this->lng->txt('mail_global_reply_to_addr_info'));
472 $globalReplyTo->setRequired(true);
473 $globalReplyTo->setDisabled(!$this->isEditingAllowed());
474 $useGlobalReplyToAddress->addSubItem($globalReplyTo);
475
476 $user_from_name = new ilTextInputGUI(
477 $this->lng->txt('mail_system_usr_from_name'),
478 'mail_system_usr_from_name'
479 );
480 $user_from_name->setInfo($this->lng->txt('mail_system_usr_from_name_info'));
481 $user_from_name->setRequired(true);
482 $user_from_name->setDisabled(!$this->isEditingAllowed());
483 $form->addItem($user_from_name);
484
485 $user_envelope_from_addr = new ilEMailInputGUI(
486 $this->lng->txt('mail_system_usr_env_from_addr'),
487 'mail_system_usr_env_from_addr'
488 );
489 $user_envelope_from_addr->setInfo($this->lng->txt('mail_system_usr_env_from_addr_info'));
490 $user_envelope_from_addr->setDisabled(!$this->isEditingAllowed());
491 $form->addItem($user_envelope_from_addr);
492
493 $sh = new ilFormSectionHeaderGUI();
494 $sh->setTitle($this->lng->txt('mail_settings_system_frm_head'));
495 $form->addItem($sh);
496
497 $system_from_addr = new ilEMailInputGUI(
498 $this->lng->txt('mail_system_sys_from_addr'),
499 'mail_system_sys_from_addr'
500 );
501 $system_from_addr->setInfo($this->lng->txt('mail_system_sys_from_addr_info'));
502 $system_from_addr->setRequired(true);
503 $system_from_addr->setDisabled(!$this->isEditingAllowed());
504 $form->addItem($system_from_addr);
505
506 $system_from_name = new ilTextInputGUI(
507 $this->lng->txt('mail_system_sys_from_name'),
508 'mail_system_sys_from_name'
509 );
510 $system_from_name->setRequired(true);
511 $system_from_name->setDisabled(!$this->isEditingAllowed());
512 $form->addItem($system_from_name);
513
514 $system_reply_to_addr = new ilEMailInputGUI(
515 $this->lng->txt('mail_system_sys_reply_to_addr'),
516 'mail_system_sys_reply_to_addr'
517 );
518 $system_reply_to_addr->setRequired(true);
519 $system_reply_to_addr->setDisabled(!$this->isEditingAllowed());
520 $form->addItem($system_reply_to_addr);
521
522 $system_return_path = new ilEMailInputGUI(
523 $this->lng->txt('mail_system_sys_env_from_addr'),
524 'mail_system_sys_env_from_addr'
525 );
526 $system_return_path->setInfo($this->lng->txt('mail_system_sys_env_from_addr_info'));
527 $system_return_path->setDisabled(!$this->isEditingAllowed());
528 $form->addItem($system_return_path);
529
530 $signature = new ilTextAreaInputGUI(
531 $this->lng->txt('mail_system_sys_signature'),
532 'mail_system_sys_signature'
533 );
534 $signature->setRows(8);
535 $signature->setDisabled(!$this->isEditingAllowed());
536 $form->addItem($signature);
537
538 $placeholders = new ilManualPlaceholderInputGUI(
539 $this->lng->txt('mail_form_placeholders_label'),
540 'mail_system_sys_signature'
541 );
542 $placeholder_list = [
543 ['placeholder' => 'INSTALLATION_NAME', 'label' => $this->lng->txt('mail_nacc_installation_name')],
544 ['placeholder' => 'INSTALLATION_DESC', 'label' => $this->lng->txt('mail_nacc_installation_desc')],
545 ['placeholder' => 'ILIAS_URL', 'label' => $this->lng->txt('mail_nacc_ilias_url')],
546 ];
547 foreach ($placeholder_list as $value) {
548 $placeholders->addPlaceholder($value['placeholder'], $value['label']);
549 }
550 $placeholders->setDisabled(!$this->isEditingAllowed());
551 $form->addItem($placeholders);
552
553 if ($this->isEditingAllowed()) {
554 $form->addCommandButton('saveExternalSettingsForm', $this->lng->txt('save'));
555 }
556
557 return $form;
558 }
559
560 protected function populateExternalSettingsForm(ilPropertyFormGUI $form): void
561 {
562 $subjectPrefix = $this->settings->get('mail_subject_prefix');
563 if (null === $subjectPrefix) {
564 $subjectPrefix = ilMimeMail::MAIL_SUBJECT_PREFIX;
565 }
566
567 $form->setValuesByArray([
568 'mail_smtp_status' => (bool) $this->settings->get('mail_smtp_status', '0'),
569 'mail_smtp_host' => $this->settings->get('mail_smtp_host', ''),
570 'mail_smtp_port' => $this->settings->get('mail_smtp_port', ''),
571 'mail_smtp_user' => $this->settings->get('mail_smtp_user', ''),
572 'mail_smtp_password' => $this->settings->get('mail_smtp_password') !== '' ?
573 self::PASSWORD_PLACE_HOLDER :
574 '',
575 'mail_smtp_encryption' => $this->settings->get('mail_smtp_encryption', ''),
576 'mail_subject_prefix' => $subjectPrefix,
577 'mail_send_html' => (bool) $this->settings->get('mail_send_html', '0'),
578 'mail_system_usr_from_addr' => $this->settings->get('mail_system_usr_from_addr', ''),
579 'mail_system_usr_from_name' => $this->settings->get('mail_system_usr_from_name', ''),
580 'mail_system_usr_env_from_addr' => $this->settings->get('mail_system_usr_env_from_addr', ''),
581 'mail_system_sys_from_addr' => $this->settings->get('mail_system_sys_from_addr', ''),
582 'mail_system_sys_from_name' => $this->settings->get('mail_system_sys_from_name', ''),
583 'mail_system_sys_reply_to_addr' => $this->settings->get('mail_system_sys_reply_to_addr', ''),
584 'mail_system_sys_env_from_addr' => $this->settings->get('mail_system_sys_env_from_addr', ''),
585 'mail_system_sys_signature' => $this->settings->get('mail_system_sys_signature', ''),
586 'use_global_reply_to_addr' => (bool) $this->settings->get('use_global_reply_to_addr', '0'),
587 'global_reply_to_addr' => $this->settings->get('global_reply_to_addr', ''),
588 ]);
589 }
590
591 protected function saveExternalSettingsFormObject(): void
592 {
593 if (!$this->isEditingAllowed()) {
594 $this->ilias->raiseError($this->lng->txt('msg_no_perm_write'), $this->ilias->error_obj->WARNING);
595 }
596
597 $form = $this->getExternalSettingsForm();
598 $isFormValid = $form->checkInput();
599
600 if (!$isFormValid) {
601 $form->setValuesByPost();
602 $this->showExternalSettingsFormObject($form);
603 return;
604 }
605
606 $isSmtpEnabled = (bool) $form->getInput('mail_smtp_status');
607 if ($isSmtpEnabled && $form->getInput('mail_smtp_user') &&
608 !$form->getInput('mail_smtp_password')
609 ) {
610 $form->getItemByPostVar('mail_smtp_password')->setRequired(true);
611 $form->getItemByPostVar('mail_smtp_password')
612 ->setAlert($this->lng->txt('mail_smtp_password_req'));
613 $form->setValuesByPost();
614 $this->showExternalSettingsFormObject($form);
615 return;
616 }
617
618 $this->settings->set('mail_smtp_status', (string) ((int) $form->getInput('mail_smtp_status')));
619 $this->settings->set('mail_smtp_host', (string) $form->getInput('mail_smtp_host'));
620 $this->settings->set('mail_smtp_port', (string) ((int) $form->getInput('mail_smtp_port')));
621 $this->settings->set('mail_smtp_user', (string) $form->getInput('mail_smtp_user'));
622 if ($form->getInput('mail_smtp_password') !== self::PASSWORD_PLACE_HOLDER) {
623 $this->settings->set('mail_smtp_password', (string) $form->getInput('mail_smtp_password'));
624 }
625 $this->settings->set('mail_smtp_encryption', (string) $form->getInput('mail_smtp_encryption'));
626 $this->settings->set('mail_send_html', (string) $form->getInput('mail_send_html'));
627 $this->settings->set('mail_subject_prefix', (string) $form->getInput('mail_subject_prefix'));
628 $this->settings->set('mail_system_usr_from_addr', (string) $form->getInput('mail_system_usr_from_addr'));
629 $this->settings->set('mail_system_usr_from_name', (string) $form->getInput('mail_system_usr_from_name'));
630 $this->settings->set(
631 'mail_system_usr_env_from_addr',
632 (string) $form->getInput('mail_system_usr_env_from_addr')
633 );
634 $this->settings->set(
635 'mail_system_sys_from_addr',
636 (string) $form->getInput('mail_system_sys_from_addr')
637 );
638 $this->settings->set('mail_system_sys_from_name', (string) $form->getInput('mail_system_sys_from_name'));
639 $this->settings->set(
640 'mail_system_sys_reply_to_addr',
641 (string) $form->getInput('mail_system_sys_reply_to_addr')
642 );
643 $this->settings->set(
644 'mail_system_sys_env_from_addr',
645 (string) $form->getInput('mail_system_sys_env_from_addr')
646 );
647 $this->settings->set('use_global_reply_to_addr', (string) ((int) $form->getInput('use_global_reply_to_addr')));
648 $this->settings->set('global_reply_to_addr', (string) $form->getInput('global_reply_to_addr'));
649 $this->settings->set('mail_system_sys_signature', (string) $form->getInput('mail_system_sys_signature'));
650
651 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
652 $this->ctrl->redirect($this, 'showExternalSettingsForm');
653 }
654
655 public static function _goto(string $target): void
656 {
657 global $DIC;
658 $main_tpl = $DIC->ui()->mainTemplate();
659
660 $mail = new ilMail($DIC->user()->getId());
661 $request = $DIC->http()->request();
662
663 if ($DIC->rbac()->system()->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
664 $DIC->ctrl()->redirectToURL('ilias.php?baseClass=ilMailGUI');
665 } elseif ($DIC->access()->checkAccess('read', '', ROOT_FOLDER_ID)) {
666 $main_tpl->setOnScreenMessage('failure', sprintf(
667 $DIC->language()->txt('msg_no_perm_read_item'),
669 ), true);
670
671 $DIC->ctrl()->setTargetScript('ilias.php');
672 $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, 'ref_id', ROOT_FOLDER_ID);
673 $DIC->ctrl()->redirectByClass(ilRepositoryGUI::class);
674 }
675
676 $DIC['ilErr']->raiseError($DIC->language()->txt('msg_no_perm_read'), $DIC['ilErr']->FATAL);
677 }
678}
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
This class represents a checkbox property in a property form.
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...
Class ilIncomingMailInputGUI.
Class ilMailTemplateGUI.
Class ilManualPlaceholderInputGUI.
const MAIL_SUBJECT_PREFIX
This class represents a number property in a property form.
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
sendTestMail(bool $isManualMail=false)
const SETTINGS_SUB_TAB_ID_GENERAL
populateGeneralSettingsForm(ilPropertyFormGUI $form)
const SETTINGS_SUB_TAB_ID_EXTERNAL
getAdminTabs()
administration tabs show only permissions and trash folder
__construct($a_data, int $a_id, bool $a_call_by_reference)
showExternalSettingsFormObject(ilPropertyFormGUI $form=null)
static _goto(string $target)
getTabs()
@abstract overwrite in derived GUI class of your object type
buildSettingsSubTabs(string $activeSubTab)
showGeneralSettingsForm(ilPropertyFormGUI $form=null)
populateExternalSettingsForm(ilPropertyFormGUI $form)
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput(bool $show_sub_objects=true)
ServerRequestInterface $request
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
const USER_FOLDER_ID
Definition: constants.php:33
const ANONYMOUS_USER_ID
Definition: constants.php:27
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
header include for all ilias files.