ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilUserSearchOptions Class Reference
+ Collaboration diagram for ilUserSearchOptions:

Static Public Member Functions

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

Data Fields

 $db = null
 

Detailed Description

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

Member Function Documentation

◆ __appendUserDefinedFields()

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

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

References $counter, __prepareValues(), ilUserDefinedFields\_getInstance(), array, FIELD_TYPE_UDF_SELECT, FIELD_TYPE_UDF_TEXT, UDF_TYPE_SELECT, and UDF_TYPE_TEXT.

Referenced by _getSearchableFieldsInfo().

242  {
243  include_once './Services/User/classes/class.ilUserDefinedFields.php';
244 
245  $user_defined_fields = ilUserDefinedFields::_getInstance();
246 
247  foreach($user_defined_fields->getSearchableDefinitions() as $definition)
248  {
249  $fields[$counter]['values'] = ilUserSearchOptions::__prepareValues($definition['field_values']);
250  $fields[$counter]['lang'] = $definition['field_name'];
251  $fields[$counter]['db'] = $definition['field_id'];
252 
253  switch($definition['field_type'])
254  {
255  case UDF_TYPE_TEXT:
256  $fields[$counter]['type'] = FIELD_TYPE_UDF_TEXT;
257  break;
258 
259  case UDF_TYPE_SELECT:
260  $fields[$counter]['type'] = FIELD_TYPE_UDF_SELECT;
261  break;
262  }
263  ++$counter;
264  }
265  return $fields ? $fields : array();
266  }
const UDF_TYPE_SELECT
static _getInstance()
Get instance.
const FIELD_TYPE_UDF_TEXT
$counter
const UDF_TYPE_TEXT
const FIELD_TYPE_UDF_SELECT
Class ilUserSearchOptions.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __prepareValues()

static ilUserSearchOptions::__prepareValues (   $a_values)
static

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

References $lng, and array.

Referenced by __appendUserDefinedFields().

269  {
270  global $lng;
271 
272  $new_values = array(0 => $lng->txt('please_choose'));
273  foreach($a_values as $value)
274  {
275  $new_values[$value] = $value;
276  }
277  return $new_values ? $new_values : array();
278  }
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ _getPossibleFields()

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

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

References array.

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

189  {
190  return array('gender',
191  'lastname',
192  'firstname',
193  'login',
194  'title',
195  'institution',
196  'department',
197  'street',
198  'zipcode',
199  'city',
200  'country',
201  'sel_country',
202  'email',
203  'hobby',
204  'org_units',
205  // begin-patch lok
206  'matriculation',
207  'interests_general',
208  'interests_help_offered',
209  'interests_help_looking'
210  );
211  // end-patch lok
212 
213  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _getSearchableFieldsInfo()

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

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

References $counter, $lng, $options, $path, __appendUserDefinedFields(), ilObjOrgUnitTree\_getInstance(), _getPossibleFields(), _isEnabled(), array, FIELD_TYPE_MULTI, FIELD_TYPE_SELECT, FIELD_TYPE_TEXT, ilCountry\getCountryCodes(), ilObjOrgUnit\getRootOrgRefId(), and ilOrgUnitPathStorage\getTextRepresentationOfOrgUnits().

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

76  {
77  global $lng;
78 
79  // begin-patch lok
80  $lng->loadLanguageModule('user');
81  // end-patch lok
82 
83  $counter = 1;
84  foreach(ilUserSearchOptions::_getPossibleFields($a_admin) as $field)
85  {
86  // TODO: check enabled
87  // DONE
88  if($a_admin == false and !ilUserSearchOptions::_isEnabled($field))
89  {
90  continue;
91  }
92  $fields[$counter]['values'] = array();
93  $fields[$counter]['type'] = FIELD_TYPE_TEXT;
94  $fields[$counter]['lang'] = $lng->txt($field);
95  $fields[$counter]['db'] = $field;
96 
100  $fields[$counter]['autoComplete'] = false;
101  switch($field)
102  {
103  case 'login':
104  case 'firstname':
105  case 'lastname':
106  case 'email':
107  $fields[$counter]['autoComplete'] = true;
108  break;
109 
110  case 'title':
111  $fields[$counter]['lang'] = $lng->txt('person_title');
112  break;
113 
114  // SELECTS
115 
116  case 'gender':
117  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
118  $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'),
119  'f' => $lng->txt('gender_f'),
120  'm' => $lng->txt('gender_m'));
121  break;
122 
123  case 'sel_country':
124  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
125  $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'));
126 
127  // #7843 -- see ilCountrySelectInputGUI
128  $lng->loadLanguageModule('meta');
129  include_once('./Services/Utilities/classes/class.ilCountry.php');
130  foreach (ilCountry::getCountryCodes() as $c)
131  {
132  $fields[$counter]['values'][$c] = $lng->txt('meta_c_'.$c);
133  }
134  asort($fields[$counter]['values']);
135  break;
136 
137  case 'org_units':
138  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
139 
140  include_once './Modules/OrgUnit/classes/class.ilObjOrgUnit.php';
142  include_once './Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
144  $nodes = $tree->getAllChildren($root);
145 
146  include_once './Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
148 
149  $options[0] = $lng->txt('select_one');
150  foreach($paths as $org_ref_id => $path)
151  {
152  $options[$org_ref_id] = $path;
153  }
154 
155  $fields[$counter]['values'] = $options;
156  break;
157 
158 
159  // begin-patch lok
160  case 'interests_general':
161  case 'interests_help_offered':
162  case 'interests_help_looking':
163  $fields[$counter]['type'] = FIELD_TYPE_MULTI;
164  break;
165  // end-patch lok
166 
167 
168 
169 
170  /*
171  case 'active':
172  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
173  $fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
174  '1' => $lng->txt('active'),
175  '0' => $lng->txt('inactive'));
176 
177  break;
178  */
179  }
180 
181  ++$counter;
182  }
184 
185  return $fields ? $fields : array();
186  }
$path
Definition: aliased.php:25
const FIELD_TYPE_MULTI
const FIELD_TYPE_SELECT
$counter
if(!is_array($argv)) $options
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
Create styles array
The data for the language used.
static _getPossibleFields($a_admin=false)
static getRootOrgRefId()
global $lng
Definition: privfeed.php:17
static getCountryCodes()
Get country codes (DIN EN 3166-1)
const FIELD_TYPE_TEXT
static __appendUserDefinedFields($fields, $counter)
+ 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 220 of file class.ilUserSearchOptions.php.

Referenced by _getSearchableFieldsInfo(), ilUserFieldSettingsTableGUI\fillRow(), ilMailAutoCompleteUserProvider\getFields(), ilUserAutoComplete\getFields(), and ilUserAutoComplete\setResultField().

221  {
222  global $ilias;
223 
224  // login is always enabled
225  if($a_key == 'login')
226  {
227  return true;
228  }
229 
230  return (bool) $ilias->getSetting('search_enabled_'.$a_key);
231  }
+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable (   $a_key)
static

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

References _getPossibleFields().

Referenced by ilUserFieldSettingsTableGUI\fillRow(), and ilObjUserFolderGUI\saveGlobalUserSettingsObject().

216  {
217  return in_array($a_key,ilUserSearchOptions::_getPossibleFields());
218  }
static _getPossibleFields($a_admin=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveStatus()

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

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

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

234  {
235  global $ilias;
236 
237  $ilias->setSetting('search_enabled_'.$a_key,(int) $a_enabled);
238  return true;
239  }
+ Here is the caller graph for this function:

◆ getSelectableColumnInfo()

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

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

Parameters
bool$a_admin
Returns
array

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

References array.

Referenced by ilRepositoryUserResultTableGUI\getSelectableColumns().

54  {
55  $col_info = array();
56  foreach(self::_getSearchableFieldsInfo($a_admin) as $field)
57  {
58  if(is_numeric($field['db']))
59  {
60  $field['db'] = 'udf_'.$field['db'];
61  }
62 
63  $col_info[$field['db']] = array(
64  'txt' => $field['lang']
65  );
66 
67  if($field['db'] == 'login' or $field['db'] == 'firstname' or $field['db'] == 'lastname')
68  {
69  $col_info[$field['db']]['default'] = true;
70  }
71  }
72  return $col_info;
73  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilUserSearchOptions::$db = null

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


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