ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilUserAutoComplete Class Reference

Auto completion class for user lists. More...

+ Inheritance diagram for ilUserAutoComplete:
+ Collaboration diagram for ilUserAutoComplete:

Public Member Functions

 __construct ()
 Default constructor. More...
 
 respectMinimumSearchCharacterCount ($a_status)
 
 getRespectMinimumSearchCharacterCount ()
 
 setLimit ($a_limit)
 
 getLimit ()
 
 setSearchType ($search_type)
 
 getSearchType ()
 
 setPrivacyMode ($privacy_mode)
 
 getPrivacyMode ()
 
 setUser ($user)
 
 getUser ()
 
 enableFieldSearchableCheck ($a_status)
 Enable the check whether the field is searchable in Administration -> Settings -> Standard Fields. More...
 
 isFieldSearchableCheckEnabled ()
 Searchable check enabled. More...
 
 enableUserAccessCheck ($a_status)
 Enable user access check. More...
 
 isUserAccessCheckEnabled ()
 Check if user access check is enabled. More...
 
 setSearchFields ($a_fields)
 Set searchable fields. More...
 
 getSearchFields ()
 get possible search fields More...
 
 setResultField ($a_field)
 Set result field. More...
 
 setUserLimitations ($a_limitations)
 allow user limitations like inactive and access limitations More...
 
 getUserLimitations ()
 allow user limitations like inactive and access limitations More...
 
 isMoreLinkAvailable ()
 
 setMoreLinkAvailable ($more_link_available)
 IMPORTANT: remember to read request parameter 'fetchall' to use this function. More...
 
 parseQueryString ($a_query)
 Parse query string. More...
 

Data Fields

const MAX_ENTRIES = 1000
 
const SEARCH_TYPE_LIKE = 1
 
const SEARCH_TYPE_EQUALS = 2
 
const PRIVACY_MODE_RESPECT_USER_SETTING = 1
 
const PRIVACY_MODE_IGNORE_USER_SETTING = 2
 

Protected Member Functions

 getFields ()
 Get searchable fields. More...
 
 getSelectPart ()
 
 getOrderByPart ()
 

Private Attributes

 $logger = null
 
 $searchable_check = false
 
 $user_access_check = true
 
 $possible_fields = array()
 
 $result_field
 
 $search_type
 
 $privacy_mode
 
 $user
 
 $limit = 0
 
 $user_limitations = true
 
 $respect_min_search_character_count = true
 
 $more_link_available = false
 

Detailed Description

Auto completion class for user lists.

Definition at line 7 of file class.ilUserAutoComplete.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserAutoComplete::__construct ( )

Default constructor.

Definition at line 90 of file class.ilUserAutoComplete.php.

References $DIC, setPrivacyMode(), and setSearchType().

91  {
92  global $DIC;
93 
94  $this->result_field = 'login';
95 
96  $this->setSearchType(self::SEARCH_TYPE_LIKE);
97  $this->setPrivacyMode(self::PRIVACY_MODE_IGNORE_USER_SETTING);
98 
99  $this->logger = $DIC->logger()->user();
100  }
global $DIC
+ Here is the call graph for this function:

Member Function Documentation

◆ enableFieldSearchableCheck()

ilUserAutoComplete::enableFieldSearchableCheck (   $a_status)

Enable the check whether the field is searchable in Administration -> Settings -> Standard Fields.

Parameters
bool$a_status

Definition at line 181 of file class.ilUserAutoComplete.php.

182  {
183  $this->searchable_check = $a_status;
184  }

◆ enableUserAccessCheck()

ilUserAutoComplete::enableUserAccessCheck (   $a_status)

Enable user access check.

See also
Administration -> User Accounts -> Settings -> General Settings
Parameters
bool$a_status

Definition at line 200 of file class.ilUserAutoComplete.php.

201  {
202  $this->user_access_check = $a_status;
203  }

◆ getFields()

ilUserAutoComplete::getFields ( )
protected

Get searchable fields.

Returns
array

Definition at line 236 of file class.ilUserAutoComplete.php.

References ilUserSearchOptions\_isEnabled(), array, getSearchFields(), and isFieldSearchableCheckEnabled().

Referenced by getSelectPart().

237  {
238  if(!$this->isFieldSearchableCheckEnabled())
239  {
240  return $this->getSearchFields();
241  }
242  $available_fields = array();
243  foreach($this->getSearchFields() as $field)
244  {
245  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
247  {
248  $available_fields[] = $field;
249  }
250  }
251  return $available_fields;
252  }
isFieldSearchableCheckEnabled()
Searchable check enabled.
getSearchFields()
get possible search fields
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:

◆ getLimit()

ilUserAutoComplete::getLimit ( )

Definition at line 124 of file class.ilUserAutoComplete.php.

References $limit.

Referenced by setResultField().

125  {
126  return $this->limit;
127  }
+ Here is the caller graph for this function:

◆ getOrderByPart()

ilUserAutoComplete::getOrderByPart ( )
protected
Returns
string

Definition at line 519 of file class.ilUserAutoComplete.php.

References $ilDB, $query, array, and getSearchType().

Referenced by setResultField().

520  {
521  return 'login ASC';
522  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPrivacyMode()

ilUserAutoComplete::getPrivacyMode ( )
Returns
int

Definition at line 156 of file class.ilUserAutoComplete.php.

References $privacy_mode.

Referenced by getSelectPart(), and setResultField().

157  {
158  return $this->privacy_mode;
159  }
+ Here is the caller graph for this function:

◆ getRespectMinimumSearchCharacterCount()

ilUserAutoComplete::getRespectMinimumSearchCharacterCount ( )
Returns
bool

Definition at line 113 of file class.ilUserAutoComplete.php.

References $respect_min_search_character_count.

◆ getSearchFields()

ilUserAutoComplete::getSearchFields ( )

get possible search fields

Returns
array

Definition at line 227 of file class.ilUserAutoComplete.php.

References $possible_fields.

Referenced by getFields().

228  {
229  return $this->possible_fields;
230  }
+ Here is the caller graph for this function:

◆ getSearchType()

ilUserAutoComplete::getSearchType ( )
Returns
mixed

Definition at line 140 of file class.ilUserAutoComplete.php.

References $search_type.

Referenced by getOrderByPart().

141  {
142  return $this->search_type;
143  }
+ Here is the caller graph for this function:

◆ getSelectPart()

ilUserAutoComplete::getSelectPart ( )
protected
Returns
string

Definition at line 355 of file class.ilUserAutoComplete.php.

References $ilDB, $ilSetting, array, getFields(), ilUserAccountSettings\getInstance(), ilUserFilter\getInstance(), ilSearchSettings\getInstance(), getPrivacyMode(), getUser(), getUserLimitations(), and time.

Referenced by setResultField().

356  {
357  $fields = array(
358  'ud.usr_id',
359  'ud.login',
360  'ud.firstname',
361  'ud.lastname',
362  'ud.email'
363  );
364 
365  if(self::PRIVACY_MODE_RESPECT_USER_SETTING == $this->getPrivacyMode())
366  {
367  $fields[] = 'profpref.value profile_value';
368  $fields[] = 'pubemail.value email_value';
369  }
370 
371  return implode(', ', $fields);
372  }
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:

◆ getUser()

ilUserAutoComplete::getUser ( )
Returns
ilObjUser

Definition at line 172 of file class.ilUserAutoComplete.php.

References $user.

Referenced by getSelectPart(), and ilOnScreenChatUserUserAutoComplete\getWherePart().

173  {
174  return $this->user;
175  }
+ Here is the caller graph for this function:

◆ getUserLimitations()

ilUserAutoComplete::getUserLimitations ( )

allow user limitations like inactive and access limitations

Returns
bool

Definition at line 582 of file class.ilUserAutoComplete.php.

References $user_limitations.

Referenced by getSelectPart().

583  {
585  }
+ Here is the caller graph for this function:

◆ isFieldSearchableCheckEnabled()

ilUserAutoComplete::isFieldSearchableCheckEnabled ( )

Searchable check enabled.

Returns
bool

Definition at line 190 of file class.ilUserAutoComplete.php.

References $searchable_check.

Referenced by getFields(), and setResultField().

191  {
193  }
+ Here is the caller graph for this function:

◆ isMoreLinkAvailable()

ilUserAutoComplete::isMoreLinkAvailable ( )
Returns
boolean

Definition at line 590 of file class.ilUserAutoComplete.php.

References $more_link_available.

Referenced by setResultField().

591  {
593  }
+ Here is the caller graph for this function:

◆ isUserAccessCheckEnabled()

ilUserAutoComplete::isUserAccessCheckEnabled ( )

Check if user access check is enabled.

Returns
bool

Definition at line 209 of file class.ilUserAutoComplete.php.

References $user_access_check.

210  {
212  }

◆ parseQueryString()

ilUserAutoComplete::parseQueryString (   $a_query)

Parse query string.

Parameters
string$a_query
Returns
$query

Definition at line 610 of file class.ilUserAutoComplete.php.

References $query, array, and ilLogLevel\DEBUG.

Referenced by setResultField().

611  {
612  $query = array();
613 
614  if(!stristr($a_query, '\\'))
615  {
616  $a_query = str_replace('%', '\%', $a_query);
617  $a_query = str_replace('_', '\_', $a_query);
618  }
619 
620  $query['query'] = trim($a_query);
621 
622  // "," means fixed search for lastname, firstname
623  if(strpos($a_query, ','))
624  {
625  $comma_separated = (array) explode(',', $a_query);
626 
627  if(count($comma_separated) == 2)
628  {
629  if(trim($comma_separated[0]))
630  {
631  $query['lastname'] = trim($comma_separated[0]);
632  }
633  if(trim($comma_separated[1]))
634  {
635  $query['firstname'] = trim($comma_separated[1]);
636  }
637  }
638  }
639  else
640  {
641  $whitespace_separated = (array) explode(' ', $a_query);
642  foreach($whitespace_separated as $part)
643  {
644  if(trim($part))
645  {
646  $query['parts'][] = trim($part);
647  }
648  }
649  }
650 
651  $this->logger->dump($query, ilLogLevel::DEBUG);
652 
653  return $query;
654  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ respectMinimumSearchCharacterCount()

ilUserAutoComplete::respectMinimumSearchCharacterCount (   $a_status)
Parameters
bool$a_status

Definition at line 105 of file class.ilUserAutoComplete.php.

106  {
107  $this->respect_min_search_character_count = $a_status;
108  }

◆ setLimit()

ilUserAutoComplete::setLimit (   $a_limit)

Definition at line 119 of file class.ilUserAutoComplete.php.

120  {
121  $this->limit = $a_limit;
122  }

◆ setMoreLinkAvailable()

ilUserAutoComplete::setMoreLinkAvailable (   $more_link_available)

IMPORTANT: remember to read request parameter 'fetchall' to use this function.

Parameters
boolean$more_link_available

Definition at line 600 of file class.ilUserAutoComplete.php.

References $more_link_available.

601  {
602  $this->more_link_available = $more_link_available;
603  }

◆ setPrivacyMode()

ilUserAutoComplete::setPrivacyMode (   $privacy_mode)
Parameters
int$privacy_mode

Definition at line 148 of file class.ilUserAutoComplete.php.

References $privacy_mode.

Referenced by __construct().

149  {
150  $this->privacy_mode = $privacy_mode;
151  }
+ Here is the caller graph for this function:

◆ setResultField()

ilUserAutoComplete::setResultField (   $a_field)

Set result field.

Parameters
string$a_field

Definition at line 258 of file class.ilUserAutoComplete.php.

References $ilDB, $query, $res, $result, ilUserSearchOptions\_isEnabled(), array, ilJsonUtil\encode(), ilSearchSettings\getInstance(), getLimit(), getOrderByPart(), getPrivacyMode(), getSelectPart(), isFieldSearchableCheckEnabled(), isMoreLinkAvailable(), ilQueryParser\MIN_WORD_LENGTH, parseQueryString(), string, and ilStr\strLen().

259  {
260  $this->result_field = $a_field;
261  }
+ Here is the call graph for this function:

◆ setSearchFields()

ilUserAutoComplete::setSearchFields (   $a_fields)

Set searchable fields.

Parameters
array$a_fields

Definition at line 218 of file class.ilUserAutoComplete.php.

219  {
220  $this->possible_fields = $a_fields;
221  }

◆ setSearchType()

ilUserAutoComplete::setSearchType (   $search_type)
Parameters
int$search_type

Definition at line 132 of file class.ilUserAutoComplete.php.

References $search_type.

Referenced by __construct().

133  {
134  $this->search_type = $search_type;
135  }
+ Here is the caller graph for this function:

◆ setUser()

ilUserAutoComplete::setUser (   $user)
Parameters
ilObjUser$user

Definition at line 164 of file class.ilUserAutoComplete.php.

References $user, and user().

165  {
166  $this->user = $user;
167  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ setUserLimitations()

ilUserAutoComplete::setUserLimitations (   $a_limitations)

allow user limitations like inactive and access limitations

Parameters
bool$a_limitations

Definition at line 573 of file class.ilUserAutoComplete.php.

574  {
575  $this->user_limitations = (bool) $a_limitations;
576  }

Field Documentation

◆ $limit

ilUserAutoComplete::$limit = 0
private

Definition at line 73 of file class.ilUserAutoComplete.php.

Referenced by getLimit().

◆ $logger

ilUserAutoComplete::$logger = null
private

Definition at line 35 of file class.ilUserAutoComplete.php.

◆ $more_link_available

ilUserAutoComplete::$more_link_available = false
private

Definition at line 85 of file class.ilUserAutoComplete.php.

Referenced by isMoreLinkAvailable(), and setMoreLinkAvailable().

◆ $possible_fields

ilUserAutoComplete::$possible_fields = array()
private

Definition at line 50 of file class.ilUserAutoComplete.php.

Referenced by getSearchFields().

◆ $privacy_mode

ilUserAutoComplete::$privacy_mode
private

Definition at line 65 of file class.ilUserAutoComplete.php.

Referenced by getPrivacyMode(), and setPrivacyMode().

◆ $respect_min_search_character_count

ilUserAutoComplete::$respect_min_search_character_count = true
private

Definition at line 80 of file class.ilUserAutoComplete.php.

Referenced by getRespectMinimumSearchCharacterCount().

◆ $result_field

ilUserAutoComplete::$result_field
private

Definition at line 55 of file class.ilUserAutoComplete.php.

◆ $search_type

ilUserAutoComplete::$search_type
private

Definition at line 60 of file class.ilUserAutoComplete.php.

Referenced by getSearchType(), and setSearchType().

◆ $searchable_check

ilUserAutoComplete::$searchable_check = false
private

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

Referenced by isFieldSearchableCheckEnabled().

◆ $user

ilUserAutoComplete::$user
private

Definition at line 70 of file class.ilUserAutoComplete.php.

Referenced by getUser(), and setUser().

◆ $user_access_check

ilUserAutoComplete::$user_access_check = true
private

Definition at line 45 of file class.ilUserAutoComplete.php.

Referenced by isUserAccessCheckEnabled().

◆ $user_limitations

ilUserAutoComplete::$user_limitations = true
private

Definition at line 75 of file class.ilUserAutoComplete.php.

Referenced by getUserLimitations().

◆ MAX_ENTRIES

◆ PRIVACY_MODE_IGNORE_USER_SETTING

const ilUserAutoComplete::PRIVACY_MODE_IGNORE_USER_SETTING = 2

Definition at line 30 of file class.ilUserAutoComplete.php.

◆ PRIVACY_MODE_RESPECT_USER_SETTING

const ilUserAutoComplete::PRIVACY_MODE_RESPECT_USER_SETTING = 1

◆ SEARCH_TYPE_EQUALS

const ilUserAutoComplete::SEARCH_TYPE_EQUALS = 2

◆ SEARCH_TYPE_LIKE

const ilUserAutoComplete::SEARCH_TYPE_LIKE = 1

Definition at line 15 of file class.ilUserAutoComplete.php.


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