Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Provides {@link tool_policy\output\acceptances_filter} class.

Copyright: 2018 Marina Glancy
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 464 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: acceptances_filter  - X-Ref

Implements the widget allowing to filter the acceptance records.

__construct($policyid, $versionid, $filtersapplied)   X-Ref
Constructor.

param: array $policyid Specified policy id
param: array $versionid Specified version id
param: array $filtersapplied The list of selected filter option values.

add_filter($key, $value, $allowmultiple = false)   X-Ref
Adds an applied filter

param: mixed $key
param: mixed $value
param: bool $allowmultiple

get_policy_id_filter()   X-Ref
Is there a filter by policy

return: null|int null if there is no filter, otherwise the policy id

get_version_id_filter()   X-Ref
Is there a filter by version

return: null|int null if there is no filter, otherwise the version id

get_search_strings()   X-Ref
Are there filters by search strings

return: string[] array of string filters

get_status_filter()   X-Ref
Is there a filter by status (agreed/not agreed).

return: null|0|1 null if there is no filter, 0/1 if there is a filter by status

get_role_filters()   X-Ref
Are there filters by role

return: array list of role ids

get_capability_accept_filter()   X-Ref
Is there a filter by capability (can accept/cannot accept).

return: null|0|1 null if there is no filter, 0/1 if there is a filter by capability

get_filter_values($filtername)   X-Ref
Get all values of the applied filter

param: string $filtername
return: array

get_filter_value($filtername, $default = null)   X-Ref
Get one value of the applied filter

param: string $filtername
param: string $default
return: mixed

get_avaliable_policies()   X-Ref
Returns all policies that have versions with possible acceptances (excl. drafts and guest-only versions)

return: array|null

get_versions()   X-Ref
List of policies that match current filters

return: array of versions to display indexed by versionid

validate_ids()   X-Ref
Validates if policyid and versionid are valid (if specified)


get_single_version()   X-Ref
If policyid or versionid is specified return one single policy that needs to be shown

If neither policyid nor versionid is specified this method returns null.

When versionid is specified this method will always return an object (this is validated in {@link self::validate_ids()}
When only policyid is specified this method either returns the current version of the policy or null if there is
no current version (for example, it is an old policy).

return: mixed|null

get_url()   X-Ref
Returns URL of the acceptances page with all current filters applied

return: \moodle_url

get_version_option_for_filter($version)   X-Ref
Creates an option name for the smart select for the version

param: \stdClass $version
return: string

build_available_filters()   X-Ref
Build list of filters available for this page

return: array [$availablefilters, $selectedoptions]

export_for_template(\renderer_base $output)   X-Ref
Function to export the renderer data in a format that is suitable for a mustache template.

param: renderer_base $output Used to do a final render of any components that need to be rendered for export.
return: \stdClass|array