ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilUserSearchOptions Class Reference

Class ilUserSearchOptions. More...

+ Collaboration diagram for ilUserSearchOptions:

Static Public Member Functions

static getSelectableColumnInfo (bool $a_admin=false)
 Get info of searchable fields for selectable columns in table gui. More...
 
static _getSearchableFieldsInfo (bool $a_admin=false)
 
static _getPossibleFields (bool $a_admin=false)
 
static _isSearchable (string $a_key)
 
static _isEnabled ($a_key)
 
static _saveStatus (string $a_key, bool $a_enabled)
 
static __appendUserDefinedFields (array $fields, int $counter)
 
static __prepareValues (array $a_values)
 

Data Fields

const FIELD_TYPE_UDF_UNDEFINED = 0
 
const FIELD_TYPE_UDF_SELECT = 1
 
const FIELD_TYPE_UDF_TEXT = 2
 
const FIELD_TYPE_SELECT = 3
 
const FIELD_TYPE_TEXT = 4
 
const FIELD_TYPE_MULTI = 5
 
const FIELD_TYPE_UDF_WYSIWYG = 6
 

Detailed Description

Class ilUserSearchOptions.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 33 of file class.ilUserSearchOptions.php.

Member Function Documentation

◆ __appendUserDefinedFields()

static ilUserSearchOptions::__appendUserDefinedFields ( array  $fields,
int  $counter 
)
static

Definition at line 216 of file class.ilUserSearchOptions.php.

216 : array
217 {
218 global $DIC;
219 $lng = $DIC->language();
220 foreach ($DIC['user']->getProfile()->getVisibleUserDefinedFields(Context::Search) as $field) {
221 $input = $field->getLegacyInput($lng, Context::Search);
222 if ($input instanceof ilSelectInputGUI) {
223 $fields[$counter]['values'] = ilUserSearchOptions::__prepareValues($input->getOptions());
224 $fields[$counter]['type'] = self::FIELD_TYPE_UDF_SELECT;
225 }
226 $fields[$counter]['lang'] = $field->getLabel($lng);
227 $fields[$counter]['db'] = $field->getIdentifier();
228
229 switch (get_class($input)) {
230 case ilTextInputGUI::class:
231 $fields[$counter]['type'] = self::FIELD_TYPE_UDF_TEXT;
232 break;
233
234 case ilTextAreaInputGUI::class:
235 $fields[$counter]['type'] = self::FIELD_TYPE_UDF_WYSIWYG;
236 break;
237
238 default:
239 // do not throw: udf plugin support
240 $fields[$counter]['type'] = get_class($input);
241 break;
242 }
243 ++$counter;
244 }
245 return $fields;
246 }
This class represents a selection list property in a property form.
static __prepareValues(array $a_values)
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26
$counter

References $counter, $DIC, $lng, __prepareValues(), FIELD_TYPE_UDF_SELECT, FIELD_TYPE_UDF_TEXT, and FIELD_TYPE_UDF_WYSIWYG.

Referenced by _getSearchableFieldsInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __prepareValues()

static ilUserSearchOptions::__prepareValues ( array  $a_values)
static

Definition at line 248 of file class.ilUserSearchOptions.php.

248 : array
249 {
250 global $DIC;
251
252 $lng = $DIC->language();
253
254 $new_values = array(0 => $lng->txt('please_choose'));
255 foreach ($a_values as $value) {
256 $new_values[$value] = $value;
257 }
258 return $new_values;
259 }

References $DIC, and $lng.

Referenced by __appendUserDefinedFields().

+ Here is the caller graph for this function:

◆ _getPossibleFields()

static ilUserSearchOptions::_getPossibleFields ( bool  $a_admin = false)
static

Definition at line 161 of file class.ilUserSearchOptions.php.

161 : array
162 {
163 return array('gender',
164 'lastname',
165 'firstname',
166 'login',
167 'title',
168 'institution',
169 'department',
170 'street',
171 'zipcode',
172 'city',
173 'country',
174 'sel_country',
175 'email',
176 'second_email',
177 'hobby',
178 'org_units',
179 // begin-patch lok
180 'matriculation',
181 'interests_general',
182 'interests_help_offered',
183 'interests_help_looking'
184 );
185 // end-patch lok
186 }

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

+ Here is the caller graph for this function:

◆ _getSearchableFieldsInfo()

static ilUserSearchOptions::_getSearchableFieldsInfo ( bool  $a_admin = false)
static
Todo:
: implement a more general solution

Definition at line 70 of file class.ilUserSearchOptions.php.

70 : array
71 {
72 global $DIC;
73
74 $lng = $DIC->language();
75
76 // begin-patch lok
77 $lng->loadLanguageModule('user');
78 // end-patch lok
79
80 $counter = 1;
81 $fields = [];
82 foreach (ilUserSearchOptions::_getPossibleFields($a_admin) as $field) {
83 // TODO: check enabled
84 // DONE
85 if ($a_admin == false and !ilUserSearchOptions::_isEnabled($field)) {
86 continue;
87 }
88 $fields[$counter]['values'] = array();
89 $fields[$counter]['type'] = self::FIELD_TYPE_TEXT;
90 $fields[$counter]['lang'] = $lng->txt($field);
91 $fields[$counter]['db'] = $field;
92
96 $fields[$counter]['autoComplete'] = false;
97 switch ($field) {
98 case 'login':
99 case 'firstname':
100 case 'lastname':
101 case 'email':
102 case 'second_email':
103 $fields[$counter]['autoComplete'] = true;
104 break;
105
106 case 'title':
107 $fields[$counter]['lang'] = $lng->txt('person_title');
108 break;
109
110 // SELECTS
111
112 case 'gender':
113 $fields[$counter]['type'] = self::FIELD_TYPE_SELECT;
114 $fields[$counter]['values'] = array(
115 0 => $lng->txt('please_choose'),
116 'n' => $lng->txt('gender_n'),
117 'f' => $lng->txt('gender_f'),
118 'm' => $lng->txt('gender_m'),
119 );
120 break;
121
122 case 'sel_country':
123 $fields[$counter]['type'] = self::FIELD_TYPE_SELECT;
124 $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'));
125
126 // #7843 -- see ilCountrySelectInputGUI
127 $lng->loadLanguageModule('meta');
128 foreach (ilCountry::getCountryCodes() as $c) {
129 $fields[$counter]['values'][$c] = $lng->txt('meta_c_' . $c);
130 }
131 asort($fields[$counter]['values']);
132 break;
133
134 case 'org_units':
135 $fields[$counter]['type'] = self::FIELD_TYPE_SELECT;
137 $options[0] = $lng->txt('select_one');
138 foreach ($paths as $org_ref_id => $path) {
139 $options[$org_ref_id] = $path;
140 }
141
142 $fields[$counter]['values'] = $options;
143 break;
144
145
146 // begin-patch lok
147 case 'interests_general':
148 case 'interests_help_offered':
149 case 'interests_help_looking':
150 $fields[$counter]['type'] = self::FIELD_TYPE_MULTI;
151 break;
152 }
153
154 ++$counter;
155 }
157
158 return $fields ?: array();
159 }
static getCountryCodes()
Get country codes (DIN EN 3166-1)
static getTextRepresentationOfOrgUnits(bool $sort_by_title=true)
Get ref id path array.
static __appendUserDefinedFields(array $fields, int $counter)
static _getPossibleFields(bool $a_admin=false)
$c
Definition: deliver.php:25
$path
Definition: ltiservices.php:30

References $c, $counter, $DIC, $lng, $path, __appendUserDefinedFields(), _getPossibleFields(), _isEnabled(), FIELD_TYPE_MULTI, FIELD_TYPE_SELECT, FIELD_TYPE_TEXT, ilCountry\getCountryCodes(), and ilOrgUnitPathStorage\getTextRepresentationOfOrgUnits().

Referenced by ilRepositorySearchGUI\__performUserSearch(), and ilRepositorySearchGUI\initFormSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isEnabled()

static ilUserSearchOptions::_isEnabled (   $a_key)
static

Definition at line 193 of file class.ilUserSearchOptions.php.

193 : bool
194 {
195 global $DIC;
196
197 $settings = $DIC->settings();
198
199 // login is always enabled
200 if ($a_key == 'login') {
201 return true;
202 }
203 return (bool) $settings->get('search_enabled_' . $a_key);
204 }

References $DIC.

Referenced by _getSearchableFieldsInfo(), ilMailAutoCompleteUserProvider\getFields(), ilUserAutoComplete\getFields(), ilUserAutoComplete\getList(), ILIAS\Mail\Message\MailBoxQuery\getWhere(), ILIAS\MyStaff\ListCertificates\ilMStListCertificatesTableGUI\initFilter(), ILIAS\MyStaff\ListCompetences\Skills\ilMStListCompetencesSkillsTableGUI\initFilter(), ilMStListCoursesTableGUI\initFilter(), ILIAS\MyStaff\ListUsers\ilMStListUsersTableGUI\initFilter(), and ilRepositorySearchGUI\initFormSearch().

+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable ( string  $a_key)
static

Definition at line 188 of file class.ilUserSearchOptions.php.

188 : bool
189 {
190 return in_array($a_key, ilUserSearchOptions::_getPossibleFields());
191 }

References _getPossibleFields().

+ Here is the call graph for this function:

◆ _saveStatus()

static ilUserSearchOptions::_saveStatus ( string  $a_key,
bool  $a_enabled 
)
static

Definition at line 206 of file class.ilUserSearchOptions.php.

206 : bool
207 {
208 global $DIC;
209
210 $ilias = $DIC['ilias'];
211
212 $ilias->setSetting('search_enabled_' . $a_key, (string) $a_enabled);
213 return true;
214 }

References $DIC.

◆ getSelectableColumnInfo()

static ilUserSearchOptions::getSelectableColumnInfo ( bool  $a_admin = false)
static

Get info of searchable fields for selectable columns in table gui.

Parameters
bool$a_admin
Returns
array

Definition at line 51 of file class.ilUserSearchOptions.php.

51 : array
52 {
53 $col_info = array();
54 foreach (self::_getSearchableFieldsInfo($a_admin) as $field) {
55 if (is_numeric($field['db'])) {
56 $field['db'] = 'udf_' . $field['db'];
57 }
58
59 $col_info[$field['db']] = array(
60 'txt' => $field['lang']
61 );
62
63 if ($field['db'] == 'login' or $field['db'] == 'firstname' or $field['db'] == 'lastname') {
64 $col_info[$field['db']]['default'] = true;
65 }
66 }
67 return $col_info;
68 }

Referenced by ilRepositoryUserResultTableGUI\getSelectableColumns(), ILIAS\MyStaff\ListCertificates\ilMStListCertificatesTableGUI\initSelectableColumns(), ILIAS\MyStaff\ListCompetences\Skills\ilMStListCompetencesSkillsTableGUI\initSelectableColumns(), ilMStListCoursesTableGUI\initSelectableColumns(), and ILIAS\MyStaff\ListUsers\ilMStListUsersTableGUI\initSelectableColumns().

+ Here is the caller graph for this function:

Field Documentation

◆ FIELD_TYPE_MULTI

const ilUserSearchOptions::FIELD_TYPE_MULTI = 5

◆ FIELD_TYPE_SELECT

const ilUserSearchOptions::FIELD_TYPE_SELECT = 3

◆ FIELD_TYPE_TEXT

const ilUserSearchOptions::FIELD_TYPE_TEXT = 4

◆ FIELD_TYPE_UDF_SELECT

const ilUserSearchOptions::FIELD_TYPE_UDF_SELECT = 1

◆ FIELD_TYPE_UDF_TEXT

const ilUserSearchOptions::FIELD_TYPE_UDF_TEXT = 2

◆ FIELD_TYPE_UDF_UNDEFINED

const ilUserSearchOptions::FIELD_TYPE_UDF_UNDEFINED = 0

Definition at line 35 of file class.ilUserSearchOptions.php.

Referenced by ilRepositorySearchGUI\initFormSearch().

◆ FIELD_TYPE_UDF_WYSIWYG

const ilUserSearchOptions::FIELD_TYPE_UDF_WYSIWYG = 6

Definition at line 43 of file class.ilUserSearchOptions.php.

Referenced by __appendUserDefinedFields().


The documentation for this class was generated from the following file: