ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserSearchOptions Class Reference
+ Collaboration diagram for ilUserSearchOptions:

Public Member Functions

 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 222 of file class.ilUserSearchOptions.php.

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

Referenced by _getSearchableFieldsInfo().

223  {
224  include_once './Services/User/classes/class.ilUserDefinedFields.php';
225 
226  $user_defined_fields = ilUserDefinedFields::_getInstance();
227 
228  foreach($user_defined_fields->getSearchableDefinitions() as $definition)
229  {
230  $fields[$counter]['values'] = ilUserSearchOptions::__prepareValues($definition['field_values']);
231  $fields[$counter]['lang'] = $definition['field_name'];
232  $fields[$counter]['db'] = $definition['field_id'];
233 
234  switch($definition['field_type'])
235  {
236  case UDF_TYPE_TEXT:
237  $fields[$counter]['type'] = FIELD_TYPE_UDF_TEXT;
238  break;
239 
240  case UDF_TYPE_SELECT:
241  $fields[$counter]['type'] = FIELD_TYPE_UDF_SELECT;
242  break;
243  }
244  ++$counter;
245  }
246  return $fields ? $fields : array();
247  }
const UDF_TYPE_SELECT
static _getInstance()
Get instance.
const FIELD_TYPE_UDF_TEXT
const UDF_TYPE_TEXT
const FIELD_TYPE_UDF_SELECT
Class ilUserSearchOptions.
+ 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 249 of file class.ilUserSearchOptions.php.

References $lng.

Referenced by __appendUserDefinedFields().

250  {
251  global $lng;
252 
253  $new_values = array(0 => $lng->txt('please_choose'));
254  foreach($a_values as $value)
255  {
256  $new_values[$value] = $value;
257  }
258  return $new_values ? $new_values : array();
259  }
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ _getPossibleFields()

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

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

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

171  {
172  return array('gender',
173  'lastname',
174  'firstname',
175  'login',
176  'title',
177  'institution',
178  'department',
179  'street',
180  'zipcode',
181  'city',
182  'country',
183  'sel_country',
184  'email',
185  'hobby',
186  // begin-patch lok
187  'matriculation',
188  'interests_general',
189  'interests_help_offered',
190  'interests_help_looking'
191  );
192  // end-patch lok
193 
194  }
+ 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 79 of file class.ilUserSearchOptions.php.

References $lng, __appendUserDefinedFields(), _getPossibleFields(), _isEnabled(), FIELD_TYPE_MULTI, FIELD_TYPE_SELECT, FIELD_TYPE_TEXT, and ilCountry\getCountryCodes().

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

80  {
81  global $lng;
82 
83  // begin-patch lok
84  $lng->loadLanguageModule('user');
85  // end-patch lok
86 
87  $counter = 1;
88  foreach(ilUserSearchOptions::_getPossibleFields($a_admin) as $field)
89  {
90  // TODO: check enabled
91  // DONE
92  if($a_admin == false and !ilUserSearchOptions::_isEnabled($field))
93  {
94  continue;
95  }
96  $fields[$counter]['values'] = array();
97  $fields[$counter]['type'] = FIELD_TYPE_TEXT;
98  $fields[$counter]['lang'] = $lng->txt($field);
99  $fields[$counter]['db'] = $field;
100 
104  $fields[$counter]['autoComplete'] = false;
105  switch($field)
106  {
107  case 'login':
108  case 'firstname':
109  case 'lastname':
110  case 'email':
111  $fields[$counter]['autoComplete'] = true;
112  break;
113 
114  case 'title':
115  $fields[$counter]['lang'] = $lng->txt('person_title');
116  break;
117 
118  // SELECTS
119 
120  case 'gender':
121  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
122  $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'),
123  'f' => $lng->txt('gender_f'),
124  'm' => $lng->txt('gender_m'));
125  break;
126 
127  case 'sel_country':
128  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
129  $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'));
130 
131  // #7843 -- see ilCountrySelectInputGUI
132  $lng->loadLanguageModule('meta');
133  include_once('./Services/Utilities/classes/class.ilCountry.php');
134  foreach (ilCountry::getCountryCodes() as $c)
135  {
136  $fields[$counter]['values'][$c] = $lng->txt('meta_c_'.$c);
137  }
138  asort($fields[$counter]['values']);
139  break;
140 
141  // begin-patch lok
142  case 'interests_general':
143  case 'interests_help_offered':
144  case 'interests_help_looking':
145  $fields[$counter]['type'] = FIELD_TYPE_MULTI;
146  break;
147  // end-patch lok
148 
149 
150 
151 
152  /*
153  case 'active':
154  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
155  $fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
156  '1' => $lng->txt('active'),
157  '0' => $lng->txt('inactive'));
158 
159  break;
160  */
161  }
162 
163  ++$counter;
164  }
165  $fields = ilUserSearchOptions::__appendUserDefinedFields($fields,$counter);
166 
167  return $fields ? $fields : array();
168  }
const FIELD_TYPE_MULTI
const FIELD_TYPE_SELECT
static _getPossibleFields($a_admin=false)
global $lng
Definition: privfeed.php:40
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 201 of file class.ilUserSearchOptions.php.

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

202  {
203  global $ilias;
204 
205  // login is always enabled
206  if($a_key == 'login')
207  {
208  return true;
209  }
210 
211  return (bool) $ilias->getSetting('search_enabled_'.$a_key);
212  }
+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable (   $a_key)
static

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

References _getPossibleFields().

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

197  {
198  return in_array($a_key,ilUserSearchOptions::_getPossibleFields());
199  }
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 214 of file class.ilUserSearchOptions.php.

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

215  {
216  global $ilias;
217 
218  $ilias->setSetting('search_enabled_'.$a_key,(int) $a_enabled);
219  return true;
220  }
+ 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 57 of file class.ilUserSearchOptions.php.

Referenced by ilRepositoryUserResultTableGUI\getSelectableColumns().

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

◆ ilUserSearchOptions()

ilUserSearchOptions::ilUserSearchOptions ( )

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

49  {
50  }

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: