ILIAS  Release_4_1_x_branch Revision 61804
 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($this->lng->txt("usrs_group"), "");
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->addCommandButton("chooseFieldType", $lng->txt("add_user_defined_field"));
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  switch($a_set['field_type'])
109  {
110  case UDF_TYPE_TEXT:
111  $this->tpl->setVariable("HREF_CMD",
112  $ilCtrl->getLinkTarget($this->parent_obj, 'editTextField'));
113  break;
114 
115  case UDF_TYPE_WYSIWYG:
116  $this->tpl->setVariable("HREF_CMD",
117  $ilCtrl->getLinkTarget($this->parent_obj, 'editWysiwygField'));
118  break;
119 
120  case UDF_TYPE_SELECT:
121  $this->tpl->setVariable("HREF_CMD",
122  $ilCtrl->getLinkTarget($this->parent_obj, 'editSelectField'));
123  break;
124  }
125  $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
126  $this->tpl->parseCurrentBlock();
127  $this->tpl->setCurrentBlock("action");
128  $this->tpl->setVariable("HREF_CMD",
129  $ilCtrl->getLinkTarget($this->parent_obj, 'askDeleteField'));
130  $this->tpl->setVariable("TXT_CMD", $lng->txt("delete"));
131  $this->tpl->parseCurrentBlock();
132 
133  // field name
134  $this->tpl->setVariable("TXT_FIELD", $a_set["field_name"]);
135  }
136 
137  public function setConfirmChange()
138  {
139  $this->confirm_change = true;
140  }
141 
142 }
143 ?>