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.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

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

Copyright: 2018 Sara Arjona <sara@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 502 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: page_agreedocs  - X-Ref

Represents a page for showing all the policy documents which a user has to agree to.

__construct(array $listdocs, array $agreedocs = [], array $declinedocs = [], $behalfid = 0, $action = null)   X-Ref
Prepare the page for rendering.

param: array $listdocs List of policy version ids that were displayed to the user to agree with.
param: array $agreedocs List of policy version ids that the user actually agreed with.
param: array $declinedocs List of policy version ids that the user declined.
param: int $behalfid The userid to accept the policy versions as (such as child's id).
param: string $action Form action to identify when user agreeds policies.

accept_and_revoke_policies()   X-Ref
Accept and revoke the policy versions.
The capabilities for accepting/revoking policies are checked into the api functions.


redirect_to_policies($userid, $returnurl = null)   X-Ref
Before display the consent page, the user has to view all the still-non-accepted policy docs.
This function checks if the non-accepted policy docs have been shown and redirect to them.

param: int $userid User identifier who wants to access to the consent page.
param: moodle_url $returnurl URL to return after shown the policy docs.

redirect_to_previous_url()   X-Ref
Redirect to signup page if defined or to $CFG->wwwroot if not.


prepare_global_page_access($userid)   X-Ref
Sets up the global $PAGE and performs the access checks.

param: int $userid

prepare_user_acceptances($userid)   X-Ref
Prepare user acceptances.

param: int $userid

export_for_template(renderer_base $output)   X-Ref
Export the page data for the mustache template.

param: renderer_base $output renderer to be used to render the page elements.
return: \stdClass