ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilUserProfileBadgeGUI.php
Go to the documentation of this file.
1 <?php
2 
20 
26 {
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 }
getItemByPostVar(string $a_post_var)
$lng
global $DIC
Definition: feed.php:28
importConfigToForm(ilPropertyFormGUI $a_form, array $a_config)
Set form values.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
validateForm(ilPropertyFormGUI $a_form)
Custom form validation.
initConfigForm(ilPropertyFormGUI $a_form, int $a_parent_ref_id)
Add custom fields to form.
getConfigFromForm(ilPropertyFormGUI $a_form)
Export values to DB.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23