19 declare(strict_types=1);
43 public function __construct(
string $label,
string $http_post_param_name,
protected string $dependencyElementId)
47 $this->tpl = $DIC->ui()->mainTemplate();
48 $this->httpState = $DIC->http();
52 $this->tpl->addJavaScript(
'Services/Mail/js/ilMailComposeFunctions.js');
67 $this->rerenderTriggerElementName = $elementId;
68 $this->rerenderUrl =
$url;
93 $this->placeholders[$placeholder][
'placeholder'] = $placeholder;
94 $this->placeholders[$placeholder][
'title'] =
$title;
106 public function render(
bool $ajax =
false): string
109 'tpl.mail_manual_placeholders.html',
114 $subtpl->setVariable(
'TXT_USE_PLACEHOLDERS', $this->
lng->txt(
'mail_nacc_use_placeholder'));
115 $subtpl->setVariable(
'DEPENDENCY_ELM_ID_OUTER', $this->dependencyElementId);
117 $subtpl->setVariable(
'TXT_PLACEHOLDERS_ADVISE', $this->
getAdviseText());
120 foreach ($this->placeholders as $placeholder) {
121 $subtpl->setCurrentBlock(
'man_placeholder');
122 $subtpl->setVariable(
'DEPENDENCY_ELM_ID', $this->dependencyElementId);
123 $subtpl->setVariable(
'PLACEHOLDER',
'{{' . $placeholder[
'placeholder'] .
'}}');
124 $subtpl->setVariable(
'PLACEHOLDER_INTERACTION_INFO', sprintf(
125 $this->
lng->txt(
'mail_hint_add_placeholder_x'),
126 '{{' . $placeholder[
'placeholder'] .
'}}' 128 $subtpl->setVariable(
'PLACEHOLDER_DESCRIPTION', $placeholder[
'title']);
129 $subtpl->parseCurrentBlock();
134 $subtpl->setVariable(
'RERENDER_DEPENDENCY_ELM_ID_OUTER', $this->dependencyElementId);
139 $this->httpState->saveResponse(
142 ->withBody(Streams::ofString($subtpl->get()))
144 $this->httpState->sendResponse();
145 $this->httpState->close();
148 return $subtpl->get();
158 if (is_array($a_value) && $this->
getMulti()) {
160 $a_value = array_shift($a_value);
162 $this->value = $a_value;
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
Interface GlobalHttpState.
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)