ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Badges\ProfileBadgeGUI Class Reference
+ Inheritance diagram for ILIAS\User\Badges\ProfileBadgeGUI:
+ Collaboration diagram for ILIAS\User\Badges\ProfileBadgeGUI:

Public Member Functions

 __construct (private readonly Language $lng, private readonly RequestInterface $request)
 
 initConfigForm (\ilPropertyFormGUI $form, int $parent_ref_id)
 
 importConfigToForm (\ilPropertyFormGUI $form, array $config)
 
 getConfigFromForm (\ilPropertyFormGUI $form)
 
 validateForm (\ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilBadgeTypeGUI
 initConfigForm (ilPropertyFormGUI $a_form, int $a_parent_ref_id)
 Add custom fields to form. More...
 
 importConfigToForm (ilPropertyFormGUI $a_form, array $a_config)
 Set form values. More...
 
 getConfigFromForm (ilPropertyFormGUI $a_form)
 Export values to DB. More...
 
 validateForm (ilPropertyFormGUI $a_form)
 Custom form validation. More...
 

Detailed Description

Definition at line 27 of file ProfileBadgeGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Badges\ProfileBadgeGUI::__construct ( private readonly Language  $lng,
private readonly RequestInterface  $request 
)

Definition at line 29 of file ProfileBadgeGUI.php.

32 {
33 }

Member Function Documentation

◆ getConfigFromForm()

ILIAS\User\Badges\ProfileBadgeGUI::getConfigFromForm ( \ilPropertyFormGUI  $form)
Returns
array<string>

Definition at line 69 of file ProfileBadgeGUI.php.

71 : array {
72 return ['profile' => array_reduce(
73 array_keys($this->request->getParsedBody()),
74 static function (array $c, string $v): array {
75 if (str_starts_with($v, 'chk_')) {
76 $c[] = $v;
77 }
78 return $c;
79 },
80 []
81 )];
82 }
$c
Definition: deliver.php:25

References $c.

◆ importConfigToForm()

ILIAS\User\Badges\ProfileBadgeGUI::importConfigToForm ( \ilPropertyFormGUI  $form,
array  $config 
)

Definition at line 48 of file ProfileBadgeGUI.php.

51 : void {
52 if (!is_array($config['profile'])) {
53 return;
54 }
55
56 foreach ($form->getItemByPostVar('profile')->getSubItems() as $field) {
57 foreach ($config['profile'] as $id) {
58 if ($field->getPostVar() === $id) {
59 $field->setChecked(true);
60 break;
61 }
62 }
63 }
64 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ initConfigForm()

ILIAS\User\Badges\ProfileBadgeGUI::initConfigForm ( \ilPropertyFormGUI  $form,
int  $parent_ref_id 
)

Definition at line 35 of file ProfileBadgeGUI.php.

38 : void {
39 $fields = new \ilCheckboxGroupInputGUI(
40 $this->lng->txt('profile'),
41 'profile'
42 );
43 $form->addItem($fields);
44
45 (new PersonalProfileGUI())->showPublicProfileFields($form, [], $fields, true);
46 }

◆ validateForm()

ILIAS\User\Badges\ProfileBadgeGUI::validateForm ( \ilPropertyFormGUI  $form)

Definition at line 84 of file ProfileBadgeGUI.php.

84 : bool
85 {
86 return true;
87 }

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