ILIAS  release_8 Revision v8.24
class.ilUserProfileBadgeGUI.php
Go to the documentation of this file.
1<?php
2
19use Psr\Http\Message\RequestInterface;
20
26{
27 private RequestInterface $request;
28
29 public function __construct()
30 {
31 global $DIC;
32
33 $this->request = $DIC->http()->request();
34 }
35
36 public function initConfigForm(ilPropertyFormGUI $a_form, int $a_parent_ref_id): void
37 {
38 global $DIC;
39
40 $lng = $DIC['lng'];
41
42 $fields = new ilCheckboxGroupInputGUI($lng->txt("profile"), "profile");
43 $a_form->addItem($fields);
44
45 $gui = new ilPersonalProfileGUI();
46 $gui->showPublicProfileFields($a_form, array(), $fields, true);
47 }
48
49 public function importConfigToForm(ilPropertyFormGUI $a_form, array $a_config): void // Missing array type.
50 {
51 if (is_array($a_config["profile"])) {
52 $group = $a_form->getItemByPostVar("profile");
53 foreach ($group->getSubItems() as $field) {
54 foreach ($a_config["profile"] as $id) {
55 if ($field->getPostVar() == $id) {
56 $field->setChecked(true);
57 break;
58 }
59 }
60 }
61 }
62 }
63
64 public function getConfigFromForm(ilPropertyFormGUI $a_form): array // Missing array type.
65 {
66 $fields = array();
67 foreach (array_keys($this->request->getParsedBody()) as $id) {
68 if (strpos($id, "chk_") === 0) {
69 $fields[] = $id;
70 }
71 }
72
73 return array("profile" => $fields);
74 }
75
76 public function validateForm(ilPropertyFormGUI $a_form): bool
77 {
78 return true;
79 }
80}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for personal profile.
This class represents a property form user interface.
getItemByPostVar(string $a_post_var)
validateForm(ilPropertyFormGUI $a_form)
Custom form validation.
initConfigForm(ilPropertyFormGUI $a_form, int $a_parent_ref_id)
Add custom fields to form.
importConfigToForm(ilPropertyFormGUI $a_form, array $a_config)
Set form values.
getConfigFromForm(ilPropertyFormGUI $a_form)
Export values to DB.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lng