19declare(strict_types=1);
45 use FileDataRCHandling;
74 private readonly \Psr\Http\Message\ServerRequestInterface
$request;
91 $this->tpl =
$DIC->ui()->mainTemplate();
92 $this->
ctrl = $DIC->ctrl();
93 $this->
lng = $DIC->language();
94 $this->
user = $DIC->user();
95 $this->
tabs = $DIC->tabs();
96 $this->
toolbar = $DIC->toolbar();
97 $this->
http = $DIC->http();
103 $this->ui_factory =
$DIC->ui()->factory();
104 $this->request =
$DIC->http()->request();
105 $this->ui_renderer =
$DIC->ui()->renderer();
109 $this->storage =
$DIC->resourceStorage();
113 $user_api =
$DIC[
'user'];
114 $this->user_search = $user_api->getSearch();
115 $this->clock = (
new DataFactory())->clock();
120 $this->getQueryParam(
122 $this->refinery->kindlyTo()->int(),
127 if ($mail_obj_id === 0) {
128 $mail_obj_id = $this->mbox->getInboxFolder();
131 $this->
ctrl->setParameter($this,
'mobj_id', $mail_obj_id);
136 if ($this->
http->wrapper()->query()->has($name)) {
137 return $this->
http->wrapper()->query()->retrieve(
148 if ($this->
http->wrapper()->post()->has($name)) {
149 return $this->
http->wrapper()->post()->retrieve(
160 $forward_class = $this->
ctrl->getNextClass($this) ??
'';
161 switch (strtolower($forward_class)) {
162 case strtolower(
ILIAS\User\
Search\EndpointGUI::class):
163 $gui = $this->user_search->getEndpointGUI(
166 $this->
ctrl->forwardCommand($gui);
169 case strtolower(ilMailAttachmentGUI::class):
170 $this->
ctrl->setReturn($this,
'returnFromAttachments');
173 $this->
ctrl->forwardCommand($gui);
176 case strtolower(ilMailSearchGUI::class):
177 $this->
ctrl->setReturn($this,
'searchResults');
181 case strtolower(ilMailSearchCoursesGUI::class):
182 $this->
ctrl->setReturn($this,
'searchResults');
186 case strtolower(ilMailingListsGUI::class):
187 $this->
ctrl->setReturn($this,
'searchResults');
191 case strtolower(ilMailSearchGroupsGUI::class):
192 $this->
ctrl->setReturn($this,
'searchResults');
196 case strtolower(ilMailFormUploadHandlerGUI::class):
197 $this->
ctrl->forwardCommand($this->upload_handler);
201 if (!($cmd = $this->
ctrl->getCmd())) {
217 foreach ($files as $value) {
218 if (is_file($this->mfile->getMailPath() .
'/' . $this->user->getId() .
'_' . urldecode($value))) {
219 $decoded_files[] = urldecode($value);
223 return $decoded_files;
229 if (count($form_values[
'attachments']) > 0) {
230 $files = $this->handleAttachments($form_values[
'attachments']);
236 if ($form_values[
'rcp_to'] !== []) {
237 $rcp_to = $form_values[
'rcp_to'][0];
239 if ($form_values[
'rcp_cc'] !== []) {
240 $rcp_cc = $form_values[
'rcp_cc'][0];
242 if ($form_values[
'rcp_bcc'] !== []) {
243 $rcp_bcc = $form_values[
'rcp_bcc'][0];
246 $errors = $this->umail->validateRecipients(
254 $this->
http->close();
258 $mail_body =
new ilMailBody($message, $this->purifier);
259 $sanitized_message = $mail_body->getContent();
261 $outbox_folder_id = $this->mbox->getOutboxFolder();
267 $this->umail->scheduledMail(
269 $this->
user->getId(),
278 $form_values[
'use_placeholders'],
281 $form_values[
'use_schedule'][
'm_schedule']
290 $this->umail->deleteMails([$draft_id]);
293 $this->
ctrl->setParameterByClass(ilMailFolderGUI::class,
'mobj_id', $outbox_folder_id);
294 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'mail_scheduled'),
true);
299 $this->
ctrl->redirectByClass([ilMailGUI::class, ilMailFolderGUI::class]);
307 $form = $this->
buildForm()->withRequest($this->request);
308 $result = $form->getInputGroup()->getContent();
310 if (!$result->isOK()) {
315 $value = $result->value()[0];
317 $schedule_date = $value[
'use_schedule'][
'm_schedule'] ??
null;
319 $schedule_date instanceof DateTimeImmutable &&
320 $schedule_date > $this->clock->local(
new DateTimeZone($this->
user->getTimeZone()))->now()
327 if (count($value[
'attachments']) > 0) {
328 $files = $this->handleAttachments($value[
'attachments']);
331 $mailer = $this->umail
335 $mailer->setSaveInSentbox(
true);
337 $mailer->autoresponder()->enableAutoresponder();
342 if ($value[
'rcp_to'] != []) {
343 $rcp_to = $value[
'rcp_to'][0];
345 if ($value[
'rcp_cc'] != []) {
346 $rcp_cc = $value[
'rcp_cc'][0];
348 if ($value[
'rcp_bcc'] != []) {
349 $rcp_bcc = $value[
'rcp_bcc'][0];
352 if ($errors = $mailer->enqueue(
359 $value[
'use_placeholders']
364 $this->
http->close();
366 $mailer->autoresponder()->disableAutoresponder();
368 $mailer->persistToStage(
369 $this->
user->getId(),
388 $mailer->deleteMails([$mail_id]);
391 $this->
ctrl->setParameterByClass(ilMailGUI::class,
'type',
'message_sent');
394 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'mail_message_send'),
true);
397 $this->
ctrl->redirectByClass(ilMailGUI::class);
400 $mailer->autoresponder()->disableAutoresponder();
407 $form = $this->
buildForm()->withRequest($this->request);
408 $result = $form->getInputGroup()->getContent();
410 if (!$result->isOK()) {
415 $value = $result->value()[0];
417 if ($value[
'm_subject'] ===
'') {
418 $value[
'm_subject'] = $this->
lng->txt(
'mail_no_subject');
421 if (count($value[
'attachments']) > 0) {
422 $files = $this->handleAttachments($value[
'attachments']);
425 $draft_folder_id = $this->mbox->getDraftsFolder();
431 if ($errors = $this->umail->validateRecipients(
436 $this->request_attachments = $files;
446 $draft_id = $this->umail->getNewDraftId($draft_folder_id);
449 $this->umail->updateDraft(
452 implode(
',', $value[
'rcp_to']),
453 implode(
',', $value[
'rcp_cc']),
454 implode(
',', $value[
'rcp_bcc']),
458 $value[
'use_schedule'][
'm_schedule'] ??
null,
459 $value[
'use_placeholders'],
467 $this->umail->deleteMails([$outbox_id]);
470 $this->
ctrl->setParameterByClass(ilMailFolderGUI::class,
'mobj_id', $draft_folder_id);
471 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'mail_saved'),
true);
476 $this->
ctrl->redirectByClass([ilMailGUI::class, ilMailFolderGUI::class]);
484 $this->tpl->setTitle($this->
lng->txt(
'mail_new'));
491 $form->setId(
'search_rcp');
492 $form->setTitle($this->
lng->txt(
'search_recipients'));
493 $form->setFormAction($this->
ctrl->getFormAction($this,
'search'));
497 $data_source_url = $this->
ctrl->getLinkTarget($this,
'lookupRecipientAsync',
'',
true);
498 $inp->setDataSource($data_source_url);
500 $search_query = trim((
string)
ilSession::get(
'mail_search_search'));
501 if ($search_query !==
'') {
504 $form->addItem($inp);
506 $form->addCommandButton(
'search', $this->
lng->txt(
'search'));
507 $form->addCommandButton(
'cancelSearch', $this->
lng->txt(
'cancel'));
509 $this->tpl->setContent($form->getHTML());
510 $this->tpl->printToStdout();
518 $this->
ctrl->setParameterByClass(
'ilmailsearchcoursesgui',
'cmd',
'showMembers');
521 $this->
ctrl->setParameterByClass(ilMailSearchCoursesGUI::class,
'ref',
'mail');
522 $this->
ctrl->redirectByClass(ilMailSearchCoursesGUI::class);
529 $this->
ctrl->setParameterByClass(ilMailSearchGroupsGUI::class,
'ref',
'mail');
530 $this->
ctrl->redirectByClass(ilMailSearchGroupsGUI::class);
536 'mail_search_search',
541 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'mail_insert_query'));
543 } elseif (strlen(trim(
ilSession::get(
'mail_search_search') ??
'')) < 3) {
544 $this->
lng->loadLanguageModule(
'search');
545 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_minimum_three'));
548 $this->
ctrl->setParameterByClass(
549 ilMailSearchGUI::class,
553 $this->
ctrl->redirectByClass(ilMailSearchGUI::class);
567 $this->
ctrl->setParameterByClass(ilMailAttachmentGUI::class,
'ref',
'mail');
568 $this->
ctrl->redirectByClass(ilMailAttachmentGUI::class);
609 if (!$this->
http->wrapper()->query()->has(
'template_id')) {
610 $this->
http->close();
614 $template = $this->template_service->loadTemplateForId(
615 $this->
http->wrapper()->query()->retrieve(
'template_id', $this->refinery->kindlyTo()->int())
619 $this->
http->saveResponse(
620 $this->
http->response()
621 ->withHeader(ResponseHeader::CONTENT_TYPE,
'application/json')
622 ->withBody(Streams::ofString(json_encode([
623 'm_subject' => $template->getSubject(),
624 'm_message' => $this->umail->appendSignature($template->getMessage()),
625 ], JSON_THROW_ON_ERROR)))
627 }
catch (Exception) {
630 $this->
http->sendResponse();
631 $this->
http->close();
636 $this->tpl->addBlockFile(
640 'components/ILIAS/Mail'
642 $this->tpl->setTitle($this->
lng->txt(
'mail_new'));
644 $this->
lng->loadLanguageModule(
'crs');
647 $this->
tabs->setBackTarget(
648 $this->
lng->txt(
'back'),
649 $this->ctrl->getLinkTarget($this,
'cancelMail')
654 $mail_data[
'rcp_to'] =
'';
655 $mail_data[
'rcp_cc'] =
'';
656 $mail_data[
'rcp_bcc'] =
'';
657 $mail_data[
'attachments'] = [];
658 $mail_data[
'm_subject'] =
'';
659 $mail_data[
'm_message'] =
'';
663 if ($this->mail_form_type !==
'') {
669 $mail_data = $this->umail->getMail($mail_id);
671 $mail_data[
'm_subject'] = $this->umail->formatReplySubject($mail_data[
'm_subject'] ??
'');
672 $mail_data[
'm_message'] = $this->umail->prependSignature(
673 $this->umail->formatReplyMessage($mail_data[
'm_message'] ??
'')
675 $mail_data[
'attachments'] = [];
676 $mail_data[
'rcp_cc'] =
'';
677 $mail_data[
'rcp_to'] = $this->umail->formatReplyRecipient();
681 $mail_data = $this->umail->retrieveFromStage();
683 $mail_data = $this->umail->appendSearchResult(
684 $this->
refinery->kindlyTo()->listOf(
685 $this->refinery->kindlyTo()->string()
691 $mail_data = $this->umail->appendSearchResult(
692 $this->
refinery->kindlyTo()->listOf(
693 $this->refinery->kindlyTo()->string()
699 $mail_data = $this->umail->appendSearchResult(
700 $this->
refinery->kindlyTo()->listOf(
701 $this->refinery->kindlyTo()->string()
714 $mail_data = $this->umail->getMail($mail_id);
716 if (!is_null($mail_data[
'attachments']) || !empty($mail_data[
'attachments'])) {
717 $mail_data[
'attachments'] = $this->filesFromLegacyToIRSS($mail_data);
726 $mail_data = $this->umail->getMail($mail_id);
732 $mail_data = $this->umail->getMail($mail_id);
733 $mail_data[
'rcp_to'] = $mail_data[
'rcp_cc'] = $mail_data[
'rcp_bcc'] =
'';
734 $mail_data[
'm_subject'] = $this->umail->formatForwardSubject($mail_data[
'm_subject'] ??
'');
735 $mail_data[
'm_message'] = $this->umail->prependSignature($mail_data[
'm_message'] ??
'');
736 if (is_array($mail_data[
'attachments']) && count($mail_data[
'attachments']) && $error = $this->mfile->adoptAttachments(
737 $mail_data[
'attachments'],
740 $this->tpl->setOnScreenMessage(
'info', $error);
743 if (!is_null($mail_data[
'attachments']) || ($mail_data[
'attachments'] !=
'')) {
744 $mail_data[
'attachments'] = $this->filesFromLegacyToIRSS($mail_data);
756 $mail_data[
'rcp_to'] = $to;
762 $mail_data[
'rcp_cc'] = $cc;
768 $mail_data[
'rcp_bcc'] = $bcc;
770 $mail_data[
'm_message'] =
'';
772 $mail_data[
'm_message'] = $sig;
773 $mail_data[
'm_message'] .= chr(13)
778 $mail_data[
'm_message'] .= $this->umail->appendSignature(
'');
787 if ($this->
http->wrapper()->post()->has(
'roles')) {
788 $roles = $this->
http->wrapper()->post()->retrieve(
790 $this->
refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
793 $roles = $this->
refinery->kindlyTo()->listOf(
794 $this->
refinery->kindlyTo()->string()
803 $mail_data[
'm_message'] =
'';
805 $mail_data[
'm_message'] = $sig;
806 $mail_data[
'm_message'] .= chr(13)
812 $additional_msg_text =
'';
813 if ($this->
http->wrapper()->post()->has(
'additional_message_text')) {
815 'additional_message_text',
816 $this->refinery->kindlyTo()->string()
820 $mail_data[
'm_message'] .= $additional_msg_text
823 . $this->umail->appendSignature(
'');
829 if ($this->
http->wrapper()->query()->has(
'rcp')) {
830 $rcp = $this->
http->wrapper()->query()->retrieve(
'rcp', $this->
refinery->kindlyTo()->string());
832 $mail_data[
'rcp_to'] = urldecode((
string) $rcp);
835 $mail_data = $this->umail->retrieveFromStage();
838 $mail_data = $this->
http->request()->getParsedBody();
839 foreach ($mail_data as $key => $value) {
840 if (is_string($value)) {
846 if ($this->request_attachments) {
852 $this->tpl->parseCurrentBlock();
854 if ($form ===
null) {
857 $this->tpl->setVariable(
'FORM', $this->ui_renderer->render($form));
858 $this->tpl->addJavaScript(
'assets/js/ilMailComposeFunctions.js');
859 $this->tpl->printToStdout();
866 $this->
refinery->kindlyTo()->string(),
867 $this->getQueryParam(
869 $this->refinery->kindlyTo()->string(),
877 $this->
http->saveResponse(
878 $this->
http->response()
879 ->withHeader(ResponseHeader::CONTENT_TYPE,
'application/json')
880 ->withBody(Streams::ofString(json_encode($result, JSON_THROW_ON_ERROR)))
883 $this->
http->sendResponse();
884 $this->
http->close();
889 $quoted = str_replace([
'%',
'_'], [
'\%',
'\_'], $quoted);
894 $this->
http->saveResponse(
895 $this->
http->response()
896 ->withHeader(ResponseHeader::CONTENT_TYPE,
'application/json')
897 ->withBody(Streams::ofString(json_encode($result, JSON_THROW_ON_ERROR)))
899 $this->
http->sendResponse();
900 $this->
http->close();
914 $form = $this->
buildForm()->withRequest($this->request);
915 $result = $form->getInputGroup()->getInputs()[0]->getInputs();
917 $resource_collection_id =
null;
918 $attachments = $result[
'attachments']->getValue();
919 if (count($attachments) > 0) {
920 $files = $this->handleAttachments($result[
'attachments']->
getValue());
921 $resource_collection_id = $this->getIdforCollection($files);
924 $rcp_to = implode(
',', $result[
'rcp_to']->
getValue() ?? []);
925 $rcp_cc = implode(
',', $result[
'rcp_cc']->
getValue() ?? []);
926 $rcp_bcc = implode(
',', $result[
'rcp_bcc']->
getValue() ?? []);
928 $this->umail->persistToStage(
929 $this->
user->getId(),
935 $resource_collection_id,
936 (
bool) $result[
'use_placeholders']->getValue(),
946 $this->
ctrl->setParameterByClass(ilMailingListsGUI::class,
'ref',
'mail');
947 $this->
ctrl->redirectByClass(ilMailingListsGUI::class);
956 $formatted_errors = $formatter->format($errors);
958 if ($formatted_errors !==
'') {
959 $this->tpl->setOnScreenMessage(
'failure', $formatted_errors);
965 return $this->ui_factory->input()->container()->form()->standard(
966 $this->
ctrl->getFormAction($this,
'sendMessage'),
967 $this->buildFormElements($mail_data)
969 $this->
ctrl->getFormAction($this,
'saveDraft'),
970 $this->lng->txt(
'save_message')
971 )->withSubmitLabel($this->
lng->txt(
'send_mail'));
981 $ff = $this->ui_factory->input()->field();
983 $rcp_to = $this->user_search->getInput(
984 $this->
lng->txt(
'mail_to'),
985 $this->getUserSearchConfigurator()
986 )->withRequired(
true, $this->
refinery->logical()->sequential([
987 $this->refinery->logical()->not($this->refinery->null()),
988 $this->refinery->string()->hasMinLength(1)
989 ])->withProblemBuilder(function ($txt) {
990 return $txt(
'mail_add_recipient');
992 $rcp_cc = $this->user_search->getInput(
993 $this->
lng->txt(
'mail_cc'),
996 $rcp_bcc = $this->user_search->getInput(
997 $this->
lng->txt(
'mail_bcc'),
1001 if (!is_null($mail_data)) {
1002 if (isset($mail_data[
'rcp_to']) && $mail_data[
'rcp_to'] !=
'') {
1003 $rcp_to = $rcp_to->withValue(explode(
',', $mail_data[
'rcp_to']) ?? (array) $mail_data[
'rcp_to']);
1005 if (isset($mail_data[
'rcp_cc']) && $mail_data[
'rcp_cc'] !=
'') {
1006 $rcp_cc = $rcp_cc->withValue(explode(
',', $mail_data[
'rcp_cc']) ?? (array) $mail_data[
'rcp_cc']);
1008 if (isset($mail_data[
'rcp_bcc']) && $mail_data[
'rcp_bcc'] !=
'') {
1009 $rcp_bcc = $rcp_bcc->withValue(explode(
',', $mail_data[
'rcp_bcc']) ?? (array) $mail_data[
'rcp_bcc']);
1013 $has_files = !empty($mail_data[
'attachments']);
1014 $attachments = $ff->file(
1015 $this->upload_handler,
1016 $this->
lng->txt(
'attachments')
1017 )->withMaxFiles(10);
1019 if (isset($mail_data[
'attachments']) && $has_files) {
1020 if ($mail_data[
'attachments'] instanceof \
ILIAS\ResourceStorage\Identification\ResourceCollectionIdentification) {
1021 $mail_data[
'attachments'] = $this->FilesFromIRSSToLegacy($mail_data[
'attachments']);
1023 $attachments = $attachments->withValue($mail_data[
'attachments'] ?? []);
1026 $template_chb =
null;
1034 $templates = $this->template_service->loadTemplatesForContextId(
$context->getId());
1035 if (count($templates) > 0) {
1040 $signal = $signal_generator->create();
1041 foreach ($templates as $template) {
1042 $options[$template->getTplId()] = $template->getTitle();
1043 $signal->addOption($template->getTplId() .
'_subject', urlencode($template->getSubject()));
1044 $signal->addOption($template->getTplId() .
'_message', urlencode($template->getMessage()));
1046 if (!isset($mail_data[
'template_id']) && $template->isDefault()) {
1047 $tmpl_value = $template->getTplId();
1048 $mail_data[
'm_subject'] = $template->getSubject();
1049 $mail_data[
'm_message'] = $this->umail->appendSignature($template->getMessage());
1052 if (isset($mail_data[
'template_id'])) {
1053 $tmpl_value = (
int) $mail_data[
'template_id'];
1059 $this->
lng->txt(
'mail_template_client'),
1061 $this->lng->txt(
'mail_template_client_info')
1063 ->withValue($tmpl_value)
1064 ->withOnUpdate($signal);
1066 }
catch (Exception
$e) {
1068 '%s has been called with invalid context id: %s.',
1078 ->text($this->
lng->txt(
'subject'))
1081 $this->
refinery->logical()->sequential([
1082 $this->refinery->logical()->not($this->refinery->null()),
1083 $this->refinery->string()->hasMinLength(1)
1084 ])->withProblemBuilder(function ($txt) {
1085 return $txt(
'mail_add_subject');
1088 ->withMaxLength(200)
1089 ->withValue($mail_data[
'm_subject'] ??
'');
1091 $m_message = $ff->markdown(
1093 $this->
lng->txt(
'message_content')
1094 )->
withValue($mail_data[
'm_message'] ??
'');
1096 $use_placeholders = $ff->hidden()->withValue(
'0');
1098 foreach (
$context->getPlaceholders() as $key => $value) {
1099 $placeholders[$value[
'placeholder']] = $value[
'label'];
1101 if (count($placeholders) > 0) {
1102 $m_message = $m_message
1103 ->withMustacheVariables(
1105 $this->
lng->txt(
'mail_nacc_use_placeholder') .
'<br />'
1106 . sprintf($this->
lng->txt(
'placeholders_advise'),
'<br />')
1109 $use_placeholders = $use_placeholders->withValue(
'1');
1111 $use_placeholders = $use_placeholders->withAdditionalTransformation(
1112 $this->
refinery->kindlyTo()->bool()
1115 if ($signal !==
null) {
1116 $m_subject = $m_subject->withAdditionalOnLoadCode(
1117 function (
$id) use ($signal) {
1119 $(document).on('{$signal}', function (event, signalData) {
1120 let subject = document.getElementById('{$id}');
1121 let child = subject.querySelector('.c-input__field input');
1122 let triggerer = signalData.triggerer[0];
1123 let tplId = triggerer.querySelector('select').value;
1125 child.value = decodeURIComponent(signalData.options[tplId + '_subject'].replace(/\+/g, ' '));
1131 $m_message = $m_message->withAdditionalOnLoadCode(
1132 function (
$id) use ($signal) {
1134 $(document).on('{$signal}', function (event, signalData) {
1135 let message = document.getElementById('{$id}');
1136 let child = message.querySelector('.c-input__field textarea');
1137 let triggerer = signalData.triggerer[0];
1138 let tplId = triggerer.querySelector('select').value;
1140 message.value = decodeURIComponent(signalData.options[tplId + '_message'].replace(/\+/g, ' '));
1149 'rcp_to' => $rcp_to,
1150 'rcp_cc' => $rcp_cc,
1151 'rcp_bcc' => $rcp_bcc,
1152 'm_subject' => $m_subject,
1153 'attachments' => $attachments
1155 if ($template_chb !==
null) {
1156 $elements[] = $template_chb;
1158 $elements[
'm_message'] = $m_message;
1160 $schedule_date_time_value =
null;
1161 $current_time = $this->clock->local(
new DateTimeZone($this->
user->getTimeZone()))->now();
1162 $schedule_date_time_input = $ff
1163 ->dateTime($this->
lng->txt(
'mail_schedule_scheduled_datetime'))
1165 ->withTimezone($this->
user->getTimezone())
1167 $this->
refinery->custom()->constraint(
1168 function (DateTimeImmutable $v) use ($current_time) {
1169 return $v > $current_time;
1171 $this->
lng->txt(
'mail_schedule_error_past_datetime')
1175 if (isset($mail_data[
'schedule_datetime'])) {
1176 $schedule_time =
new DateTimeImmutable(
1177 (
string) $mail_data[
'schedule_datetime'],
1178 new DateTimeZone($mail_data[
'schedule_timezone'] ??
'')
1180 $schedule_time->setTimezone(
new DateTimeZone($this->
user->getTimeZone()));
1181 $schedule_date_time_value = $schedule_time > $current_time ? $schedule_time :
null;
1184 $use_schedule_input = $ff->optionalGroup(
1185 [
'm_schedule' => $schedule_date_time_input],
1186 $this->
lng->txt(
'mail_message_scheduled')
1187 )->withAdditionalTransformation(
1188 $this->
refinery->custom()->constraint(
1189 function (?array $v) {
1190 return $v ===
null || (isset($v[
'm_schedule']) && $v[
'm_schedule'] instanceof DateTimeImmutable);
1192 $this->
lng->txt(
'mail_schedule_error_no_datetime')
1195 if ($schedule_date_time_value !==
null) {
1196 $use_schedule_input = $use_schedule_input->withValue([
'm_schedule' => $schedule_date_time_value]);
1198 $use_schedule_input = $use_schedule_input->withValue(
null);
1201 $elements[
'use_schedule'] = $use_schedule_input;
1203 $elements[
'use_placeholders'] = $use_placeholders;
1204 $section = $ff->section(
1206 $this->
lng->txt(
'compose')
1216 $bf = $this->ui_factory->button();
1218 $action = $this->
ctrl->getFormAction($this,
'searchUsers');
1219 $btn = $bf->standard(
1220 $this->
lng->txt(
'search_recipients'),
1222 )->withAdditionalOnLoadCode(
1223 function (
$id) use ($action) {
1224 return "document.getElementById('{$id}').addEventListener('click', function (event) {
1225 let mailform = document.querySelector('form.c-form');
1226 let btn = mailform.querySelector('button');
1227 btn.formAction = '{$action}';
1228 mailform.requestSubmit(btn);
1233 $this->
toolbar->addComponent($btn);
1235 $action = $this->
ctrl->getFormAction($this,
'searchCoursesTo');
1236 $btn = $bf->standard(
1237 $this->
lng->txt(
'mail_my_courses'),
1239 )->withAdditionalOnLoadCode(
1240 function (
$id) use ($action) {
1241 return "document.getElementById('{$id}').addEventListener('click', function (event) {
1242 let mailform = document.querySelector('form.c-form');
1243 let btn = mailform.querySelector('button');
1244 btn.formAction = '{$action}';
1245 mailform.requestSubmit(btn);
1249 $this->
toolbar->addComponent($btn);
1251 $action = $this->
ctrl->getFormAction($this,
'searchGroupsTo');
1252 $btn = $bf->standard(
1253 $this->
lng->txt(
'mail_my_groups'),
1255 )->withAdditionalOnLoadCode(
1256 function (
$id) use ($action) {
1257 return "document.getElementById('{$id}').addEventListener('click', function (event) {
1258 let mailform = document.querySelector('form.c-form');
1259 let btn = mailform.querySelector('button');
1260 btn.formAction = '{$action}';
1261 mailform.requestSubmit(btn);
1265 $this->
toolbar->addComponent($btn);
1268 $action = $this->
ctrl->getFormAction($this,
'searchMailingListsTo');
1269 $btn = $bf->standard(
1270 $this->
lng->txt(
'mail_my_mailing_lists'),
1272 )->withAdditionalOnLoadCode(
1273 function (
$id) use ($action) {
1274 return "document.getElementById('{$id}').addEventListener('click', function (event) {
1275 let mailform = document.querySelector('form.c-form');
1276 let btn = mailform.querySelector('button');
1277 btn.formAction = '{$action}';
1278 mailform.requestSubmit(btn);
1282 $this->
toolbar->addComponent($btn);
1285 $action = $this->
ctrl->getFormAction($this,
'editAttachments');
1286 $btn = $bf->standard(
1287 $this->
lng->txt(
'edit_attachments'),
1289 )->withAdditionalOnLoadCode(
1290 function (
$id) use ($action) {
1291 return "document.getElementById('{$id}').addEventListener('click', function (event) {
1292 let mailform = document.querySelector('form.c-form');
1293 let btn = mailform.querySelector('button');
1294 btn.formAction = '{$action}';
1295 mailform.requestSubmit(btn);
1299 $this->
toolbar->addComponent($btn);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Class ArrayBasedRequestWrapper.
@phpstan-type AutoCompleteUserItem array{label: string, value: string} @phpstan-type AutoCompleteResu...
@phpstan-import-type AutoCompleteUserRecord from RecipientSearchProvider
@phpstan-import-type AutoCompleteUserRecord from RecipientSearchProvider
static getInstanceByGlobalUser(?ilObjUser $user=null)
static getLogger(string $a_component_id)
Get component logger.
static getTemplateContextById(string $a_id)
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static strLen(string $a_string)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static securePlainString(string $a_str)
static redirect(string $a_script)
Interface GlobalHttpState.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.