19 declare(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'];
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')
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}"))
151 $trafo = $refinery->custom()->transformation(
153 return array_filter($vs);
158 'prompt_texts' => $field_factory->section(
162 fn(
string $lang):
string => $this->prompt_texts[$lang] ??
'' 164 $lng->
txt(
'user_profile_prompt_text'),
165 $lng->
txt(
'user_profile_prompt_text_info')
175 $trafo = $refinery->custom()->transformation(
176 static fn(array $vs): array => [
177 'mode' => $refinery->kindlyTo()->int()->transform($vs[0]),
178 'days' => $vs[1][
'days'] ??
null 181 return $field_factory->switchableGroup(
185 $lng->
txt(
'user_prompt_incomplete'),
186 $lng->
txt(
'user_prompt_incomplete_info')
190 'days' => $field_factory
191 ->numeric($lng->
txt(
'days'))
193 ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
196 $lng->
txt(
'user_prompt_once_after_login'),
197 $lng->
txt(
'user_prompt_once_after_login_info')
201 'days' => $field_factory
202 ->numeric($lng->
txt(
'days'))
204 ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
207 $lng->
txt(
'user_prompt_repeat'),
208 $lng->
txt(
'user_prompt_repeat_info')
211 $lng->
txt(
'user_prompting_recurrence')
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getPromptText(string $lang)
__construct(private int $mode, private ?int $days, private array $info_texts, private array $prompt_texts)
const MODE_INCOMPLETE_ONLY
withFormData(array $data)
loadLanguageModule(string $a_module)
Load language module.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getInfoText(string $lang)
getInstalledLanguages()
Get installed languages.
const MODE_ONCE_AFTER_LOGIN
buildPromptingSettingsInputs(FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
buildLangTextAreaInputs(FieldFactory $field_factory, \ilLanguage $lng, \Closure $value_closure)
buildPromptModeInput(FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
toForm(UIFactory $ui_factory, \ilLanguage $lng, Refinery $refinery)