class UserSelector (View source)

Properties

protected Application $app

The application container instance.

Methods

__construct(Application $app)

Initialize the instance.

string
selectUser(string $fieldName, int|false $uID = false)

Build the HTML to be placed in a page to choose a user using a popup dialog.

string
quickSelect(string $fieldName, int|false $uID = false, string $labelFormat = UserSelectInstanceFactory::LABEL_FORMAT_AUTO, bool $includeAvatar = true)

Build the HTML to be placed in a page to choose a user using a select with users pupulated dynamically with ajax requests.

string
selectMultipleUsers(string $fieldName, User[]|UserInfo[]|int[]|Traversable $users = [])

Build the HTML to be placed in a page to choose multiple users using a popup dialog.

Details

__construct(Application $app)

Initialize the instance.

Parameters

Application $app

string selectUser(string $fieldName, int|false $uID = false)

Build the HTML to be placed in a page to choose a user using a popup dialog.

Parameters

string $fieldName

the name of the field

int|false $uID

the ID of the user to be initially selected

Return Value

string

Examples

<code>
    $userSelector->selectUser('userID', USER_SUPER_ID); // prints out the admin user and makes it changeable.
</code>.

string quickSelect(string $fieldName, int|false $uID = false, string $labelFormat = UserSelectInstanceFactory::LABEL_FORMAT_AUTO, bool $includeAvatar = true)

Build the HTML to be placed in a page to choose a user using a select with users pupulated dynamically with ajax requests.

Parameters

string $fieldName

the name of the field

int|false $uID

the ID of the user to be initially selected

string $labelFormat

The format of the results. Valid options are 'auto', 'username', 'email', 'username_email' 'auto': Use username and email if username is supported in the site. Otherwise use email. 'username': Use username only 'email': Use email only 'username_email': Username and email.

bool $includeAvatar

Whether to include user avatar in results.

Return Value

string

Examples

<code>
    $userSelector->quickSelect('userID', USER_SUPER_ID); // prints out the admin user and makes it changeable.
</code>.

string selectMultipleUsers(string $fieldName, User[]|UserInfo[]|int[]|Traversable $users = [])

Build the HTML to be placed in a page to choose multiple users using a popup dialog.

Parameters

string $fieldName

the name of the field

User[]|UserInfo[]|int[]|Traversable $users

The users to be initially selected

Return Value

string