ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCustomUserFieldSettingsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
16  private $confirm_change = false;
17 
21  function __construct($a_parent_obj, $a_parent_cmd)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26  $this->setTitle($lng->txt("user_defined_list"));
27  $this->setLimit(9999);
28 
29  $this->addColumn("", "", 1);
30  $this->addColumn($this->lng->txt("user_field"), "");
31  $this->addColumn($this->lng->txt("access"), "");
32  $this->addColumn($this->lng->txt("export")." / ".$this->lng->txt("search"), "");
33  $this->addColumn($this->lng->txt("actions"), "");
34 
35  $this->setEnableHeader(true);
36  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
37  $this->setRowTemplate("tpl.std_fields_settings_row.html", "Services/User");
38  $this->disable("footer");
39  $this->setEnableTitle(true);
40 
41  $user_field_definitions = ilUserDefinedFields::_getInstance();
42  $fds = $user_field_definitions->getDefinitions();
43 
44  foreach ($fds as $k => $f)
45  {
46  $fds[$k]["key"] = $k;
47  }
48  $this->setData($fds);
49  $this->addCommandButton("updateFields", $lng->txt("save"));
50  $this->addMultiCommand("askDeleteField", $lng->txt("delete"));
51  }
52 
56  protected function fillRow($a_set)
57  {
58  global $lng, $ilSetting, $ilCtrl;
59 
60  $field = $a_set["field_id"];
61 
62  $props = array("visible" => "user_visible_in_profile",
63  "changeable" => "changeable",
64  "searchable" => "header_searchable",
65  "required" => "required_field",
66  "export" => "export",
67  "course_export" => "course_export",
68  'group_export' => 'group_export',
69  "visib_reg" => "header_visible_registration",
70  'visib_lua' => 'usr_settings_visib_lua',
71  'changeable_lua' => 'usr_settings_changeable_lua'
72  );
73 
74  foreach ($props as $prop => $lv)
75  {
76  $up_prop = strtoupper($prop);
77 
78  if ($a_set["field_type"] != UDF_TYPE_WYSIWYG ||
79  ($prop != "searchable"))
80  {
81  $this->tpl->setCurrentBlock($prop);
82  $this->tpl->setVariable("HEADER_".$up_prop,
83  $lng->txt($lv));
84  $this->tpl->setVariable("PROFILE_OPTION_".$up_prop, $prop."_".$field);
85 
86  // determine checked status
87  $checked = false;
88  if ($a_set[$prop])
89  {
90  $checked = true;
91  }
92  if ($this->confirm_change == 1) // confirm value
93  {
94  $checked = $_POST["chb"][$prop."_".$field];
95  }
96 
97  if ($checked)
98  {
99  $this->tpl->setVariable("CHECKED_".$up_prop, " checked=\"checked\"");
100  }
101  $this->tpl->parseCurrentBlock();
102  }
103  }
104 
105  // actions
106  $ilCtrl->setParameter($this->parent_obj, 'field_id', $a_set["field_id"]);
107  $this->tpl->setCurrentBlock("action");
108  $this->tpl->setVariable("HREF_CMD",
109  $ilCtrl->getLinkTarget($this->parent_obj, 'edit'));
110  $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
111  $this->tpl->parseCurrentBlock();
112 
113  // field name
114  $this->tpl->setVariable("FIELD_ID", $a_set["field_id"]);
115  $this->tpl->setVariable("TXT_FIELD", $a_set["field_name"]);
116  }
117 
118  public function setConfirmChange()
119  {
120  $this->confirm_change = true;
121  }
122 
123 }
124 ?>