ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilUserFieldSettingsTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_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("usr_settings_header_profile"));
27 $this->setDescription($lng->txt("usr_settings_explanation_profile"));
28 $this->setLimit(9999);
29
30 //$this->addColumn($this->lng->txt("usrs_group"), "");
31 //$this->addColumn("", "");
32 $this->addColumn($this->lng->txt("user_field"), "");
33 $this->addColumn($this->lng->txt("access"), "");
34 $this->addColumn($this->lng->txt("export")." / ".$this->lng->txt("search"), "");
35 $this->addColumn($this->lng->txt("default"), "");
36
37 $this->setEnableHeader(true);
38 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
39 $this->setRowTemplate("tpl.std_fields_settings_row.html", "Services/User");
40 $this->disable("footer");
41 $this->setEnableTitle(true);
42
43 include_once("./Services/User/classes/class.ilUserProfile.php");
44 $up = new ilUserProfile();
45 $up->skipField("username");
46 $fds = $up->getStandardFields();
47 // vd($fds);
48 foreach ($fds as $k => $f)
49 {
50 $fds[$k]["key"] = $k;
51 }
52 $this->setData($fds);
53 $this->addCommandButton("saveGlobalUserSettings", $lng->txt("save"));
54 }
55
59 protected function fillRow($a_set)
60 {
61 global $lng, $ilSetting;
62
63 $field = $a_set["key"];
64
65 $props = array(
66 "visible" => "user_visible_in_profile",
67 "changeable" => "changeable",
68 "searchable" => "header_searchable",
69 "required" => "required_field",
70 "export" => "export",
71 "course_export" => "course_export",
72 'group_export' => 'group_export',
73 "visib_reg" => "header_visible_registration",
74 'visib_lua' => 'usr_settings_visib_lua',
75 'changeable_lua' => 'usr_settings_changeable_lua'
76 );
77
78 foreach ($props as $prop => $lv)
79 {
80 $up_prop = strtoupper($prop);
81
82 if (($prop != "searchable" && $a_set[$prop."_hide"] != true) ||
83 ($prop == "searchable" && ilUserSearchOptions::_isSearchable($field)))
84 {
85 $this->tpl->setCurrentBlock($prop);
86 $this->tpl->setVariable("HEADER_".$up_prop,
87 $lng->txt($lv));
88 $this->tpl->setVariable("PROFILE_OPTION_".$up_prop, $prop."_".$field);
89
90 // determine checked status
91 $checked = false;
92 if ($prop == "visible" && $ilSetting->get("usr_settings_hide_".$field) != "1")
93 {
94 $checked = true;
95 }
96 if ($prop == "changeable" && $ilSetting->get("usr_settings_disable_".$field) != "1")
97 {
98 $checked = true;
99 }
100 if ($prop == "searchable" && ilUserSearchOptions::_isEnabled($field))
101 {
102 $checked = true;
103 }
104 if ($prop == "required" && $ilSetting->get("require_".$field) == "1")
105 {
106 $checked = true;
107 }
108 if ($prop == "export" && $ilSetting->get("usr_settings_export_".$field) == "1")
109 {
110 $checked = true;
111 }
112 if ($prop == "course_export" && $ilSetting->get("usr_settings_course_export_".$field) == "1")
113 {
114 $checked = true;
115 }
116 if ($prop == "group_export" && $ilSetting->get("usr_settings_group_export_".$field) == "1")
117 {
118 $checked = true;
119 }
120 if ($prop == "visib_reg" && (int)$ilSetting->get('usr_settings_visib_reg_'.$field, '1'))
121 {
122 $checked = true;
123 }
124 if ($prop == "visib_lua" && (int)$ilSetting->get('usr_settings_visib_lua_'.$field, '1'))
125 {
126 $checked = true;
127 }
128
129 if ($prop == "changeable_lua" && (int)$ilSetting->get('usr_settings_changeable_lua_'.$field, '1'))
130 {
131 $checked = true;
132 }
133
134
135 if ($this->confirm_change == 1) // confirm value
136 {
137 $checked = $_POST["chb"][$prop."_".$field];
138 }
139 if (isset($a_set[$prop."_fix_value"])) // fix values overwrite everything
140 {
141 $checked = $a_set[$prop."_fix_value"];
142 }
143
144 if ($checked)
145 {
146 $this->tpl->setVariable("CHECKED_".$up_prop, " checked=\"checked\"");
147 }
148 if (isset($a_set[$prop."_fix_value"]))
149 {
150 $this->tpl->setVariable("DISABLE_".$up_prop, " disabled=\"disabled\"");
151 }
152 $this->tpl->parseCurrentBlock();
153 }
154 }
155
156 // default
157 if ($a_set["default"] != "")
158 {
159 switch ($a_set["input"])
160 {
161 case "selection":
162 case "hitsperpage":
163 $selected_option = $ilSetting->get($field);
164 if ($selected_option == "")
165 {
166 $selected_option = $a_set["default"];
167 }
168 foreach ($a_set["options"] as $k => $v)
169 {
170 $this->tpl->setCurrentBlock("def_sel_option");
171 $this->tpl->setVariable("OPTION_VALUE", $k);
172 $text = ($a_set["input"] == "selection")
173 ? $lng->txt($v)
174 : $v;
175 if ($a_set["input"] == "hitsperpage" && $k == 9999)
176 {
177 $text = $lng->txt("no_limit");
178 }
179 if ($selected_option == $k)
180 {
181 $this->tpl->setVariable("OPTION_SELECTED",
182 ' selected="selected" ');
183 }
184 $this->tpl->setVariable("OPTION_TEXT", $text);
185 $this->tpl->parseCurrentBlock();
186 }
187 $this->tpl->setCurrentBlock("def_selection");
188 $this->tpl->setVariable("PROFILE_OPTION_DEFAULT_VALUE", "default_" . $field);
189 $this->tpl->parseCurrentBlock();
190 break;
191 }
192 $this->tpl->setCurrentBlock("default");
193 $this->tpl->parseCurrentBlock();
194 }
195
196 // group name
197 $this->tpl->setVariable("TXT_GROUP", $lng->txt($a_set["group"]));
198
199 // field name
200 $lv = ($a_set["lang_var"] == "")
201 ? $a_set["key"]
202 : $a_set["lang_var"];
203 if ($a_set["key"] == "country")
204 {
205 $lv = "country_free_text";
206 }
207 if ($a_set["key"] == "sel_country")
208 {
209 $lv = "country_selection";
210 }
211
212 $this->tpl->setVariable("TXT_FIELD", $lng->txt($lv));
213 }
214
215 public function setConfirmChange()
216 {
217 $this->confirm_change = true;
218 }
219
220}
221?>
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDescription($a_val)
Set description.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
disable($a_module_name)
diesables particular modules of table
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
Class ilUserProfile.
$_POST['username']
Definition: cron.php:12
$text
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilSetting
Definition: privfeed.php:40