User selector subclass for the list of users who are not in a certain group.
More...
|
| clear_exclusions () |
| Clear the list of excluded user ids.
|
|
| display ($return=false) |
| Output this user_selector as HTML.
|
|
| exclude ($arrayofuserids) |
| All to the list of user ids that this control will not select.
|
|
| find_users ($search) |
| Finds users to display in this control.
|
|
| get_exclusions () |
| Returns the list of user ids that this control will not select.
|
|
| get_js_module () |
| Returns the user selector JavaScript module.
|
|
| get_name () |
| Returns the id/name of this control.
|
|
| get_rows () |
| Returns the number of rows to display in this control.
|
|
| get_selected_user () |
| Convenience method for when multiselect is false (throws an exception if not).
|
|
| get_selected_users () |
| The users that were selected.
|
|
| get_user_summaries ($courseid) |
| Construct HTML lists of group-memberships of the current set of users.
|
|
| invalidate_selected_users () |
| Invalidates the list of selected users.
|
|
| is_multiselect () |
| Returns true is multiselect should be allowed.
|
|
| output_user ($user) |
| Output user.
|
|
moodle_page | print_user_summaries ($courseid) |
| Creates a global JS variable (userSummaries) that is used by the group selector to print related information when the user clicks on a user in the groups UI.
|
|
| set_extra_fields ($fields) |
| Set the user fields that are displayed in the selector in addition to the user's name.
|
|
| set_multiselect ($multiselect) |
| Whether this control will allow selection of many, or just one user.
|
|
| set_rows ($numrows) |
| The height this control will be displayed, in rows.
|
|
|
int | $maxusersperpage = 100 |
| this is used to define maximum number of users visible in list
|
|
boolean | $viewfullnames = false |
| Whether to override fullname()
|
|
|
object | $accesscontext |
| Context used for capability checks regarding this selector (does not necessarily restrict user list)
|
|
boolean | $autoselectunique = false |
| If only one user matches the search, should we select them automatically.
|
|
int | $courseid |
|
array | $exclude = array() |
| A list of userids that should not be returned by this control.
|
|
array | $extrafields |
| Extra fields to search on and return in addition to firstname and lastname.
|
|
int | $groupid |
|
boolean | $includecustomfields = false |
| Whether to include custom user profile fields.
|
|
boolean | $multiselect = true |
| Whether the conrol should allow selection of many users, or just one.
|
|
string | $name |
| The control name (and id) in the HTML.
|
|
boolean | $preserveselected = false |
| When the search changes, do we keep previously selected options that do not match the new search term?
|
|
int | $rows = USER_SELECTOR_DEFAULT_ROWS |
| The height this control should have, in rows.
|
|
int | $searchtype = USER_SEARCH_STARTS_WITH |
| When searching, do we only match the starts of fields (better performance) or do we match occurrences anywhere or do we match exact the fields.
|
|
array null | $selected = null |
| A list of the users who are selected.
|
|
string | $userfieldsjoin = '' |
| User fields join for custom fields.
|
|
array | $userfieldsmappings = [] |
| User fields mappings for custom fields.
|
|
array | $userfieldsparams = [] |
| User fields params for custom fields.
|
|
string | $userfieldsselects = '' |
| User fields selects for custom fields.
|
|
mixed | $validatinguserids = null |
| This is used by get selected users.
|
|
|
static array | $jsmodule |
| JavaScript YUI3 Module definition.
|
|
User selector subclass for the list of users who are not in a certain group.
Used on the add group members page.
- Copyright
- 1999 onwards Martin Dougiamas http://dougiamas.com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ convert_array_format()
groups_user_selector_base::convert_array_format |
( |
| $roles, |
|
|
| $search ) |
|
protectedinherited |
Creates an organised array from given data.
- Parameters
-
array | $roles | array in the format returned by groups_calculate_role_people. |
string | $search | |
- Return values
-
array | array in the format find_users is supposed to return. |
◆ display()
user_selector_base::display |
( |
| $return = false | ) |
|
|
inherited |
Output this user_selector as HTML.
- Parameters
-
boolean | $return | if true, return the HTML as a string instead of outputting it. |
- Return values
-
mixed | if $return is true, returns the HTML as a string, otherwise returns nothing. |
◆ exclude()
user_selector_base::exclude |
( |
| $arrayofuserids | ) |
|
|
inherited |
All to the list of user ids that this control will not select.
For example, on the role assign page, we do not list the users who already have the role in question.
- Parameters
-
array | $arrayofuserids | the user ids to exclude. |
◆ find_users()
group_non_members_selector::find_users |
( |
| $search | ) |
|
Finds users to display in this control.
- Parameters
-
- Return values
-
Reimplemented from user_selector_base.
◆ get_exclusions()
user_selector_base::get_exclusions |
( |
| ) |
|
|
inherited |
Returns the list of user ids that this control will not select.
- Return values
-
array | the list of user ids that this control will not select. |
◆ get_js_module()
group_non_members_selector::get_js_module |
( |
| ) |
|
Returns the user selector JavaScript module.
- Return values
-
◆ get_name()
user_selector_base::get_name |
( |
| ) |
|
|
inherited |
Returns the id/name of this control.
- Return values
-
string | the id/name that this control will have in the HTML. |
◆ get_options()
groups_user_selector_base::get_options |
( |
| ) |
|
|
protectedinherited |
◆ get_rows()
user_selector_base::get_rows |
( |
| ) |
|
|
inherited |
Returns the number of rows to display in this control.
- Return values
-
integer | the height this control will be displayed, in rows. |
◆ get_selected_user()
user_selector_base::get_selected_user |
( |
| ) |
|
|
inherited |
Convenience method for when multiselect is false (throws an exception if not).
- Exceptions
-
- Return values
-
object | the selected user object, or null if none. |
◆ get_selected_users()
user_selector_base::get_selected_users |
( |
| ) |
|
|
inherited |
The users that were selected.
This is a more sophisticated version of optional_param($this->name, array(), PARAM_INT) that validates the returned list of ids against the rules for this user selector.
- Return values
-
◆ get_user_summaries()
group_non_members_selector::get_user_summaries |
( |
| $courseid | ) |
|
Construct HTML lists of group-memberships of the current set of users.
Used in user/selector/search.php to repopulate the userSummaries JS global that is created in self\print_user_summaries() above.
- Parameters
-
- Return values
-
string[] | Array of HTML lists of groups. |
◆ initialise_javascript()
user_selector_base::initialise_javascript |
( |
| $search | ) |
|
|
protectedinherited |
Initialises JS for this control.
- Parameters
-
- Return values
-
string | any HTML needed here. |
◆ invalidate_selected_users()
user_selector_base::invalidate_selected_users |
( |
| ) |
|
|
inherited |
Invalidates the list of selected users.
If you update the database in such a way that it is likely to change the list of users that this component is allowed to select from, then you must call this method. For example, on the role assign page, after you have assigned some roles to some users, you should call this.
◆ is_multiselect()
user_selector_base::is_multiselect |
( |
| ) |
|
|
inherited |
Returns true is multiselect should be allowed.
- Return values
-
boolean | whether this control will allow selection of more than one user. |
◆ is_validating()
user_selector_base::is_validating |
( |
| ) |
|
|
protectedinherited |
Returns true if this control is validating a list of users.
- Return values
-
boolean | if true, we are validating a list of selected users, rather than preparing a list of uesrs to choose from. |
◆ load_selected_users()
user_selector_base::load_selected_users |
( |
| ) |
|
|
protectedinherited |
Get the list of users that were selected by doing optional_param then validating the result.
- Return values
-
◆ output_optgroup()
user_selector_base::output_optgroup |
( |
| $groupname, |
|
|
| $users, |
|
|
| $select ) |
|
protectedinherited |
Output one particular optgroup.
Used by the preceding function output_options.
- Parameters
-
string | $groupname | the label for this optgroup. |
array | $users | the users to put in this optgroup. |
boolean | $select | if true, select the users in this group. |
- Return values
-
◆ output_options()
user_selector_base::output_options |
( |
| $groupedusers, |
|
|
| $search ) |
|
protectedinherited |
Output the list of <optgroup>s and <options>s that go inside the select.
This method should do the same as the JavaScript method user_selector.prototype.handle_response.
- Parameters
-
array | $groupedusers | an array, as returned by find_users. |
string | $search | |
- Return values
-
◆ output_user()
group_non_members_selector::output_user |
( |
| $user | ) |
|
◆ print_user_summaries()
moodle_page group_non_members_selector::print_user_summaries |
( |
| $courseid | ) |
|
Creates a global JS variable (userSummaries) that is used by the group selector to print related information when the user clicks on a user in the groups UI.
Used by /group/clientlib.js
$PAGE
- Parameters
-
◆ required_fields_sql()
user_selector_base::required_fields_sql |
( |
string | $u | ) |
|
|
protectedinherited |
Returns SQL to select required fields.
- Parameters
-
string | $u | the table alias for the user table in the query being built. May be ''. |
- Return values
-
string | fragment of SQL to go in the select list of the query. |
- Exceptions
-
◆ search_button_caption()
user_selector_base::search_button_caption |
( |
| ) |
|
|
protectedinherited |
Returns the string to use for the search button caption.
- Return values
-
string | the caption for the search button. |
◆ search_sql()
user_selector_base::search_sql |
( |
string | $search, |
|
|
string | $u ) |
|
protectedinherited |
Returns an array with SQL to perform a search and the params that go into it.
- Parameters
-
string | $search | the text to search for. |
string | $u | the table alias for the user table in the query being built. May be ''. |
- Return values
-
array | an array with two elements, a fragment of SQL to go in the where clause the query, and an array containing any required parameters. this uses ? style placeholders. |
◆ set_extra_fields()
user_selector_base::set_extra_fields |
( |
| $fields | ) |
|
|
inherited |
Set the user fields that are displayed in the selector in addition to the user's name.
- Parameters
-
array | $fields | a list of field names that exist in the user table. |
◆ set_multiselect()
user_selector_base::set_multiselect |
( |
| $multiselect | ) |
|
|
inherited |
Whether this control will allow selection of many, or just one user.
- Parameters
-
boolean | $multiselect | true = allow multiple selection. |
◆ set_rows()
user_selector_base::set_rows |
( |
| $numrows | ) |
|
|
inherited |
The height this control will be displayed, in rows.
- Parameters
-
integer | $numrows | the desired height. |
◆ too_many_results()
user_selector_base::too_many_results |
( |
| $search, |
|
|
| $count ) |
|
protectedinherited |
Used to generate a nice message when there are too many users to show.
The message includes the number of users that currently match, and the text of the message depends on whether the search term is non-blank.
- Parameters
-
string | $search | the search term, as passed in to the find users method. |
int | $count | the number of users that currently match. |
- Return values
-
array | in the right format to return from the find_users method. |
◆ $jsmodule
array user_selector_base::$jsmodule |
|
staticprotectedinherited |
Initial value:= array(
'name' => 'user_selector',
'fullpath' => '/user/selector/module.js',
'requires' => array('node', 'event-custom', 'datasource', 'json', 'moodle-core-notification'),
'strings' => array(
array('previouslyselectedusers', 'moodle', '%%SEARCHTERM%%'),
array('nomatchingusers', 'moodle', '%%SEARCHTERM%%'),
array('none', 'moodle')
))
JavaScript YUI3 Module definition.
The documentation for this class was generated from the following file: