ILIAS  release_4-4 Revision
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 38 of file class.ilUserSearchOptions.php.

Member Function Documentation

◆ __appendUserDefinedFields()

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

Definition at line 195 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().

196  {
197  include_once './Services/User/classes/class.ilUserDefinedFields.php';
198 
199  $user_defined_fields = ilUserDefinedFields::_getInstance();
200 
201  foreach($user_defined_fields->getSearchableDefinitions() as $definition)
202  {
203  $fields[$counter]['values'] = ilUserSearchOptions::__prepareValues($definition['field_values']);
204  $fields[$counter]['lang'] = $definition['field_name'];
205  $fields[$counter]['db'] = $definition['field_id'];
206 
207  switch($definition['field_type'])
208  {
209  case UDF_TYPE_TEXT:
210  $fields[$counter]['type'] = FIELD_TYPE_UDF_TEXT;
211  break;
212 
213  case UDF_TYPE_SELECT:
214  $fields[$counter]['type'] = FIELD_TYPE_UDF_SELECT;
215  break;
216  }
217  ++$counter;
218  }
219  return $fields ? $fields : array();
220  }
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 222 of file class.ilUserSearchOptions.php.

References $lng.

Referenced by __appendUserDefinedFields().

223  {
224  global $lng;
225 
226  $new_values = array(0 => $lng->txt('please_choose'));
227  foreach($a_values as $value)
228  {
229  $new_values[$value] = $value;
230  }
231  return $new_values ? $new_values : array();
232  }
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 150 of file class.ilUserSearchOptions.php.

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

151  {
152  return array('gender',
153  'login',
154  'lastname',
155  'firstname',
156  'title',
157  'institution',
158  'department',
159  'street',
160  'zipcode',
161  'city',
162  'country',
163  'sel_country',
164  'email',
165  'hobby',
166  'matriculation');
167  }
+ 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 73 of file class.ilUserSearchOptions.php.

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

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

74  {
75  global $lng;
76 
77 
78  $counter = 1;
79  foreach(ilUserSearchOptions::_getPossibleFields($a_admin) as $field)
80  {
81  // TODO: check enabled
82  // DONE
83  if($a_admin == false and !ilUserSearchOptions::_isEnabled($field))
84  {
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  {
98  case 'login':
99  case 'firstname':
100  case 'lastname':
101  case '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(0 => $lng->txt('please_choose'),
114  'f' => $lng->txt('gender_f'),
115  'm' => $lng->txt('gender_m'));
116  break;
117 
118  case 'sel_country':
119  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
120  $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'));
121 
122  // #7843 -- see ilCountrySelectInputGUI
123  $lng->loadLanguageModule('meta');
124  include_once('./Services/Utilities/classes/class.ilCountry.php');
125  foreach (ilCountry::getCountryCodes() as $c)
126  {
127  $fields[$counter]['values'][$c] = $lng->txt('meta_c_'.$c);
128  }
129  asort($fields[$counter]['values']);
130  break;
131 
132  /*
133  case 'active':
134  $fields[$counter]['type'] = FIELD_TYPE_SELECT;
135  $fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
136  '1' => $lng->txt('active'),
137  '0' => $lng->txt('inactive'));
138 
139  break;
140  */
141  }
142 
143  ++$counter;
144  }
145  $fields = ilUserSearchOptions::__appendUserDefinedFields($fields,$counter);
146 
147  return $fields ? $fields : array();
148  }
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 174 of file class.ilUserSearchOptions.php.

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

175  {
176  global $ilias;
177 
178  // login is always enabled
179  if($a_key == 'login')
180  {
181  return true;
182  }
183 
184  return (bool) $ilias->getSetting('search_enabled_'.$a_key);
185  }
+ Here is the caller graph for this function:

◆ _isSearchable()

static ilUserSearchOptions::_isSearchable (   $a_key)
static

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

References _getPossibleFields().

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

170  {
171  return in_array($a_key,ilUserSearchOptions::_getPossibleFields());
172  }
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 187 of file class.ilUserSearchOptions.php.

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

188  {
189  global $ilias;
190 
191  $ilias->setSetting('search_enabled_'.$a_key,(int) $a_enabled);
192  return true;
193  }
+ 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 51 of file class.ilUserSearchOptions.php.

Referenced by ilRepositoryUserResultTableGUI\getSelectableColumns().

52  {
53  $col_info = array();
54  foreach(self::_getSearchableFieldsInfo($a_admin) as $field)
55  {
56  if(is_numeric($field['db']))
57  {
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  {
67  $col_info[$field['db']]['default'] = true;
68  }
69  }
70  return $col_info;
71  }
+ Here is the caller graph for this function:

◆ ilUserSearchOptions()

ilUserSearchOptions::ilUserSearchOptions ( )

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

43  {
44  }

Field Documentation

◆ $db

ilUserSearchOptions::$db = null

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


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