19 declare(strict_types=1);
34 protected string $positive_command,
37 if (!method_exists($parent_gui,
'executeCommand')) {
39 'Parameter $parent_gui must be ilCtrlInterface enabled by implementing executeCommand(), %s given.',
47 $this->positive_command = $positive_command;
49 $this->default_auto_responder_absence_end_ts = time() + 8640;
54 protected function init(): void
57 $this->
setFormAction($this->
ctrl->getFormAction($this->parent_gui, $this->positive_command));
59 if ($this->options->maySeeIndividualTransportSettings()) {
61 $this->
lng->txt(
'mail_incoming'),
65 $this->
addItem($incoming_mail_gui);
69 $absence->setInfo($this->
lng->txt(
'mail_absence_status_info'));
70 $absence->setValue(
"1");
71 $this->
lng->loadLanguageModule(
'dateplaner');
74 $duration->setStartText($this->
lng->txt(
'mail_absent_from'));
75 $duration->setEndText($this->
lng->txt(
'mail_absent_until'));
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'));
85 $auto_responder_body->setInfo(sprintf($this->
lng->txt(
'mail_absence_auto_responder_body_info'), $idle_time));
87 $auto_responder_body->setRequired(
true);
88 $auto_responder_body->setCols(60);
89 $auto_responder_body->setRows(10);
91 $absence->addSubItem($auto_responder_subject);
92 $absence->addSubItem($auto_responder_body);
100 if ($this->
settings->get(
'mail_notification',
'0')) {
102 $this->
lng->txt(
'cron_mail_notification'),
103 'cronjob_notification' 105 $cb->setInfo($this->
lng->txt(
'mail_cronjob_notification_info'));
119 if ($this->options->mayModifyIndividualTransportSettings()) {
120 $incoming_type = (
int) $this->
getInput(
'incoming_type');
122 $mail_address_option = $this->options->getEmailAddressMode();
123 switch ($incoming_type) {
125 $mail_address_option = (
int) $this->
getInput(
'mail_address_option');
129 $mail_address_option = (
int) $this->
getInput(
'mail_address_option_both');
133 $incoming_type = $this->options->getIncomingType();
134 $mail_address_option = $this->options->getEmailAddressMode();
138 $absence_status = (bool) $this->
getInput(
'absence_status');
139 $old_absence_status = $this->options->getAbsenceStatus();
140 if (!$absence_status && $old_absence_status) {
141 $this->auto_responder_repository->deleteBySenderId($this->
user->getId());
143 $this->options->setAbsenceStatus((
bool) $this->
getInput(
'absence_status'));
144 if ($absence_duration && $absence_duration->getStart() && $absence_duration->getEnd()) {
145 $this->options->setAbsentFrom($absence_duration->getStart()->get(
IL_CAL_UNIX));
146 $this->options->setAbsentUntil($absence_duration->getEnd()->get(
IL_CAL_UNIX));
148 $this->options->setAbsenceAutoresponderSubject($this->
getInput(
'absence_auto_responder_subject'));
149 $this->options->setAbsenceAutoresponderBody($this->
getInput(
'absence_auto_responder_body'));
151 $this->options->setSignature($this->
getInput(
'signature'));
152 $this->options->setIsCronJobNotificationStatus((
bool) $this->
getInput(
'cronjob_notification'));
153 $this->options->setIncomingType($incoming_type);
154 $this->options->setEmailAddressmode($mail_address_option);
156 $this->options->updateOptions();
164 'signature' => $this->options->getSignature(),
165 'cronjob_notification' => $this->options->isCronJobNotificationEnabled(),
166 'absence_status' => $this->options->getAbsenceStatus(),
167 'absence_duration' => [
171 'absence_auto_responder_subject' => $this->options->getAbsenceAutoresponderSubject(),
172 'absence_auto_responder_body' => $this->options->getAbsenceAutoresponderBody(),
175 if ($this->options->maySeeIndividualTransportSettings()) {
176 $data[
'incoming_type'] = $this->options->getIncomingType();
178 $mail_address_option = $this->options->getEmailAddressMode();
180 $data[
'mail_address_option'] = $mail_address_option;
181 $data[
'mail_address_option_both'] = $mail_address_option;
final const int INCOMING_BOTH
final const int INCOMING_EMAIL
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.