ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 230 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().

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

References $lng, and array.

Referenced by __appendUserDefinedFields().

256  {
257  global $lng;
258 
259  $new_values = array(0 => $lng->txt('please_choose'));
260  foreach ($a_values as $value) {
261  $new_values[$value] = $value;
262  }
263  return $new_values ? $new_values : array();
264  }
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 178 of file class.ilUserSearchOptions.php.

References array.

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

179  {
180  return array('gender',
181  'lastname',
182  'firstname',
183  'login',
184  'title',
185  'institution',
186  'department',
187  'street',
188  'zipcode',
189  'city',
190  'country',
191  'sel_country',
192  'email',
193  'second_email',
194  'hobby',
195  'org_units',
196  // begin-patch lok
197  'matriculation',
198  'interests_general',
199  'interests_help_offered',
200  'interests_help_looking'
201  );
202  // end-patch lok
203  }
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 72 of file class.ilUserSearchOptions.php.

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

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

73  {
74  global $lng;
75 
76  // begin-patch lok
77  $lng->loadLanguageModule('user');
78  // end-patch lok
79 
80  $counter = 1;
81  foreach (ilUserSearchOptions::_getPossibleFields($a_admin) as $field) {
82  // TODO: check enabled
83  // DONE
84  if ($a_admin == false and !ilUserSearchOptions::_isEnabled($field)) {
85  continue;
86  }
87  $fields[$counter]['values'] = array();
88  $fields[$counter]['type'] = FIELD_TYPE_TEXT;
89  $fields[$counter]['lang'] = $lng->txt($field);
90  $fields[$counter]['db'] = $field;
91 
95  $fields[$counter]['autoComplete'] = false;
96  switch ($field) {
97  case 'login':
98  case 'firstname':
99  case 'lastname':
100  case 'email':
101  case 'second_email':
102  $fields[$counter]['autoComplete'] = true;
103  break;
104 
105  case 'title':
106  $fields[$counter]['lang'] = $lng->txt('person_title');
107  break;
108 
109  // SELECTS
110 
111  case 'gender':
112  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
113  $fields[$counter]['values'] = array(
114  0 => $lng->txt('please_choose'),
115  'n' => $lng->txt('gender_n'),
116  'f' => $lng->txt('gender_f'),
117  'm' => $lng->txt('gender_m'),
118  );
119  break;
120 
121  case 'sel_country':
122  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
123  $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'));
124 
125  // #7843 -- see ilCountrySelectInputGUI
126  $lng->loadLanguageModule('meta');
127  include_once('./Services/Utilities/classes/class.ilCountry.php');
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'] = FIELD_TYPE_SELECT;
136 
137  include_once './Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
139 
140  $options[0] = $lng->txt('select_one');
141  foreach ($paths as $org_ref_id => $path) {
142  $options[$org_ref_id] = $path;
143  }
144 
145  $fields[$counter]['values'] = $options;
146  break;
147 
148 
149  // begin-patch lok
150  case 'interests_general':
151  case 'interests_help_offered':
152  case 'interests_help_looking':
153  $fields[$counter]['type'] = FIELD_TYPE_MULTI;
154  break;
155  // end-patch lok
156 
157 
158 
159 
160  /*
161  case 'active':
162  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
163  $fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
164  '1' => $lng->txt('active'),
165  '0' => $lng->txt('inactive'));
166 
167  break;
168  */
169  }
170 
171  ++$counter;
172  }
174 
175  return $fields ? $fields : array();
176  }
const FIELD_TYPE_MULTI
const FIELD_TYPE_SELECT
$counter
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)
global $lng
Definition: privfeed.php:17
static getCountryCodes()
Get country codes (DIN EN 3166-1)
const FIELD_TYPE_TEXT
static __appendUserDefinedFields($fields, $counter)
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 210 of file class.ilUserSearchOptions.php.

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

211  {
212  global $ilias;
213 
214  // login is always enabled
215  if ($a_key == 'login') {
216  return true;
217  }
218 
219  return (bool) $ilias->getSetting('search_enabled_' . $a_key);
220  }
+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable (   $a_key)
static

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

References _getPossibleFields().

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

206  {
207  return in_array($a_key, ilUserSearchOptions::_getPossibleFields());
208  }
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 222 of file class.ilUserSearchOptions.php.

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

223  {
224  global $ilias;
225 
226  $ilias->setSetting('search_enabled_' . $a_key, (int) $a_enabled);
227  return true;
228  }
+ 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 ilMStListUsersTableGUI\getSelectableColumns(), ilRepositoryUserResultTableGUI\getSelectableColumns(), and ilMStListCoursesTableGUI\getSelectableColumns().

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