ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilUserProfileBadgeGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Badge/interfaces/interface.ilBadgeTypeGUI.php";
5 
15 {
16  public function initConfigForm(ilPropertyFormGUI $a_form, $a_parent_ref_id)
17  {
18  global $DIC;
19 
20  $lng = $DIC['lng'];
21 
22  $fields = new ilCheckboxGroupInputGUI($lng->txt("profile"), "profile");
23  $a_form->addItem($fields);
24 
25  include_once "Services/User/classes/class.ilPersonalProfileGUI.php";
26  $gui = new ilPersonalProfileGUI();
27  $gui->showPublicProfileFields($a_form, array(), $fields, true);
28  }
29 
30  public function importConfigToForm(ilPropertyFormGUI $a_form, array $a_config)
31  {
32  if (is_array($a_config["profile"])) {
33  $group = $a_form->getItemByPostVar("profile");
34  foreach ($group->getSubItems() as $field) {
35  foreach ($a_config["profile"] as $id) {
36  if ($field->getPostVar() == $id) {
37  $field->setChecked(true);
38  break;
39  }
40  }
41  }
42  }
43  }
44 
45  public function getConfigFromForm(ilPropertyFormGUI $a_form)
46  {
47  $fields = array();
48  foreach (array_keys($_POST) as $id) {
49  if (substr($id, 0, 4) == "chk_") {
50  $fields[] = $id;
51  }
52  }
53 
54  return array("profile" => $fields);
55  }
56 
57  public function validateForm(ilPropertyFormGUI $a_form)
58  {
59  return true;
60  }
61 }
getItemByPostVar($a_post_var)
Get Item by POST variable.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
addItem($a_item)
Add Item (Property, SectionHeader).
initConfigForm(ilPropertyFormGUI $a_form, $a_parent_ref_id)
Add custom fields to form.
importConfigToForm(ilPropertyFormGUI $a_form, array $a_config)
Set form values.
$lng
Badge type gui interface.
This class represents a property in a property form.
validateForm(ilPropertyFormGUI $a_form)
Custom form validation.
getConfigFromForm(ilPropertyFormGUI $a_form)
Export values to DB.
$_POST["username"]
GUI class for personal profile.