ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 29 of file class.ilUserSearchOptions.php.

Member Function Documentation

◆ __appendUserDefinedFields()

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

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

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

Referenced by _getSearchableFieldsInfo().

212  : array
213  {
214  $user_defined_fields = ilUserDefinedFields::_getInstance();
215  foreach ($user_defined_fields->getSearchableDefinitions() as $definition) {
216  $fields[$counter]['values'] = ilUserSearchOptions::__prepareValues($definition['field_values']);
217  $fields[$counter]['lang'] = $definition['field_name'];
218  $fields[$counter]['db'] = $definition['field_id'];
219 
220  switch ($definition['field_type']) {
221  case UDF_TYPE_TEXT:
222  $fields[$counter]['type'] = self::FIELD_TYPE_UDF_TEXT;
223  break;
224 
225  case UDF_TYPE_SELECT:
226  $fields[$counter]['type'] = self::FIELD_TYPE_UDF_SELECT;
227  break;
228 
229  case UDF_TYPE_WYSIWYG:
230  $fields[$counter]['type'] = self::FIELD_TYPE_UDF_WYSIWYG;
231  break;
232 
233  default:
234  // do not throw: udf plugin support
235  $fields[$counter]['type'] = $definition['field_type'];
236  break;
237  }
238  ++$counter;
239  }
240  return $fields;
241  }
const UDF_TYPE_SELECT
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const UDF_TYPE_WYSIWYG
static __prepareValues(array $a_values)
+ 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 243 of file class.ilUserSearchOptions.php.

References $DIC, and $lng.

Referenced by __appendUserDefinedFields().

243  : array
244  {
245  global $DIC;
246 
247  $lng = $DIC->language();
248 
249  $new_values = array(0 => $lng->txt('please_choose'));
250  foreach ($a_values as $value) {
251  $new_values[$value] = $value;
252  }
253  return $new_values;
254  }
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ _getPossibleFields()

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

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

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

157  : array
158  {
159  return array('gender',
160  'lastname',
161  'firstname',
162  'login',
163  'title',
164  'institution',
165  'department',
166  'street',
167  'zipcode',
168  'city',
169  'country',
170  'sel_country',
171  'email',
172  'second_email',
173  'hobby',
174  'org_units',
175  // begin-patch lok
176  'matriculation',
177  'interests_general',
178  'interests_help_offered',
179  'interests_help_looking'
180  );
181  // end-patch lok
182  }
+ 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 66 of file class.ilUserSearchOptions.php.

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

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

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

References $DIC.

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

189  : bool
190  {
191  global $DIC;
192 
193  $settings = $DIC->settings();
194 
195  // login is always enabled
196  if ($a_key == 'login') {
197  return true;
198  }
199  return (bool) $settings->get('search_enabled_' . $a_key);
200  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable ( string  $a_key)
static

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

References _getPossibleFields().

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

184  : bool
185  {
186  return in_array($a_key, ilUserSearchOptions::_getPossibleFields());
187  }
static _getPossibleFields(bool $a_admin=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveStatus()

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

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

References $DIC.

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

202  : bool
203  {
204  global $DIC;
205 
206  $ilias = $DIC['ilias'];
207 
208  $ilias->setSetting('search_enabled_' . $a_key, (string) $a_enabled);
209  return true;
210  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

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

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

47  : array
48  {
49  $col_info = array();
50  foreach (self::_getSearchableFieldsInfo($a_admin) as $field) {
51  if (is_numeric($field['db'])) {
52  $field['db'] = 'udf_' . $field['db'];
53  }
54 
55  $col_info[$field['db']] = array(
56  'txt' => $field['lang']
57  );
58 
59  if ($field['db'] == 'login' or $field['db'] == 'firstname' or $field['db'] == 'lastname') {
60  $col_info[$field['db']]['default'] = true;
61  }
62  }
63  return $col_info;
64  }
+ 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 31 of file class.ilUserSearchOptions.php.

Referenced by ilRepositorySearchGUI\initFormSearch().

◆ FIELD_TYPE_UDF_WYSIWYG

const ilUserSearchOptions::FIELD_TYPE_UDF_WYSIWYG = 6

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


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