Class humhub\modules\user\widgets\UserPicker

Inheritancehumhub\modules\user\widgets\UserPicker » yii\base\Widget
Available since version0.5
Deprecated since version since 1.2 use UserPickerField widget for rendering a picker and \humhub\modules\user\models\UserPicker for search queries.

UserPickerWidget displays a user picker instead of an input field.

To use this widget, you may insert the following code in a view:

$this->widget('application.modules_core.user.widgets.UserPickerWidget',array(

'name'=>'users',

// additional javascript options for the date picker plugin
'options'=>array(
    'showAnim'=>'fold',
),
'htmlOptions'=>array(
    'style'=>'height:20px;'
),

));

By configuring the {@link options} property, you may specify the options that need to be passed to the userpicker plugin. Please refer to the documentation for possible options (name-value pairs).

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$attribute string The attribute associated with this widget. humhub\modules\user\widgets\UserPicker
$data \humhub\modules\user\widgets\type humhub\modules\user\widgets\UserPicker
$focus \humhub\modules\user\widgets\type Boolean humhub\modules\user\widgets\UserPicker
$inputId \humhub\modules\user\widgets\type humhub\modules\user\widgets\UserPicker
$maxUsers \humhub\modules\user\widgets\type humhub\modules\user\widgets\UserPicker
$model \humhub\modules\user\widgets\CModel The data model associated with this widget. humhub\modules\user\widgets\UserPicker
$placeholderText string For input placeholder attribute. humhub\modules\user\widgets\UserPicker
$userGuid \humhub\modules\user\widgets\type String humhub\modules\user\widgets\UserPicker
$userRole \humhub\modules\user\widgets\type humhub\modules\user\widgets\UserPicker
$userSearchUrl String Url with -keywordPlaceholder- humhub\modules\user\widgets\UserPicker

Public Methods

Hide inherited methods

MethodDescriptionDefined By
asJSON() Creates an json result with user information arrays. A user will be marked as disabled, if the permission check fails on this user. humhub\modules\user\widgets\UserPicker
filter() Creates a json user array used in the userpicker js frontend. humhub\modules\user\widgets\UserPicker
init() Inits the User Picker humhub\modules\user\widgets\UserPicker
run() Displays / Run the Widgets humhub\modules\user\widgets\UserPicker

Property Details

$attribute public property

The attribute associated with this widget. The name can contain square brackets (e.g. 'name[1]') which is used to collect tabular data input.

public string $attribute null
$data public property
public \humhub\modules\user\widgets\type $data null
$focus public property

Boolean

public \humhub\modules\user\widgets\type $focus false
$inputId public property
public \humhub\modules\user\widgets\type $inputId ""
$maxUsers public property
public \humhub\modules\user\widgets\type $maxUsers 50
$model public property

The data model associated with this widget.

public \humhub\modules\user\widgets\CModel $model null
$placeholderText public property

For input placeholder attribute.

$userGuid public property

String

public \humhub\modules\user\widgets\type $userGuid ""
$userRole public property
public \humhub\modules\user\widgets\type $userRole null
$userSearchUrl public property

Url with -keywordPlaceholder-

public String $userSearchUrl ""

Method Details

asJSON() public static method

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 \humhub\modules\user\widgets\type asJSON ( $users, $permission null, $priority null )
$users \humhub\modules\user\widgets\type
$permission \humhub\modules\user\widgets\type
$priority
filter() public static method

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

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

public static \humhub\modules\user\widgets\type filter ( $cfg null )
$cfg \humhub\modules\user\widgets\type

Filter configuration

return \humhub\modules\user\widgets\type

Json representation used by the userpicker

init() public method

Inits the User Picker

public void init ( )
run() public method

Displays / Run the Widgets

public void run ( )