19declare(strict_types=1);
45 private array $info_texts,
46 private array $prompt_texts
65 return $this->info_texts;
73 return $this->prompt_texts;
78 return $this->info_texts[
$lang] ??
'';
83 return $this->prompt_texts[
$lang] ??
'';
89 $clone->mode =
$data[
'prompting_settings'][
'prompt_mode'][
'mode'];
90 $clone->days =
$data[
'prompting_settings'][
'prompt_mode'][
'days'];
91 $clone->info_texts =
$data[
'profile_info'];
92 $clone->prompt_texts =
$data[
'prompting_settings'][
'prompt_texts'];
100 UIFactory $ui_factory,
104 $lng->loadLanguageModule(
'meta');
107 'profile_info' => $ui_factory->input()->field()->section(
109 $ui_factory->input()->field(),
111 fn(
string $lang):
string => $this->info_texts[
$lang] ??
''
113 $lng->txt(
'user_profile_info_std'),
114 $lng->txt(
'user_profile_info_text_info')
116 'prompting_settings' => $ui_factory->input()->field()->section(
118 $lng->txt(
'user_prompting_settings')
127 FieldFactory $field_factory,
129 \Closure $value_closure
132 $lng->getInstalledLanguages(),
133 function (array
$c, string $v) use ($field_factory,
$lng, $value_closure): array {
134 $c[$v] = $field_factory
135 ->textarea(
$lng->txt(
"meta_l_{$v}"))
147 FieldFactory $field_factory,
153 return array_filter($vs);
157 'prompt_mode' => $this->buildPromptModeInput($field_factory,
$lng,
$refinery),
158 'prompt_texts' => $field_factory->section(
159 $this->buildLangTextAreaInputs(
162 fn(
string $lang):
string => $this->prompt_texts[
$lang] ??
''
164 $lng->txt(
'user_profile_prompt_text'),
165 $lng->txt(
'user_profile_prompt_text_info')
166 )->withAdditionalTransformation($trafo)
171 FieldFactory $field_factory,
176 static fn(array $vs): array => [
178 'days' => $vs[1][
'days'] ?? null
181 return $field_factory->switchableGroup(
183 Settings::MODE_INCOMPLETE_ONLY => $field_factory->group(
185 $lng->txt(
'user_prompt_incomplete'),
186 $lng->txt(
'user_prompt_incomplete_info')
188 Settings::MODE_ONCE_AFTER_LOGIN => $field_factory->group(
190 'days' => $field_factory
191 ->numeric(
$lng->txt(
'days'))
193 ->withAdditionalTransformation(
$refinery->int()->isGreaterThan(0))
194 ->withValue($this->getDays())
196 $lng->txt(
'user_prompt_once_after_login'),
197 $lng->txt(
'user_prompt_once_after_login_info')
199 Settings::MODE_REPEAT => $field_factory->group(
201 'days' => $field_factory
202 ->numeric(
$lng->txt(
'days'))
204 ->withAdditionalTransformation(
$refinery->int()->isGreaterThan(0))
205 ->withValue($this->getDays())
207 $lng->txt(
'user_prompt_repeat'),
208 $lng->txt(
'user_prompt_repeat_info')
211 $lng->txt(
'user_prompting_recurrence')
212 )->withAdditionalTransformation($trafo)
213 ->withValue($this->getMode());
Builds a Color from either hex- or rgb values.
getInfoText(string $lang)
toForm(UIFactory $ui_factory, \ilLanguage $lng, Refinery $refinery)
const MODE_INCOMPLETE_ONLY
const MODE_ONCE_AFTER_LOGIN
buildPromptingSettingsInputs(FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
__construct(private int $mode, private ?int $days, private array $info_texts, private array $prompt_texts)
buildLangTextAreaInputs(FieldFactory $field_factory, \ilLanguage $lng, \Closure $value_closure)
getPromptText(string $lang)
buildPromptModeInput(FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
withFormData(array $data)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...