ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\User\Profile\Prompt\Settings Class Reference

Profile prompt settings. More...

+ Collaboration diagram for ILIAS\User\Profile\Prompt\Settings:

Public Member Functions

 __construct (private int $mode, private ?int $days, private array $info_texts, private array $prompt_texts)
 
 getDays ()
 
 getMode ()
 
 getInfoTexts ()
 
 getPromptTexts ()
 
 getInfoText (string $lang)
 
 getPromptText (string $lang)
 
 withFormData (array $data)
 
 toForm (UIFactory $ui_factory, \ilLanguage $lng, Refinery $refinery)
 

Data Fields

const MODE_INCOMPLETE_ONLY = 0
 
const MODE_ONCE_AFTER_LOGIN = 1
 
const MODE_REPEAT = 2
 

Private Member Functions

 buildLangTextAreaInputs (FieldFactory $field_factory, \ilLanguage $lng, \Closure $value_closure)
 
 buildPromptingSettingsInputs (FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
 
 buildPromptModeInput (FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
 

Detailed Description

Profile prompt settings.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 32 of file Settings.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Profile\Prompt\Settings::__construct ( private int  $mode,
private ?int  $days,
private array  $info_texts,
private array  $prompt_texts 
)
Parameters
array<string,string>$info_texts
array<string,string>$promp_texts

Definition at line 42 of file Settings.php.

47  {
48  }

Member Function Documentation

◆ buildLangTextAreaInputs()

ILIAS\User\Profile\Prompt\Settings::buildLangTextAreaInputs ( FieldFactory  $field_factory,
\ilLanguage  $lng,
\Closure  $value_closure 
)
private
Returns
array<>

Definition at line 126 of file Settings.php.

References $c, ilLanguage\getInstalledLanguages(), ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by ILIAS\User\Profile\Prompt\Settings\buildPromptingSettingsInputs(), and ILIAS\User\Profile\Prompt\Settings\toForm().

130  : array {
131  return array_reduce(
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}"))
136  ->withValue($value_closure($v));
137  return $c;
138  },
139  []
140  );
141  }
$c
Definition: deliver.php:25
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPromptingSettingsInputs()

ILIAS\User\Profile\Prompt\Settings::buildPromptingSettingsInputs ( FieldFactory  $field_factory,
\ilLanguage  $lng,
Refinery  $refinery 
)
private
Returns
array<>

Definition at line 146 of file Settings.php.

References $lang, ILIAS\User\Profile\Prompt\Settings\buildLangTextAreaInputs(), ILIAS\User\Profile\Prompt\Settings\buildPromptModeInput(), ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation().

Referenced by ILIAS\User\Profile\Prompt\Settings\toForm().

150  : array {
151  $trafo = $refinery->custom()->transformation(
152  function ($vs) {
153  return array_filter($vs);
154  }
155  );
156  return [
157  'prompt_mode' => $this->buildPromptModeInput($field_factory, $lng, $refinery),
158  'prompt_texts' => $field_factory->section(
160  $field_factory,
161  $lng,
162  fn(string $lang): string => $this->prompt_texts[$lang] ?? ''
163  ),
164  $lng->txt('user_profile_prompt_text'),
165  $lng->txt('user_profile_prompt_text_info')
167  ];
168  }
$lang
Definition: xapiexit.php:25
buildLangTextAreaInputs(FieldFactory $field_factory, \ilLanguage $lng, \Closure $value_closure)
Definition: Settings.php:126
buildPromptModeInput(FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
Definition: Settings.php:170
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPromptModeInput()

ILIAS\User\Profile\Prompt\Settings::buildPromptModeInput ( FieldFactory  $field_factory,
\ilLanguage  $lng,
Refinery  $refinery 
)
private

Definition at line 170 of file Settings.php.

References ILIAS\User\Profile\Prompt\Settings\getDays(), ILIAS\User\Profile\Prompt\Settings\getMode(), ILIAS\User\Profile\Prompt\Settings\MODE_INCOMPLETE_ONLY, ILIAS\User\Profile\Prompt\Settings\MODE_ONCE_AFTER_LOGIN, ILIAS\User\Profile\Prompt\Settings\MODE_REPEAT, null, ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by ILIAS\User\Profile\Prompt\Settings\buildPromptingSettingsInputs().

174  : SwitchableGroup {
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
179  ]
180  );
181  return $field_factory->switchableGroup(
182  [
183  Settings::MODE_INCOMPLETE_ONLY => $field_factory->group(
184  [],
185  $lng->txt('user_prompt_incomplete'),
186  $lng->txt('user_prompt_incomplete_info')
187  ),
188  Settings::MODE_ONCE_AFTER_LOGIN => $field_factory->group(
189  [
190  'days' => $field_factory
191  ->numeric($lng->txt('days'))
192  ->withRequired(true)
193  ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
194  ->withValue($this->getDays())
195  ],
196  $lng->txt('user_prompt_once_after_login'),
197  $lng->txt('user_prompt_once_after_login_info')
198  ),
199  Settings::MODE_REPEAT => $field_factory->group(
200  [
201  'days' => $field_factory
202  ->numeric($lng->txt('days'))
203  ->withRequired(true)
204  ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
205  ->withValue($this->getDays())
206  ],
207  $lng->txt('user_prompt_repeat'),
208  $lng->txt('user_prompt_repeat_info')
209  ),
210  ],
211  $lng->txt('user_prompting_recurrence')
213  ->withValue($this->getMode());
214  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDays()

ILIAS\User\Profile\Prompt\Settings::getDays ( )

Definition at line 50 of file Settings.php.

Referenced by ILIAS\User\Profile\Prompt\Settings\buildPromptModeInput(), and ILIAS\User\Profile\Prompt\Repository\saveSettings().

50  : ?int
51  {
52  return $this->days;
53  }
+ Here is the caller graph for this function:

◆ getInfoText()

ILIAS\User\Profile\Prompt\Settings::getInfoText ( string  $lang)

Definition at line 76 of file Settings.php.

References $lang.

76  : string
77  {
78  return $this->info_texts[$lang] ?? '';
79  }
$lang
Definition: xapiexit.php:25

◆ getInfoTexts()

ILIAS\User\Profile\Prompt\Settings::getInfoTexts ( )
Returns
array<string>

Definition at line 63 of file Settings.php.

Referenced by ILIAS\User\Profile\Prompt\Repository\saveSettings().

63  : array
64  {
65  return $this->info_texts;
66  }
+ Here is the caller graph for this function:

◆ getMode()

ILIAS\User\Profile\Prompt\Settings::getMode ( )

Definition at line 55 of file Settings.php.

Referenced by ILIAS\User\Profile\Prompt\Settings\buildPromptModeInput(), and ILIAS\User\Profile\Prompt\Repository\saveSettings().

55  : int
56  {
57  return $this->mode;
58  }
+ Here is the caller graph for this function:

◆ getPromptText()

ILIAS\User\Profile\Prompt\Settings::getPromptText ( string  $lang)

Definition at line 81 of file Settings.php.

References $lang.

81  : string
82  {
83  return $this->prompt_texts[$lang] ?? '';
84  }
$lang
Definition: xapiexit.php:25

◆ getPromptTexts()

ILIAS\User\Profile\Prompt\Settings::getPromptTexts ( )
Returns
array<string>

Definition at line 71 of file Settings.php.

Referenced by ILIAS\User\Profile\Prompt\Repository\saveSettings().

71  : array
72  {
73  return $this->prompt_texts;
74  }
+ Here is the caller graph for this function:

◆ toForm()

ILIAS\User\Profile\Prompt\Settings::toForm ( UIFactory  $ui_factory,
\ilLanguage  $lng,
Refinery  $refinery 
)
Returns
array<>

Definition at line 99 of file Settings.php.

References $lang, $lng, ILIAS\UI\examples\Layout\Page\Standard\$refinery, ILIAS\User\Profile\Prompt\Settings\buildLangTextAreaInputs(), ILIAS\User\Profile\Prompt\Settings\buildPromptingSettingsInputs(), ilLanguage\loadLanguageModule(), and ilLanguage\txt().

103  : array {
104  $lng->loadLanguageModule('meta');
105 
106  return [
107  'profile_info' => $ui_factory->input()->field()->section(
109  $ui_factory->input()->field(),
110  $lng,
111  fn(string $lang): string => $this->info_texts[$lang] ?? ''
112  ),
113  $lng->txt('user_profile_info_std'),
114  $lng->txt('user_profile_info_text_info')
115  ),
116  'prompting_settings' => $ui_factory->input()->field()->section(
117  $this->buildPromptingSettingsInputs($ui_factory->input()->field(), $lng, $refinery),
118  $lng->txt('user_prompting_settings')
119  )
120  ];
121  }
buildPromptingSettingsInputs(FieldFactory $field_factory, \ilLanguage $lng, Refinery $refinery)
Definition: Settings.php:146
$lang
Definition: xapiexit.php:25
buildLangTextAreaInputs(FieldFactory $field_factory, \ilLanguage $lng, \Closure $value_closure)
Definition: Settings.php:126
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ withFormData()

ILIAS\User\Profile\Prompt\Settings::withFormData ( array  $data)

Definition at line 86 of file Settings.php.

86  : self
87  {
88  $clone = clone $this;
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'];
93  return $clone;
94  }

Field Documentation

◆ MODE_INCOMPLETE_ONLY

const ILIAS\User\Profile\Prompt\Settings::MODE_INCOMPLETE_ONLY = 0

◆ MODE_ONCE_AFTER_LOGIN

const ILIAS\User\Profile\Prompt\Settings::MODE_ONCE_AFTER_LOGIN = 1

◆ MODE_REPEAT

const ILIAS\User\Profile\Prompt\Settings::MODE_REPEAT = 2

The documentation for this class was generated from the following file: