ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 236 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().

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

References $DIC, and $lng.

Referenced by __appendUserDefinedFields().

262  {
263  global $DIC;
264 
265  $lng = $DIC['lng'];
266 
267  $new_values = array(0 => $lng->txt('please_choose'));
268  foreach ($a_values as $value) {
269  $new_values[$value] = $value;
270  }
271  return $new_values ? $new_values : array();
272  }
global $DIC
Definition: saml.php:7
$lng
+ Here is the caller graph for this function:

◆ _getPossibleFields()

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

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

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

181  {
182  return array('gender',
183  'lastname',
184  'firstname',
185  'login',
186  'title',
187  'institution',
188  'department',
189  'street',
190  'zipcode',
191  'city',
192  'country',
193  'sel_country',
194  'email',
195  'second_email',
196  'hobby',
197  'org_units',
198  // begin-patch lok
199  'matriculation',
200  'interests_general',
201  'interests_help_offered',
202  'interests_help_looking'
203  );
204  // end-patch lok
205  }
+ 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 $c, $DIC, $lng, PHPMailer\PHPMailer\$options, $path, $paths, __appendUserDefinedFields(), _getPossibleFields(), _isEnabled(), FIELD_TYPE_MULTI, FIELD_TYPE_SELECT, FIELD_TYPE_TEXT, ilCountry\getCountryCodes(), and ilOrgUnitPathStorage\getTextRepresentationOfOrgUnits().

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

73  {
74  global $DIC;
75 
76  $lng = $DIC['lng'];
77 
78  // begin-patch lok
79  $lng->loadLanguageModule('user');
80  // end-patch lok
81 
82  $counter = 1;
83  foreach (ilUserSearchOptions::_getPossibleFields($a_admin) as $field) {
84  // TODO: check enabled
85  // DONE
86  if ($a_admin == false and !ilUserSearchOptions::_isEnabled($field)) {
87  continue;
88  }
89  $fields[$counter]['values'] = array();
90  $fields[$counter]['type'] = FIELD_TYPE_TEXT;
91  $fields[$counter]['lang'] = $lng->txt($field);
92  $fields[$counter]['db'] = $field;
93 
97  $fields[$counter]['autoComplete'] = false;
98  switch ($field) {
99  case 'login':
100  case 'firstname':
101  case 'lastname':
102  case 'email':
103  case 'second_email':
104  $fields[$counter]['autoComplete'] = true;
105  break;
106 
107  case 'title':
108  $fields[$counter]['lang'] = $lng->txt('person_title');
109  break;
110 
111  // SELECTS
112 
113  case 'gender':
114  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
115  $fields[$counter]['values'] = array(
116  0 => $lng->txt('please_choose'),
117  'n' => $lng->txt('gender_n'),
118  'f' => $lng->txt('gender_f'),
119  'm' => $lng->txt('gender_m'),
120  );
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  $fields[$counter]['values'][$c] = $lng->txt('meta_c_' . $c);
132  }
133  asort($fields[$counter]['values']);
134  break;
135 
136  case 'org_units':
137  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
138 
139  include_once './Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
141 
142  $options[0] = $lng->txt('select_one');
143  foreach ($paths as $org_ref_id => $path) {
144  $options[$org_ref_id] = $path;
145  }
146 
147  $fields[$counter]['values'] = $options;
148  break;
149 
150 
151  // begin-patch lok
152  case 'interests_general':
153  case 'interests_help_offered':
154  case 'interests_help_looking':
155  $fields[$counter]['type'] = FIELD_TYPE_MULTI;
156  break;
157  // end-patch lok
158 
159 
160 
161 
162  /*
163  case 'active':
164  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
165  $fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
166  '1' => $lng->txt('active'),
167  '0' => $lng->txt('inactive'));
168 
169  break;
170  */
171  }
172 
173  ++$counter;
174  }
175  $fields = ilUserSearchOptions::__appendUserDefinedFields($fields, $counter);
176 
177  return $fields ? $fields : array();
178  }
$path
Definition: aliased.php:25
if($argc< 2) $paths
Definition: migrateto20.php:44
global $DIC
Definition: saml.php:7
const FIELD_TYPE_MULTI
const FIELD_TYPE_SELECT
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
$lng
static _getPossibleFields($a_admin=false)
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 212 of file class.ilUserSearchOptions.php.

References $DIC.

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

213  {
214  global $DIC;
215 
216  $ilias = $DIC['ilias'];
217 
218  // login is always enabled
219  if ($a_key == 'login') {
220  return true;
221  }
222 
223  return (bool) $ilias->getSetting('search_enabled_' . $a_key);
224  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable (   $a_key)
static

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

References _getPossibleFields().

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

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

References $DIC.

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

227  {
228  global $DIC;
229 
230  $ilias = $DIC['ilias'];
231 
232  $ilias->setSetting('search_enabled_' . $a_key, (int) $a_enabled);
233  return true;
234  }
global $DIC
Definition: saml.php:7
+ 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.

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  }
+ 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: