Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
As well as tracking the permissions information about the role we are creating or editing, we also track the other information about the role. More...
Public Member Functions | |
__construct ($context, $roleid) | |
add_classes ($classnames) | |
Use this to add class="" attributes to the table. | |
display () | |
Display the table. | |
force_archetype ($archetype, array $options) | |
Change the role definition to match given archetype. | |
force_duplicate ($roleid, array $options) | |
Call this after the table has been initialised, this resets everything to that role. | |
force_preset ($xml, array $options) | |
Change the role definition to match given preset. | |
get_archetype () | |
get_risk_icon ($type) | |
Print a risk icon, as a link to the Risks page on Moodle Docs. | |
get_role_id () | |
get_role_name () | |
is_submission_valid () | |
read_submitted_permissions () | |
Update $this->permissions based on submitted data, while making a list of changed capabilities in $this->changed. | |
save_changes () | |
Save the new values of any permissions that have been changed. | |
Public Attributes | |
const | NUM_CAPS_FOR_SEARCH = 12 |
Default number of capabilities in the table for the search UI to be shown. | |
Protected Member Functions | |
add_header_cells () | |
For subclasses to override, output header cells, after the initial capability one. | |
add_permission_cells ($capability) | |
add_row_cells ($capability) | |
For subclasses to override. | |
get_allow_role_control ($type) | |
Returns an array of roles with the allowed type. | |
get_allow_roles_list ($type, $roleid=null) | |
Returns an array of roles of the allowed type. | |
get_archetype_field ($id) | |
get_assignable_levels_control () | |
get_description_field ($id) | |
get_name_field ($id) | |
get_role_risks_info () | |
Returns information about the risks associated with a role. | |
get_row_attributes ($capability) | |
For subclasses to override. | |
get_row_classes ($capability) | |
For subclasses to override. | |
get_shortname_field ($id) | |
load_current_permissions () | |
load_parent_permissions () | |
num_extra_columns () | |
For subclasses to override, return the number of cells that add_header_cells/add_row_cells output. | |
print_field ($name, $caption, $field, $helpicon=null) | |
Print labels, fields and help icon on role administration page. | |
print_heading_row ($capability) | |
Used to output a heading rows when the context level or component changes. | |
print_show_hide_advanced_button () | |
save_allow ($type) | |
skip_row ($capability) | |
For subclasses to override. | |
Protected Attributes | |
$allcontextlevels | |
$allowassign | |
$allowoverride | |
$allowswitch | |
$allowview | |
$allpermissions | |
$allrisks | |
$capabilities = array() | |
The capabilities to display. | |
$changed | |
$classes = array('rolecap table-hover') | |
Added to the class="" attribute on output. | |
$context | |
The context this table relates to. | |
$contextlevels | |
$disabled = '' | |
$displaypermissions | |
array | $errors |
Used to store errors found when validating the data. | |
$id | |
Added as an id="" attribute to the table on output. | |
array | $parentpermissions |
The capabilities to highlight as default/inherited. | |
$permissions | |
$risksurl | |
stdClass | $role |
Used to store other information (besides permissions) about the role we are creating/editing. | |
$roleid | |
$strperms | |
As well as tracking the permissions information about the role we are creating or editing, we also track the other information about the role.
(This class is starting to be more and more like a formslib form in some respects.)
|
inherited |
Use this to add class="" attributes to the table.
You get the rolecap by default.
array | $classnames | of class names. |
|
protectedinherited |
For subclasses to override, output header cells, after the initial capability one.
Reimplemented from core_role_capability_table_base.
|
protected |
Reimplemented from core_role_capability_table_with_risks.
|
protectedinherited |
For subclasses to override.
Output the data cells for this capability. The capability name cell will already have been output.
You can rely on get_row_classes always being called before add_row_cells.
stdClass | $capability | the capability this row relates to. |
string | html of row cells |
Reimplemented from core_role_capability_table_base.
core_role_define_role_table_advanced::display | ( | ) |
Display the table.
Reimplemented from core_role_capability_table_with_risks.
core_role_define_role_table_advanced::force_archetype | ( | $archetype, | |
array | $options ) |
Change the role definition to match given archetype.
string | $archetype | |
array | $options | array with following keys: 'name', 'shortname', 'description', 'permissions', 'archetype', 'contextlevels', 'allowassign', 'allowoverride', 'allowswitch', 'allowview' |
core_role_define_role_table_advanced::force_duplicate | ( | $roleid, | |
array | $options ) |
Call this after the table has been initialised, this resets everything to that role.
int | $roleid | role id or 0 for no role |
array | $options | array with following keys: 'name', 'shortname', 'description', 'permissions', 'archetype', 'contextlevels', 'allowassign', 'allowoverride', 'allowswitch', 'allowview' |
core_role_define_role_table_advanced::force_preset | ( | $xml, | |
array | $options ) |
Change the role definition to match given preset.
string | $xml | |
array | $options | array with following keys: 'name', 'shortname', 'description', 'permissions', 'archetype', 'contextlevels', 'allowassign', 'allowoverride', 'allowswitch', 'allowview' |
|
protected |
Returns an array of roles with the allowed type.
string | $type | Must be one of: assign, switch, override or view. |
array | Am array of role names with the allowed type |
Reimplemented in core_role_view_role_definition_table.
|
protected |
Returns an array of roles of the allowed type.
string | $type | Must be one of: assign, switch, or override. |
int | $roleid | (null means current role) |
array |
|
inherited |
Print a risk icon, as a link to the Risks page on Moodle Docs.
string | $type | the type of risk, will be one of the keys from the get_all_risks array. Must start with 'risk'. |
|
protected |
Returns information about the risks associated with a role.
string |
Reimplemented in core_role_view_role_definition_table.
|
protectedinherited |
For subclasses to override.
Additional attributes to be added to each table row for the capability
stdClass | $capability | the capability this row relates to. |
array | attribute names and their values. |
Reimplemented in core_role_override_permissions_table_advanced, and core_role_permissions_table.
|
protectedinherited |
For subclasses to override.
A change to reaturn class names that are added to the class="" attribute on the <tr> for this capability.
stdClass | $capability | the capability this row relates to. |
array | of class name strings. |
Reimplemented from core_role_capability_table_base.
|
protected |
Reimplemented from core_role_capability_table_with_risks.
|
protected |
Reimplemented from core_role_capability_table_with_risks.
|
protectedinherited |
For subclasses to override, return the number of cells that add_header_cells/add_row_cells output.
Reimplemented from core_role_capability_table_base.
|
protected |
Print labels, fields and help icon on role administration page.
string | $name | The field name. |
string | $caption | The field caption. |
string | $field | The field type. |
null | string | $helpicon | The help icon content. |
|
protectedinherited |
Used to output a heading rows when the context level or component changes.
stdClass | $capability | gives the new component and contextlevel. |
core_role_define_role_table_advanced::read_submitted_permissions | ( | ) |
Update $this->permissions based on submitted data, while making a list of changed capabilities in $this->changed.
Reimplemented from core_role_capability_table_with_risks.
core_role_define_role_table_advanced::save_changes | ( | ) |
Save the new values of any permissions that have been changed.
Reimplemented from core_role_capability_table_with_risks.
Reimplemented in core_role_view_role_definition_table.
|
protectedinherited |
For subclasses to override.
Allows certain capabilties to be left out of the table.
object | $capability | the capability this row relates to. |
boolean. | If true, this row is omitted from the table. |
Reimplemented in core_role_view_role_definition_table.
|
protectedinherited |
The capabilities to display.
Initialised as $context->get_capabilities().