ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  private $permissions; // [ilUDFPermissionHelper]
18  private $perm_map; // [array]
19 
23  public function __construct($a_parent_obj, $a_parent_cmd, ilUDFPermissionHelper $a_permissions)
24  {
25  global $ilCtrl, $lng, $ilAccess, $lng;
26 
27  $this->permissions = $a_permissions;
29 
30  parent::__construct($a_parent_obj, $a_parent_cmd);
31  $this->setTitle($lng->txt("user_defined_list"));
32  $this->setLimit(9999);
33 
34  $this->addColumn("", "", 1);
35  $this->addColumn($this->lng->txt("user_field"), "");
36  $this->addColumn($this->lng->txt("access"), "");
37  $this->addColumn($this->lng->txt("export") . " / " . $this->lng->txt("search") .
38  " / " . $this->lng->txt("certificate"), "");
39  $this->addColumn($this->lng->txt("actions"), "");
40 
41  $this->setEnableHeader(true);
42  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
43  $this->setRowTemplate("tpl.std_fields_settings_row.html", "Services/User");
44  $this->disable("footer");
45  $this->setEnableTitle(true);
46 
47  $user_field_definitions = ilUserDefinedFields::_getInstance();
48  $fds = $user_field_definitions->getDefinitions();
49 
50  foreach ($fds as $k => $f) {
51  $fds[$k]["key"] = $k;
52  }
53  $this->setData($fds);
54  $this->addCommandButton("updateFields", $lng->txt("save"));
55  $this->addMultiCommand("askDeleteField", $lng->txt("delete"));
56  }
57 
61  protected function fillRow($a_set)
62  {
63  global $lng, $ilSetting, $ilCtrl;
64 
65  $field = $a_set["field_id"];
66 
67  $props = array("visible" => "user_visible_in_profile",
68  "changeable" => "changeable",
69  "searchable" => "header_searchable",
70  "required" => "required_field",
71  "export" => "export",
72  "course_export" => "course_export",
73  'group_export' => 'group_export',
74  "visib_reg" => "header_visible_registration",
75  'visib_lua' => 'usr_settings_visib_lua',
76  'changeable_lua' => 'usr_settings_changeable_lua',
77  'certificate' => 'certificate'
78  );
79 
80  $perms = $this->permissions->hasPermissions(
82  $field,
83  array(
107  )
108  );
109 
110  foreach ($props as $prop => $lv) {
111  $up_prop = strtoupper($prop);
112 
113  if ($a_set["field_type"] != UDF_TYPE_WYSIWYG ||
114  ($prop != "searchable")) {
115  $this->tpl->setCurrentBlock($prop);
116  $this->tpl->setVariable(
117  "HEADER_" . $up_prop,
118  $lng->txt($lv)
119  );
120  $this->tpl->setVariable("PROFILE_OPTION_" . $up_prop, $prop . "_" . $field);
121 
122  // determine checked status
123  $checked = false;
124  if ($a_set[$prop]) {
125  $checked = true;
126  }
127  if ($this->confirm_change == 1) { // confirm value
128  $checked = $_POST["chb"][$prop . "_" . $field];
129  }
130 
131  if ($checked) {
132  $this->tpl->setVariable("CHECKED_" . $up_prop, " checked=\"checked\"");
133  }
134 
135  if (!$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS][$this->perm_map[$prop]]) {
136  $this->tpl->setVariable("DISABLE_" . $up_prop, " disabled=\"disabled\"");
137  }
138 
139  $this->tpl->parseCurrentBlock();
140  }
141  }
142 
143  // actions
145  $ilCtrl->setParameter($this->parent_obj, 'field_id', $a_set["field_id"]);
146  $this->tpl->setCurrentBlock("action");
147  $this->tpl->setVariable(
148  "HREF_CMD",
149  $ilCtrl->getLinkTarget($this->parent_obj, 'edit')
150  );
151  $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
152  $this->tpl->parseCurrentBlock();
153  }
154 
155  // field name
156  $this->tpl->setCurrentBlock("cb");
157  $this->tpl->setVariable("FIELD_ID", $a_set["field_id"]);
158  $this->tpl->parseCurrentBlock();
159  $this->tpl->setVariable("TXT_FIELD", $a_set["field_name"]);
160  }
161 
162  public function setConfirmChange()
163  {
164  $this->confirm_change = true;
165  }
166 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static _getInstance()
Get instance.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
__construct($a_parent_obj, $a_parent_cmd, ilUDFPermissionHelper $a_permissions)
Constructor.
Class ilTable2GUI.
TableGUI class for custom defined user fields.
addMultiCommand($a_cmd, $a_text)
Add Command button.
const UDF_TYPE_WYSIWYG
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
global $ilSetting
Definition: privfeed.php:17
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
$_POST["username"]
setLimit($a_limit=0, $a_default_limit=0)