Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
tool_policy\acceptances_table Class Reference

Class acceptances_table. More...

Inheritance diagram for tool_policy\acceptances_table:

Public Member Functions

 __construct ($uniqueid, acceptances_filter $acceptancesfilter, renderer $output)
 Constructor.
 
 col_country ($data)
 Generate the country column.
 
 col_fullname ($row)
 Get the column fullname value.
 
 col_note ($row)
 Get the column note value.
 
 col_statusall ($row)
 Get the column statusall value.
 
 col_timemodified ($row)
 Get the column timemodified value.
 
 display ()
 Render the table.
 
 download ()
 Download the data.
 
 format_row ($row)
 Call appropriate methods on this table class to perform any processing on values before displaying in table.
 
 get_sort_columns ()
 Remove randomness from the list by always sorting by user id in the end.
 
 get_sql_where ()
 Get sql to add to where statement.
 
 other_cols ($column, $row)
 You can override this method in a child class.
 
 wrap_html_finish ()
 Hook that can be overridden in child classes to wrap a table in a form for example.
 
 wrap_html_start ()
 Hook that can be overridden in child classes to wrap a table in a form for example.
 

Protected Member Functions

 add_column_header ($key, $label, $sortable=true, $columnclass='')
 Allows to add only one column name and header to the table (parent class methods only allow to set all).
 
 build_sql_for_capability_filter ()
 If there is a filter to find users who can/cannot accept on their own behalf add it to the SQL query.
 
 build_sql_for_roles_filter ()
 If there is a filter by user roles add it to the SQL query.
 
 build_sql_for_search_string ($userfields)
 Helper SQL query builder.
 
 configure_for_multiple_versions ()
 Helper configuration method.
 
 configure_for_single_version ()
 Helper configuration method.
 
 get_return_url ()
 Helper.
 
 sql_has_role ($roles, $positive=true)
 Returns SQL snippet for users that have (do not have) one of the given roles in the system context.
 
 status ($versionid, $row)
 Return agreement status.
 
 username ($user, $profilelink=true)
 User name with a link to profile.
 

Protected Attributes

acceptances_filter $acceptancesfilter
 
bool $canagreeany = false
 are there any users that this user can agree on behalf of
 
string[] $countries
 The list of countries.
 
renderer $output
 
array $versionids
 

Detailed Description

Class acceptances_table.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

tool_policy\acceptances_table::__construct ( $uniqueid,
acceptances_filter $acceptancesfilter,
renderer $output )

Constructor.

Parameters
string$uniqueidTable identifier.
acceptances_filter$acceptancesfilter
renderer$output

Member Function Documentation

◆ add_column_header()

tool_policy\acceptances_table::add_column_header ( $key,
$label,
$sortable = true,
$columnclass = '' )
protected

Allows to add only one column name and header to the table (parent class methods only allow to set all).

Parameters
string$key
string$label
bool$sortable
string$columnclass

◆ build_sql_for_search_string()

tool_policy\acceptances_table::build_sql_for_search_string ( $userfields)
protected

Helper SQL query builder.

Parameters
array$userfields

◆ col_country()

tool_policy\acceptances_table::col_country ( $data)

Generate the country column.

Parameters
stdClass$data
Return values
string

◆ col_fullname()

tool_policy\acceptances_table::col_fullname ( $row)

Get the column fullname value.

Parameters
stdClass$row
Return values
string

◆ col_note()

tool_policy\acceptances_table::col_note ( $row)

Get the column note value.

Parameters
stdClass$row
Return values
string

◆ col_statusall()

tool_policy\acceptances_table::col_statusall ( $row)

Get the column statusall value.

Parameters
stdClass$row
Return values
string

◆ col_timemodified()

tool_policy\acceptances_table::col_timemodified ( $row)

Get the column timemodified value.

Parameters
stdClass$row
Return values
string

◆ format_row()

tool_policy\acceptances_table::format_row ( $row)

Call appropriate methods on this table class to perform any processing on values before displaying in table.

Takes raw data from the database and process it into human readable format, perhaps also adding html linking when displaying table as html, adding a div wrap, etc.

See for example col_fullname below which will be called for a column whose name is 'fullname'.

Parameters
array | object$rowrow of data from db used to make one row of the table.
Return values
arrayone row for the table, added using add_data_keyed method.

◆ get_sort_columns()

tool_policy\acceptances_table::get_sort_columns ( )

Remove randomness from the list by always sorting by user id in the end.

Return values
array

◆ get_sql_where()

tool_policy\acceptances_table::get_sql_where ( )

Get sql to add to where statement.

Return values
string

◆ other_cols()

tool_policy\acceptances_table::other_cols ( $column,
$row )

You can override this method in a child class.

See the description of build_table which calls this method.

Parameters
string$column
stdClass$row
Return values
string

◆ sql_has_role()

tool_policy\acceptances_table::sql_has_role ( $roles,
$positive = true )
protected

Returns SQL snippet for users that have (do not have) one of the given roles in the system context.

Parameters
array$roleslist of roles indexed by role id
bool$positivetrue: return users who HAVE roles; false: return users who DO NOT HAVE roles
Return values
string

◆ status()

tool_policy\acceptances_table::status ( $versionid,
$row )
protected

Return agreement status.

Parameters
int$versionideither id of an individual version or empty for overall status
stdClass$row
Return values
string

◆ username()

tool_policy\acceptances_table::username ( $user,
$profilelink = true )
protected

User name with a link to profile.

Parameters
stdClass$user
bool$profilelinkshow link to profile (when we are downloading never show links)
Return values
string

◆ wrap_html_finish()

tool_policy\acceptances_table::wrap_html_finish ( )

Hook that can be overridden in child classes to wrap a table in a form for example.

Called only when there is data to display and not downloading.

◆ wrap_html_start()

tool_policy\acceptances_table::wrap_html_start ( )

Hook that can be overridden in child classes to wrap a table in a form for example.

Called only when there is data to display and not downloading.


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