ILIAS  Release_4_0_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($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  "visib_reg" => "header_visible_registration");
69 //var_dump($a_set);
70  foreach ($props as $prop => $lv)
71  {
72  $up_prop = strtoupper($prop);
73 
74  if ($a_set["field_type"] != UDF_TYPE_WYSIWYG ||
75  ($prop != "searchable"))
76  {
77  $this->tpl->setCurrentBlock($prop);
78  $this->tpl->setVariable("HEADER_".$up_prop,
79  $lng->txt($lv));
80  $this->tpl->setVariable("PROFILE_OPTION_".$up_prop, $prop."_".$field);
81 
82  // determine checked status
83  $checked = false;
84  if ($a_set[$prop])
85  {
86  $checked = true;
87  }
88  if ($this->confirm_change == 1) // confirm value
89  {
90  $checked = $_POST["chb"][$prop."_".$field];
91  }
92 
93  if ($checked)
94  {
95  $this->tpl->setVariable("CHECKED_".$up_prop, " checked=\"checked\"");
96  }
97  $this->tpl->parseCurrentBlock();
98  }
99  }
100 
101  // actions
102  $ilCtrl->setParameter($this->parent_obj, 'field_id', $a_set["field_id"]);
103  $this->tpl->setCurrentBlock("action");
104  switch($a_set['field_type'])
105  {
106  case UDF_TYPE_TEXT:
107  $this->tpl->setVariable("HREF_CMD",
108  $ilCtrl->getLinkTarget($this->parent_obj, 'editTextField'));
109  break;
110 
111  case UDF_TYPE_WYSIWYG:
112  $this->tpl->setVariable("HREF_CMD",
113  $ilCtrl->getLinkTarget($this->parent_obj, 'editWysiwygField'));
114  break;
115 
116  case UDF_TYPE_SELECT:
117  $this->tpl->setVariable("HREF_CMD",
118  $ilCtrl->getLinkTarget($this->parent_obj, 'editSelectField'));
119  break;
120  }
121  $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
122  $this->tpl->parseCurrentBlock();
123  $this->tpl->setCurrentBlock("action");
124  $this->tpl->setVariable("HREF_CMD",
125  $ilCtrl->getLinkTarget($this->parent_obj, 'askDeleteField'));
126  $this->tpl->setVariable("TXT_CMD", $lng->txt("delete"));
127  $this->tpl->parseCurrentBlock();
128 
129  // field name
130  $this->tpl->setVariable("TXT_FIELD", $a_set["field_name"]);
131  }
132 
133  public function setConfirmChange()
134  {
135  $this->confirm_change = true;
136  }
137 
138 }
139 ?>