Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_policy\output\page_agreedocs Class Reference

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

Inheritance diagram for tool_policy\output\page_agreedocs:
renderable templatable

Public Member Functions

 __construct (array $listdocs, array $agreedocs=[], array $declinedocs=[], $behalfid=0, $action=null)
 Prepare the page for rendering.
 
 export_for_template (renderer_base $output)
 Export the page data for the mustache template.
 

Protected Member Functions

 accept_and_revoke_policies ()
 Accept and revoke the policy versions.
 
 prepare_global_page_access ($userid)
 Sets up the global $PAGE and performs the access checks.
 
 prepare_user_acceptances ($userid)
 Prepare user acceptances.
 
 redirect_to_policies ($userid, $returnurl=null)
 Before display the consent page, the user has to view all the still-non-accepted policy docs.
 
 redirect_to_previous_url ()
 Redirect to signup page if defined or to $CFG->wwwroot if not.
 

Protected Attributes

string $action = null
 $action Form action to identify when user agreeds policies.
 
array $agreedocs = null
 $agreedocs List of policy identifiers which the user has agreed using the form.
 
int $behalfid = null
 User id who wants to accept this page.
 
object $behalfuser = null
 User who wants to accept this page.
 
array $declinedocs = null
 $declinedocs List of policy identifiers that the user declined.
 
bool $isexistinguser
 This is an existing user (rather than non-loggedin/guest).
 
array $listdocs = null
 List of policy version ids that were displayed to the user to agree with.
 
array $messages = []
 Info or error messages to show.
 
array $policies = null
 $policies List of public policies objects with information about the user acceptance.
 
boolean $signupuserpolicyagreed = false
 True if signup user has agreed to all the policies; false otherwise.
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

tool_policy\output\page_agreedocs::__construct ( array $listdocs,
array $agreedocs = [],
array $declinedocs = [],
$behalfid = 0,
$action = null )

Prepare the page for rendering.

Parameters
array$listdocsList of policy version ids that were displayed to the user to agree with.
array$agreedocsList of policy version ids that the user actually agreed with.
array$declinedocsList of policy version ids that the user declined.
int$behalfidThe userid to accept the policy versions as (such as child's id).
string$actionForm action to identify when user agreeds policies.

Member Function Documentation

◆ accept_and_revoke_policies()

tool_policy\output\page_agreedocs::accept_and_revoke_policies ( )
protected

Accept and revoke the policy versions.

The capabilities for accepting/revoking policies are checked into the api functions.

◆ export_for_template()

tool_policy\output\page_agreedocs::export_for_template ( renderer_base $output)

Export the page data for the mustache template.

Parameters
renderer_base$outputrenderer to be used to render the page elements.
Return values
stdClass

Implements templatable.

◆ prepare_global_page_access()

tool_policy\output\page_agreedocs::prepare_global_page_access ( $userid)
protected

Sets up the global $PAGE and performs the access checks.

Parameters
int$userid

◆ prepare_user_acceptances()

tool_policy\output\page_agreedocs::prepare_user_acceptances ( $userid)
protected

Prepare user acceptances.

Parameters
int$userid

◆ redirect_to_policies()

tool_policy\output\page_agreedocs::redirect_to_policies ( $userid,
$returnurl = null )
protected

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.

Parameters
int$useridUser identifier who wants to access to the consent page.
moodle_url$returnurlURL to return after shown the policy docs.

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