ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjMailGUI Class Reference
+ Inheritance diagram for ilObjMailGUI:
+ Collaboration diagram for ilObjMailGUI:

Public Member Functions

 __construct ($a_data, int $a_id, bool $a_call_by_reference)
 
 executeCommand ()
 
 getAdminTabs ()
 
 viewObject ()
 
 saveObject ()
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 if true, a creation screen is displayed the current [ref_id] don't belong to the current class! The mode is determined in ilRepositoryGUI More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto (string $target)
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Data Fields

const SETTINGS_SUB_TAB_ID_GENERAL = 'settings_general'
 
const SETTINGS_SUB_TAB_ID_EXTERNAL = 'settings_external'
 
const PASSWORD_PLACE_HOLDER = '***********************'
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 getTabs ()
 
 buildSettingsSubTabs (string $activeSubTab)
 
 showGeneralSettingsForm (ilPropertyFormGUI $form=null)
 
 getGeneralSettingsForm ()
 
 populateGeneralSettingsForm (ilPropertyFormGUI $form)
 
 showExternalSettingsFormObject (ilPropertyFormGUI $form=null)
 
 sendTestUserMailObject ()
 
 sendTestSystemMailObject ()
 
 sendTestMail (bool $isManualMail=false)
 
 getExternalSettingsForm ()
 
 populateExternalSettingsForm (ilPropertyFormGUI $form)
 
 saveExternalSettingsFormObject ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

ilTabsGUI $tabs
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Member Functions

 isEditingAllowed ()
 
 isViewAllowed ()
 
 isPermissionChangeAllowed ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjMailGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

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  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjMailGUI::_goto ( string  $target)
static

Definition at line 655 of file class.ilObjMailGUI.php.

References $DIC, ilObjectGUI\$request, ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ROOT_FOLDER_ID.

655  : 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  }
const ROOT_FOLDER_ID
Definition: constants.php:32
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
ServerRequestInterface $request
+ Here is the call graph for this function:

◆ buildSettingsSubTabs()

ilObjMailGUI::buildSettingsSubTabs ( string  $activeSubTab)
protected

Definition at line 134 of file class.ilObjMailGUI.php.

References ILIAS\Repository\ctrl(), isViewAllowed(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ILIAS\Repository\tabs().

Referenced by showExternalSettingsFormObject(), and showGeneralSettingsForm().

134  : 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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjMailGUI::executeCommand ( )

Definition at line 44 of file class.ilObjMailGUI.php.

References ILIAS\Repository\ctrl(), isViewAllowed(), ILIAS\Repository\lng(), and ilObjectGUI\prepareOutput().

44  : 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  }
Class ilMailTemplateGUI.
prepareOutput(bool $show_sub_objects=true)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
header include for all ilias files.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjMailGUI::getAdminTabs ( )

Definition at line 92 of file class.ilObjMailGUI.php.

References getTabs().

92  : void
93  {
94  $this->getTabs();
95  }
+ Here is the call graph for this function:

◆ getExternalSettingsForm()

ilObjMailGUI::getExternalSettingsForm ( )
protected

Definition at line 376 of file class.ilObjMailGUI.php.

References ilObjectGUI\$user, ilManualPlaceholderInputGUI\addPlaceholder(), ILIAS\Repository\ctrl(), isEditingAllowed(), ILIAS\Repository\lng(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilPasswordInputGUI\setRetype(), and ilTextAreaInputGUI\setRows().

Referenced by saveExternalSettingsFormObject(), and showExternalSettingsFormObject().

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
addPlaceholder(string $placeholder, string $title)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilManualPlaceholderInputGUI.
This class represents a number property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRequired(bool $a_required)
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGeneralSettingsForm()

ilObjMailGUI::getGeneralSettingsForm ( )
protected

Definition at line 176 of file class.ilObjMailGUI.php.

References ilAdministrationSettingsFormHandler\addFieldsToForm(), ILIAS\Repository\ctrl(), ilAdministrationSettingsFormHandler\FORM_MAIL, isEditingAllowed(), ILIAS\Repository\lng(), ilFormPropertyGUI\setDisabled(), ilFormPropertyGUI\setInfo(), ilNumberInputGUI\setSuffix(), and USER_FOLDER_ID.

Referenced by saveObject(), and showGeneralSettingsForm().

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  }
setSuffix(string $a_value)
const USER_FOLDER_ID
Definition: constants.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
setDisabled(bool $a_disabled)
Class ilIncomingMailInputGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTabs()

ilObjMailGUI::getTabs ( )
protected

Definition at line 97 of file class.ilObjMailGUI.php.

References ILIAS\Repository\ctrl(), isPermissionChangeAllowed(), isViewAllowed(), and ILIAS\Repository\tabs().

Referenced by getAdminTabs().

97  : 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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEditingAllowed()

ilObjMailGUI::isEditingAllowed ( )
private

Definition at line 77 of file class.ilObjMailGUI.php.

References ILIAS\Repository\object().

Referenced by getExternalSettingsForm(), getGeneralSettingsForm(), saveExternalSettingsFormObject(), and saveObject().

77  : bool
78  {
79  return $this->rbac_system->checkAccess('write', $this->object->getRefId());
80  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPermissionChangeAllowed()

ilObjMailGUI::isPermissionChangeAllowed ( )
private

Definition at line 87 of file class.ilObjMailGUI.php.

References ILIAS\Repository\object().

Referenced by getTabs().

87  : bool
88  {
89  return $this->rbac_system->checkAccess('edit_permission', $this->object->getRefId());
90  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isViewAllowed()

ilObjMailGUI::isViewAllowed ( )
private

Definition at line 82 of file class.ilObjMailGUI.php.

References ILIAS\Repository\object().

Referenced by buildSettingsSubTabs(), executeCommand(), getTabs(), sendTestMail(), showExternalSettingsFormObject(), and showGeneralSettingsForm().

82  : bool
83  {
84  return $this->rbac_system->checkAccess('read', $this->object->getRefId());
85  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateExternalSettingsForm()

ilObjMailGUI::populateExternalSettingsForm ( ilPropertyFormGUI  $form)
protected

Definition at line 560 of file class.ilObjMailGUI.php.

References ilMimeMail\MAIL_SUBJECT_PREFIX, ILIAS\Repository\settings(), and ilPropertyFormGUI\setValuesByArray().

Referenced by showExternalSettingsFormObject().

560  : 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  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
const MAIL_SUBJECT_PREFIX
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateGeneralSettingsForm()

ilObjMailGUI::populateGeneralSettingsForm ( ilPropertyFormGUI  $form)
protected

Definition at line 251 of file class.ilObjMailGUI.php.

References ilMailOptions\FIRST_EMAIL, ILIAS\Repository\settings(), and ilPropertyFormGUI\setValuesByArray().

Referenced by showGeneralSettingsForm().

251  : 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  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveExternalSettingsFormObject()

ilObjMailGUI::saveExternalSettingsFormObject ( )
protected

Definition at line 591 of file class.ilObjMailGUI.php.

References ILIAS\Repository\ctrl(), getExternalSettingsForm(), isEditingAllowed(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and showExternalSettingsFormObject().

591  : 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  }
showExternalSettingsFormObject(ilPropertyFormGUI $form=null)
header include for all ilias files.
+ Here is the call graph for this function:

◆ saveObject()

ilObjMailGUI::saveObject ( )

Definition at line 268 of file class.ilObjMailGUI.php.

References ILIAS\Repository\ctrl(), ilMailOptions\FIRST_EMAIL, getGeneralSettingsForm(), ilMailOptions\INCOMING_BOTH, ilMailOptions\INCOMING_EMAIL, ILIAS\Repository\int(), isEditingAllowed(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and showGeneralSettingsForm().

268  : 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  }
header include for all ilias files.
showGeneralSettingsForm(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ sendTestMail()

ilObjMailGUI::sendTestMail ( bool  $isManualMail = false)
protected

Definition at line 338 of file class.ilObjMailGUI.php.

References ANONYMOUS_USER_ID, isViewAllowed(), ILIAS\Repository\lng(), showExternalSettingsFormObject(), and ILIAS\Repository\user().

Referenced by sendTestSystemMailObject(), and sendTestUserMailObject().

338  : 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  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
showExternalSettingsFormObject(ilPropertyFormGUI $form=null)
header include for all ilias files.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendTestSystemMailObject()

ilObjMailGUI::sendTestSystemMailObject ( )
protected

Definition at line 333 of file class.ilObjMailGUI.php.

References sendTestMail().

333  : void
334  {
335  $this->sendTestMail();
336  }
sendTestMail(bool $isManualMail=false)
+ Here is the call graph for this function:

◆ sendTestUserMailObject()

ilObjMailGUI::sendTestUserMailObject ( )
protected

Definition at line 328 of file class.ilObjMailGUI.php.

References sendTestMail().

328  : void
329  {
330  $this->sendTestMail(true);
331  }
sendTestMail(bool $isManualMail=false)
+ Here is the call graph for this function:

◆ showExternalSettingsFormObject()

ilObjMailGUI::showExternalSettingsFormObject ( ilPropertyFormGUI  $form = null)
protected

Definition at line 300 of file class.ilObjMailGUI.php.

References buildSettingsSubTabs(), ILIAS\Repository\ctrl(), getExternalSettingsForm(), ilLinkButton\getInstance(), isViewAllowed(), ILIAS\Repository\lng(), populateExternalSettingsForm(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

Referenced by saveExternalSettingsFormObject(), and sendTestMail().

300  : 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() !== '') {
314  $btn = ilLinkButton::getInstance();
315  $btn->setUrl($this->ctrl->getLinkTarget($this, 'sendTestUserMail'));
316  $btn->setCaption('mail_external_send_test_usr');
317  $this->toolbar->addButtonInstance($btn);
318 
319  $btn = ilLinkButton::getInstance();
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  }
header include for all ilias files.
buildSettingsSubTabs(string $activeSubTab)
populateExternalSettingsForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showGeneralSettingsForm()

ilObjMailGUI::showGeneralSettingsForm ( ilPropertyFormGUI  $form = null)
protected

Definition at line 160 of file class.ilObjMailGUI.php.

References buildSettingsSubTabs(), getGeneralSettingsForm(), isViewAllowed(), ILIAS\Repository\lng(), and populateGeneralSettingsForm().

Referenced by saveObject(), and viewObject().

160  : 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  }
populateGeneralSettingsForm(ilPropertyFormGUI $form)
header include for all ilias files.
buildSettingsSubTabs(string $activeSubTab)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewObject()

ilObjMailGUI::viewObject ( )

Definition at line 155 of file class.ilObjMailGUI.php.

References showGeneralSettingsForm().

155  : void
156  {
157  $this->showGeneralSettingsForm();
158  }
showGeneralSettingsForm(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

Field Documentation

◆ $tabs

ilTabsGUI ilObjMailGUI::$tabs
protected

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

◆ PASSWORD_PLACE_HOLDER

const ilObjMailGUI::PASSWORD_PLACE_HOLDER = '***********************'

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

◆ SETTINGS_SUB_TAB_ID_EXTERNAL

const ilObjMailGUI::SETTINGS_SUB_TAB_ID_EXTERNAL = 'settings_external'

Definition at line 29 of file class.ilObjMailGUI.php.

◆ SETTINGS_SUB_TAB_ID_GENERAL

const ilObjMailGUI::SETTINGS_SUB_TAB_ID_GENERAL = 'settings_general'

Definition at line 28 of file class.ilObjMailGUI.php.


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