Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
core_role_capability_table_base Class Reference

This class represents a table with one row for each of a list of capabilities where the first cell in the row contains the capability name, and there is arbitrary stuff in the rest of the row. More...

Inheritance diagram for core_role_capability_table_base:
core_role_capability_table_with_risks core_role_check_capability_table core_role_permissions_table core_role_define_role_table_advanced core_role_override_permissions_table_advanced core_role_define_role_table_basic core_role_view_role_definition_table

Public Member Functions

 __construct (context $context, $id)
 Constructor.
 
 add_classes ($classnames)
 Use this to add class="" attributes to the table.
 
 display ()
 Display the table.
 

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_row_cells ($capability)
 For subclasses to override.
 
 get_row_attributes ($capability)
 For subclasses to override.
 
 get_row_classes ($capability)
 For subclasses to override.
 
 num_extra_columns ()
 For subclasses to override, return the number of cells that add_header_cells/add_row_cells output.
 
 print_heading_row ($capability)
 Used to output a heading rows when the context level or component changes.
 
 skip_row ($capability)
 For subclasses to override.
 

Protected Attributes

 $capabilities = array()
 The capabilities to display.
 
 $classes = array('rolecap table-hover')
 Added to the class="" attribute on output.
 
 $context
 The context this table relates to.
 
 $id
 Added as an id="" attribute to the table on output.
 

Detailed Description

This class represents a table with one row for each of a list of capabilities where the first cell in the row contains the capability name, and there is arbitrary stuff in the rest of the row.

This class is used by admin/roles/manage.php, override.php and check.php.

An ajaxy search UI shown at the top, if JavaScript is on.

Constructor & Destructor Documentation

◆ __construct()

core_role_capability_table_base::__construct ( context $context,
$id )

Constructor.

Parameters
context$contextthe context this table relates to.
string$idwhat to put in the id="" attribute.

Member Function Documentation

◆ add_classes()

core_role_capability_table_base::add_classes ( $classnames)

Use this to add class="" attributes to the table.

You get the rolecap by default.

Parameters
array$classnamesof class names.

◆ add_header_cells()

core_role_capability_table_base::add_header_cells ( )
abstractprotected

For subclasses to override, output header cells, after the initial capability one.

Reimplemented in core_role_capability_table_with_risks, core_role_check_capability_table, and core_role_permissions_table.

◆ add_row_cells()

core_role_capability_table_base::add_row_cells ( $capability)
abstractprotected

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.

Parameters
stdClass$capabilitythe capability this row relates to.
Return values
stringhtml of row cells

Reimplemented in core_role_capability_table_with_risks, core_role_check_capability_table, and core_role_permissions_table.

◆ display()

core_role_capability_table_base::display ( )

◆ get_row_attributes()

core_role_capability_table_base::get_row_attributes ( $capability)
protected

For subclasses to override.

Additional attributes to be added to each table row for the capability

Parameters
stdClass$capabilitythe capability this row relates to.
Return values
arrayattribute names and their values.

Reimplemented in core_role_override_permissions_table_advanced, and core_role_permissions_table.

◆ get_row_classes()

core_role_capability_table_base::get_row_classes ( $capability)
protected

For subclasses to override.

A change to reaturn class names that are added to the class="" attribute on the <tr> for this capability.

Parameters
stdClass$capabilitythe capability this row relates to.
Return values
arrayof class name strings.

Reimplemented in core_role_capability_table_with_risks, and core_role_check_capability_table.

◆ num_extra_columns()

core_role_capability_table_base::num_extra_columns ( )
abstractprotected

For subclasses to override, return the number of cells that add_header_cells/add_row_cells output.

Reimplemented in core_role_capability_table_with_risks, core_role_check_capability_table, and core_role_permissions_table.

◆ print_heading_row()

core_role_capability_table_base::print_heading_row ( $capability)
protected

Used to output a heading rows when the context level or component changes.

Parameters
stdClass$capabilitygives the new component and contextlevel.

◆ skip_row()

core_role_capability_table_base::skip_row ( $capability)
protected

For subclasses to override.

Allows certain capabilties to be left out of the table.

Parameters
object$capabilitythe capability this row relates to.
Return values
boolean.If true, this row is omitted from the table.

Reimplemented in core_role_view_role_definition_table.

Member Data Documentation

◆ $capabilities

core_role_capability_table_base::$capabilities = array()
protected

The capabilities to display.

Initialised as $context->get_capabilities().


The documentation for this class was generated from the following file: