ILIAS  Release_4_4_x_branch Revision 61816
 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->lng->txt("certificate"), "");
34  $this->addColumn($this->lng->txt("actions"), "");
35 
36  $this->setEnableHeader(true);
37  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
38  $this->setRowTemplate("tpl.std_fields_settings_row.html", "Services/User");
39  $this->disable("footer");
40  $this->setEnableTitle(true);
41 
42  $user_field_definitions = ilUserDefinedFields::_getInstance();
43  $fds = $user_field_definitions->getDefinitions();
44 
45  foreach ($fds as $k => $f)
46  {
47  $fds[$k]["key"] = $k;
48  }
49  $this->setData($fds);
50  $this->addCommandButton("updateFields", $lng->txt("save"));
51  $this->addMultiCommand("askDeleteField", $lng->txt("delete"));
52  }
53 
57  protected function fillRow($a_set)
58  {
59  global $lng, $ilSetting, $ilCtrl;
60 
61  $field = $a_set["field_id"];
62 
63  $props = array("visible" => "user_visible_in_profile",
64  "changeable" => "changeable",
65  "searchable" => "header_searchable",
66  "required" => "required_field",
67  "export" => "export",
68  "course_export" => "course_export",
69  'group_export' => 'group_export',
70  "visib_reg" => "header_visible_registration",
71  'visib_lua' => 'usr_settings_visib_lua',
72  'changeable_lua' => 'usr_settings_changeable_lua',
73  'certificate' => 'certificate'
74  );
75 
76  foreach ($props as $prop => $lv)
77  {
78  $up_prop = strtoupper($prop);
79 
80  if ($a_set["field_type"] != UDF_TYPE_WYSIWYG ||
81  ($prop != "searchable"))
82  {
83  $this->tpl->setCurrentBlock($prop);
84  $this->tpl->setVariable("HEADER_".$up_prop,
85  $lng->txt($lv));
86  $this->tpl->setVariable("PROFILE_OPTION_".$up_prop, $prop."_".$field);
87 
88  // determine checked status
89  $checked = false;
90  if ($a_set[$prop])
91  {
92  $checked = true;
93  }
94  if ($this->confirm_change == 1) // confirm value
95  {
96  $checked = $_POST["chb"][$prop."_".$field];
97  }
98 
99  if ($checked)
100  {
101  $this->tpl->setVariable("CHECKED_".$up_prop, " checked=\"checked\"");
102  }
103  $this->tpl->parseCurrentBlock();
104  }
105  }
106 
107  // actions
108  $ilCtrl->setParameter($this->parent_obj, 'field_id', $a_set["field_id"]);
109  $this->tpl->setCurrentBlock("action");
110  $this->tpl->setVariable("HREF_CMD",
111  $ilCtrl->getLinkTarget($this->parent_obj, 'edit'));
112  $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
113  $this->tpl->parseCurrentBlock();
114 
115  // field name
116  $this->tpl->setVariable("FIELD_ID", $a_set["field_id"]);
117  $this->tpl->setVariable("TXT_FIELD", $a_set["field_name"]);
118  }
119 
120  public function setConfirmChange()
121  {
122  $this->confirm_change = true;
123  }
124 
125 }
126 ?>