HumHub Documentation (unofficial)

UserPicker
in package

This class can be used to filter results for a user picker search query by calling the static filter method.

Tags
since
1.2
author

buddha

Table of Contents

Methods

asJSON()  : type
Creates an json result with user information arrays. A user will be marked as disabled, if the permission check fails on this user.
filter()  : type
Creates a json user array used in the userpicker js frontend.
createJSONUserInfo()  : type
Creates a single user-information array for the given $user. A user will be marked as disabled, if the given $permission check fails on this user. If the second argument is of type boolean, the it will define the disabled field of the result directly.
getUserIdArray()  : array<string|int, mixed>
Assambles all user Ids of the given $users into an array

Methods

asJSON()

Creates an json result with user information arrays. A user will be marked as disabled, if the permission check fails on this user.

public static asJSON(type $users[, type $permission = null ][, mixed $priority = null ][, mixed $disabledText = null ]) : type
Parameters
$users : type
$permission : type = null
$priority : mixed = null
$disabledText : mixed = null
Return values
type

filter()

Creates a json user array used in the userpicker js frontend.

public static filter([type $cfg = null ]) : type

The $cfg is used to specify the filter values the following values are available:

query - (ActiveQuery) The initial query which is used to append additional filters. - default = User Friends if friendship module is enabled else User::find()

active - (boolean) Specifies if only active user should be included in the result - default = true

maxResults - (int) The max number of entries returned in the array - default = 10

keyword - (string) A keyword which filters user by username, firstname, lastname, email and title

permission - (BasePermission) An additional permission filter

fillQuery - (ActiveQuery) Can be used to fill the result array if the initial query does not return the maxResults, these results will have a lower priority

fillUser - (boolean) When set to true and no fillQuery is given the result is filled with User::find() results

disableFillUser - Specifies if the results of the fillQuery should be disabled in the userpicker results - default = true

Parameters
$cfg : type = null

filter configuration

Tags
throws
Throwable
Return values
type

json representation used by the userpicker

createJSONUserInfo()

Creates a single user-information array for the given $user. A user will be marked as disabled, if the given $permission check fails on this user. If the second argument is of type boolean, the it will define the disabled field of the result directly.

private static createJSONUserInfo(type $user[, mixed $permission = null ][, mixed $priority = null ][, mixed $disabledText = null ]) : type
Parameters
$user : type
$permission : mixed = null
$priority : mixed = null
$disabledText : mixed = null
Return values
type

getUserIdArray()

Assambles all user Ids of the given $users into an array

private static getUserIdArray(array<string|int, mixed> $users) : array<string|int, mixed>
Parameters
$users : array<string|int, mixed>

array of user models

Return values
array<string|int, mixed>

user id array


        
On this page

Search results