Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
An admin setting for selecting one or more users who have a capability in the system context. More...
Public Member Functions | |
__construct ($name, $visiblename, $description, $defaultsetting, $capability, $includeadmins=true) | |
Constructor. More... | |
add_dependent_on ($dependenton) | |
Add a setting to the list of those that could cause this one to be hidden. More... | |
config_read ($name) | |
Returns the config if possible. More... | |
config_write ($name, $value) | |
Used to set a config pair and log change. More... | |
get_defaultsetting () | |
Returns the default setting for class. More... | |
get_dependent_on () | |
Get a list of the settings that could cause this one to be hidden. More... | |
get_force_ltr () | |
Get whether this should be displayed in LTR mode. More... | |
get_full_name () | |
Returns the fullname prefixed by the plugin. More... | |
get_id () | |
Returns the ID string based on plugin and name. More... | |
get_setting () | |
Returns the current setting. More... | |
get_setting_flag_defaults (& $defaults) | |
Get the list of defaults for the flags on this setting. More... | |
get_setting_flag_value (admin_setting_flag $flag) | |
Get the currently saved value for a setting flag. More... | |
has_custom_form_control () | |
Whether this setting uses a custom form control. More... | |
is_readonly () | |
Is this option forced in config.php? More... | |
is_related ($query) | |
Is setting related to query text - used when searching. More... | |
load_choices () | |
Load all of the uses who have the capability into choice array. More... | |
output_html ($data, $query='') | |
Returns XHTML multi-select field. More... | |
output_select_html ($data, $current, $default, $extraname='') | |
Returns XHTML select field. More... | |
output_setting_flags () | |
Output the input fields for the advanced and locked flags on this setting. More... | |
post_write_settings ($original) | |
Execute postupdatecallback if necessary. More... | |
set_advanced_flag_options ($enabled, $default) | |
Set the advanced options flag on this admin setting. More... | |
set_affects_modinfo ($affectsmodinfo) | |
set_enabled_flag_options ($enabled, $default) | |
Set the enabled options flag on this admin setting. More... | |
set_force_ltr ($value) | |
Set whether to force LTR or not. More... | |
set_locked_flag_options ($enabled, $default) | |
Set the locked options flag on this admin setting. More... | |
set_required_flag_options ($enabled, $default) | |
Set the required options flag on this admin setting. More... | |
set_updatedcallback ($functionname) | |
Function called if setting updated - cleanup, cache reset, etc. More... | |
write_setting ($data) | |
Save the chosen setting provided as $data. More... | |
write_setting_flags ($data) | |
Write the values of the flags for this admin setting. More... | |
Public Attributes | |
bool | $affectsmodinfo = false |
if set, indicates that a change to this setting requires rebuild course cache | |
array | $choices |
Array of choices value=>label. | |
mixed | $defaultsetting |
Can be string or array of string. | |
string | $description |
localised long description in Markdown format | |
string | $name |
unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins. | |
bool | $nosave = false |
true indicates this setting does not actually save anything, just information | |
array | $optgroups |
Array of choices grouped using optgroups. | |
mixed | $plugin |
can be String or Null. More... | |
string | $updatedcallback |
string | $visiblename |
localised name | |
Protected Member Functions | |
add_to_config_log ($name, $oldvalue, $value) | |
Log config changes if necessary. More... | |
set_flag_options ($enabled, $default, $shortname, $displayname) | |
Generic function to add a flag to this admin setting. More... | |
Protected Attributes | |
string | $capability |
The capabilities name. | |
bool | $customcontrol = false |
Whether this setting uses a custom form control. | |
int | $includeadmins |
include admin users too | |
An admin setting for selecting one or more users who have a capability in the system context.
An admin setting for selecting one or more users, who have a particular capability in the system context. Warning, make sure the list will never be too long. There is no paging or searching of this list.
To correctly get a list of users from this config setting, you need to call the get_users_from_config($CFG->mysetting, $capability); function in moodlelib.php.
admin_setting_users_with_capability::__construct | ( | $name, | |
$visiblename, | |||
$description, | |||
$defaultsetting, | |||
$capability, | |||
$includeadmins = true |
|||
) |
Constructor.
string | $name | unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins. |
string | $visiblename | localised name |
string | $description | localised long description |
array | $defaultsetting | array of usernames |
string | $capability | string capability name. |
bool | $includeadmins | include administrators |
|
inherited |
Add a setting to the list of those that could cause this one to be hidden.
string | $dependenton |
|
protectedinherited |
Log config changes if necessary.
string | $name | |
string | $oldvalue | |
string | $value |
Reimplemented in admin_setting_configpasswordunmask.
|
inherited |
Returns the config if possible.
mixed | returns config if successful else null |
Reimplemented in enrol_flatfile_role_setting.
|
inherited |
Used to set a config pair and log change.
string | $name | |
mixed | $value | Gets converted to string if not null |
bool | Write setting to config table |
Reimplemented in enrol_flatfile_role_setting.
admin_setting_users_with_capability::get_defaultsetting | ( | ) |
Returns the default setting for class.
mixed | Array, or string. Empty string if no default |
Reimplemented from admin_setting.
|
inherited |
Get a list of the settings that could cause this one to be hidden.
array |
|
inherited |
Get whether this should be displayed in LTR mode.
bool|null |
Reimplemented in admin_setting_configtext, and admin_setting_filetypes.
|
inherited |
Returns the fullname prefixed by the plugin.
string |
Reimplemented in admin_setting_managerepository.
|
inherited |
Returns the ID string based on plugin and name.
string |
admin_setting_users_with_capability::get_setting | ( | ) |
Returns the current setting.
mixed | array or string |
Reimplemented from admin_setting_configmultiselect.
|
inherited |
Get the list of defaults for the flags on this setting.
array | of strings describing the defaults for this setting. This is appended to by this function. |
|
inherited |
Get the currently saved value for a setting flag.
admin_setting_flag | $flag | - One of the admin_setting_flag for this admin_setting. |
bool |
|
inherited |
Whether this setting uses a custom form control.
This function is especially useful to decide if we should render a label element for this setting or not.
bool |
|
inherited |
Is this option forced in config.php?
bool |
|
inherited |
Is setting related to query text - used when searching.
string | $query |
bool | true if related, false if not |
Reimplemented from admin_setting_configselect.
admin_setting_users_with_capability::load_choices | ( | ) |
Load all of the uses who have the capability into choice array.
bool | Always returns true |
Reimplemented from admin_setting_configselect.
|
inherited |
Returns XHTML multi-select field.
array | $data | Array of values to select by default |
string | $query |
string | XHTML multi-select field |
Reimplemented from admin_setting_configselect.
|
inherited |
Returns XHTML select field.
Ensure the options are loaded, and generate the XHTML for the select element and any warning message. Separating this out from output_html makes it easier to subclass this class.
string | $data | the option to show as selected. |
string | $current | the currently selected option in the database, null if none. |
string | $default | the default selected option. |
array | the HTML for the select element, and a warning message. |
|
inherited |
Output the input fields for the advanced and locked flags on this setting.
bool | $adv | - The current value of the advanced flag. |
bool | $locked | - The current value of the locked flag. |
string::$output | - The html for the flags. |
|
inherited |
Execute postupdatecallback if necessary.
mixed | $original | original value before write_setting() |
bool | true if changed, false if not. |
Reimplemented in admin_setting_configstoredfile.
|
inherited |
Set the advanced options flag on this admin setting.
bool | $enabled | - One of self::OPTION_ENABLED or self::OPTION_DISABLED |
bool | $default | - The default for the flag |
|
inherited |
bool | $affectsmodinfo | If true, changes to this setting will cause the course cache to be rebuilt |
|
inherited |
Set the enabled options flag on this admin setting.
bool | $enabled | - One of self::OPTION_ENABLED or self::OPTION_DISABLED |
bool | $default | - The default for the flag |
|
protectedinherited |
Generic function to add a flag to this admin setting.
bool | $enabled | - One of self::OPTION_ENABLED or self::OPTION_DISABLED |
bool | $default | - The default for the flag |
string | $shortname | - The shortname for this flag. Used as a suffix for the setting name. |
string | $displayname | - The display name for this flag. Used as a label next to the checkbox. |
|
inherited |
Set whether to force LTR or not.
bool | $value | True when forced, false when not force, null when unknown. |
|
inherited |
Set the locked options flag on this admin setting.
bool | $enabled | - One of self::OPTION_ENABLED or self::OPTION_DISABLED |
bool | $default | - The default for the flag |
|
inherited |
Set the required options flag on this admin setting.
bool | $enabled | - One of self::OPTION_ENABLED or self::OPTION_DISABLED. |
bool | $default | - The default for the flag. |
|
inherited |
Function called if setting updated - cleanup, cache reset, etc.
string | $functionname | Sets the function name |
void |
admin_setting_users_with_capability::write_setting | ( | $data | ) |
Save the chosen setting provided as $data.
array | $data |
mixed | string or array |
Reimplemented from admin_setting_configmultiselect.
|
inherited |
Write the values of the flags for this admin setting.
array | $data | - The data submitted from the form or null to set the default value for new installs. |
bool | - true if successful. |
|
inherited |
can be String or Null.
Null means main config table