ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMailOptionsFormGUI Class Reference
+ Inheritance diagram for ilMailOptionsFormGUI:
+ Collaboration diagram for ilMailOptionsFormGUI:

Public Member Functions

 __construct (protected ilMailOptions $options, object $parent_gui, protected string $positive_command, ?AutoresponderRepository $auto_responder_repository=null)
 
 save ()
 
 populate ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 getInput (string $a_post_var, bool $ensureValidation=true)
 Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Protected Member Functions

 init ()
 
- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 
 checkForRequiredField ()
 

Protected Attributes

object $parent_gui
 
AutoResponderRepository $auto_responder_repository
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Private Attributes

readonly int $default_auto_responder_absence_end_ts
 

Detailed Description

Definition at line 25 of file class.ilMailOptionsFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailOptionsFormGUI::__construct ( protected ilMailOptions  $options,
object  $parent_gui,
protected string  $positive_command,
?AutoresponderRepository  $auto_responder_repository = null 
)

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

36 {
37 if (!method_exists($parent_gui, 'executeCommand')) {
38 throw new InvalidArgumentException(sprintf(
39 'Parameter $parent_gui must be ilCtrlInterface enabled by implementing executeCommand(), %s given.',
40 $parent_gui::class
41 ));
42 }
43
45 global $DIC;
46 $this->parent_gui = $parent_gui;
47 $this->positive_command = $positive_command;
48 $this->auto_responder_repository = $auto_responder_repository ?? new AutoresponderDatabaseRepository($DIC->database());
49 $this->default_auto_responder_absence_end_ts = time() + 8640;
50
51 $this->init();
52 }
AutoResponderRepository $auto_responder_repository
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $auto_responder_repository, $DIC, $parent_gui, ILIAS\GlobalScreen\Provider\__construct(), and init().

+ Here is the call graph for this function:

Member Function Documentation

◆ init()

ilMailOptionsFormGUI::init ( )
protected

Definition at line 54 of file class.ilMailOptionsFormGUI.php.

54 : void
55 {
56 $this->setTitle($this->lng->txt('mail_settings'));
57 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui, $this->positive_command));
58
59 if ($this->options->mayModifyIndividualTransportSetting()) {
60 $incoming_mail_gui = new ilIncomingMailInputGUI(
61 $this->lng->txt('mail_incoming'),
62 'incoming_type',
63 false
64 );
65 $this->addItem($incoming_mail_gui);
66 }
67
68 $absence = new ilCheckboxInputGUI($this->lng->txt('mail_absence_status'), 'absence_status');
69 $absence->setInfo($this->lng->txt('mail_absence_status_info'));
70 $absence->setValue("1");
71 $this->lng->loadLanguageModule('dateplaner');
72 $duration = new ilDateDurationInputGUI($this->lng->txt('mail_absence_duration'), 'absence_duration');
73 $duration->setRequired(true);
74 $duration->setStartText($this->lng->txt('mail_absent_from'));
75 $duration->setEndText($this->lng->txt('mail_absent_until'));
76 $duration->setShowTime(true);
77 $auto_responder_subject = new ilTextInputGUI($this->lng->txt('mail_absence_auto_responder_subject'), 'absence_auto_responder_subject');
78 $auto_responder_subject->setMaxLength(200);
79 $auto_responder_subject->setRequired(true);
80 $auto_responder_body = new ilTextAreaInputGUI($this->lng->txt('mail_absence_auto_responder_body'), 'absence_auto_responder_body');
81 $idle_time = (int) $this->settings->get('mail_auto_responder_idle_time', (string) AutoresponderService::AUTO_RESPONDER_DEFAULT_IDLE_TIME);
82 if ($idle_time === 1) {
83 $auto_responder_body->setInfo($this->lng->txt('mail_absence_auto_responder_body_info_single_day'));
84 } else {
85 $auto_responder_body->setInfo(sprintf($this->lng->txt('mail_absence_auto_responder_body_info'), $idle_time));
86 }
87 $auto_responder_body->setRequired(true);
88 $auto_responder_body->setCols(60);
89 $auto_responder_body->setRows(10);
90 $absence->addSubItem($duration);
91 $absence->addSubItem($auto_responder_subject);
92 $absence->addSubItem($auto_responder_body);
93 $this->addItem($absence);
94
95 $ta = new ilTextAreaInputGUI($this->lng->txt('signature'), 'signature');
96 $ta->setRows(10);
97 $ta->setCols(60);
98 $this->addItem($ta);
99
100 if ($this->settings->get('mail_notification', '0')
101 && $this->options->mayModifyNewMailNotificationSetting()) {
102 $cb = new ilCheckboxInputGUI(
103 $this->lng->txt('cron_mail_notification'),
104 'cronjob_notification'
105 );
106 $cb->setInfo($this->lng->txt('mail_cronjob_notification_info'));
107 $cb->setValue('1');
108 $this->addItem($cb);
109 }
110
111 $this->addCommandButton($this->positive_command, $this->lng->txt('save'));
112 }
$duration
This class represents a checkbox property in a property form.
input GUI for a time span (start and end date)
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $duration, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), ILIAS\Repository\settings(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

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

◆ populate()

ilMailOptionsFormGUI::populate ( )

Definition at line 168 of file class.ilMailOptionsFormGUI.php.

168 : void
169 {
170 $data = [
171 'signature' => $this->options->getSignature(),
172 'absence_status' => $this->options->getAbsenceStatus(),
173 'absence_duration' => [
174 'start' => (new ilDateTime(($this->options->getAbsentFrom() ?: time()), IL_CAL_UNIX))->get(IL_CAL_DATETIME),
175 'end' => (new ilDateTime(($this->options->getAbsentUntil() ?: $this->default_auto_responder_absence_end_ts), IL_CAL_UNIX))->get(IL_CAL_DATETIME),
176 ],
177 'absence_auto_responder_subject' => $this->options->getAbsenceAutoresponderSubject(),
178 'absence_auto_responder_body' => $this->options->getAbsenceAutoresponderBody(),
179 ];
180
181 if ($this->options->mayModifyIndividualTransportSetting()) {
182 $data['incoming_type'] = $this->options->getIncomingType();
183
184 $mail_address_option = $this->options->getEmailAddressMode();
185
186 $data['mail_address_option'] = $mail_address_option;
187 $data['mail_address_option_both'] = $mail_address_option;
188 }
189
190 if ($this->options->mayModifyNewMailNotificationSetting()) {
191 $data['cronjob_notification'] = $this->options->isCronJobNotificationEnabled();
192 }
193
194 $this->setValuesByArray($data);
195 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)

References $data, IL_CAL_DATETIME, IL_CAL_UNIX, and ilPropertyFormGUI\setValuesByArray().

Referenced by ilMailOptionsGUI\showOptions().

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

◆ save()

ilMailOptionsFormGUI::save ( )

Definition at line 114 of file class.ilMailOptionsFormGUI.php.

114 : bool
115 {
116 if (!$this->checkInput()) {
117 return false;
118 }
119
120 if ($this->options->mayModifyIndividualTransportSetting()) {
121 $incoming_type = (int) $this->getInput('incoming_type');
122
123 $mail_address_option = $this->options->getEmailAddressMode();
124 switch ($incoming_type) {
126 $mail_address_option = (int) $this->getInput('mail_address_option');
127 break;
128
130 $mail_address_option = (int) $this->getInput('mail_address_option_both');
131 break;
132 }
133 } else {
134 $incoming_type = $this->options->getIncomingType();
135 $mail_address_option = $this->options->getEmailAddressMode();
136 }
137
138 if ($this->options->mayModifyNewMailNotificationSetting()) {
139 $cronjob_notification_status = (bool) $this->getInput('cronjob_notification');
140 } else {
141 $cronjob_notification_status = $this->options->isCronJobNotificationEnabled();
142 }
143
144 $absence_duration = $this->getItemByPostVar('absence_duration');
145 $absence_status = (bool) $this->getInput('absence_status');
146 $old_absence_status = $this->options->getAbsenceStatus();
147 if (!$absence_status && $old_absence_status) {
148 $this->auto_responder_repository->deleteBySenderId($this->user->getId());
149 }
150 $this->options->setAbsenceStatus((bool) $this->getInput('absence_status'));
151 if ($absence_duration && $absence_duration->getStart() && $absence_duration->getEnd()) {
152 $this->options->setAbsentFrom($absence_duration->getStart()->get(IL_CAL_UNIX));
153 $this->options->setAbsentUntil($absence_duration->getEnd()->get(IL_CAL_UNIX));
154 }
155 $this->options->setAbsenceAutoresponderSubject($this->getInput('absence_auto_responder_subject'));
156 $this->options->setAbsenceAutoresponderBody($this->getInput('absence_auto_responder_body'));
157
158 $this->options->setSignature($this->getInput('signature'));
159 $this->options->setIsCronJobNotificationStatus($cronjob_notification_status);
160 $this->options->setIncomingType($incoming_type);
161 $this->options->setEmailAddressmode($mail_address_option);
162
163 $this->options->updateOptions();
164
165 return true;
166 }
final const int INCOMING_BOTH
final const int INCOMING_EMAIL
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), IL_CAL_UNIX, ilMailOptions\INCOMING_BOTH, ilMailOptions\INCOMING_EMAIL, ILIAS\Repository\int(), and ILIAS\Repository\user().

Referenced by ilMailOptionsGUI\saveOptions().

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

Field Documentation

◆ $auto_responder_repository

AutoResponderRepository ilMailOptionsFormGUI::$auto_responder_repository
protected

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

Referenced by __construct().

◆ $default_auto_responder_absence_end_ts

readonly int ilMailOptionsFormGUI::$default_auto_responder_absence_end_ts
private

Definition at line 27 of file class.ilMailOptionsFormGUI.php.

◆ $parent_gui

object ilMailOptionsFormGUI::$parent_gui
protected

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

Referenced by __construct().


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