Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Site policy management class.

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

Defines 1 class

manager:: (7 methods):
  get_all_handlers()
  get_handler_classname()
  is_defined()
  get_redirect_url()
  get_embed_url()
  accept()
  signup_form()


Class: manager  - X-Ref

Site policy management class.

get_all_handlers()   X-Ref
Returns the list of plugins that can work as sitepolicy handlers (have class PLUGINNAME\privacy\sitepolicy\handler)

return: array

get_handler_classname()   X-Ref
Returns the current site policy handler

return: handler

is_defined($forguests = false)   X-Ref
Checks if the site has site policy defined

return: bool
param: bool $forguests

get_redirect_url($forguests = false)   X-Ref
Returns URL to redirect user to when user needs to agree to site policy

This is a regular interactive page for web users. It should have normal Moodle header/footers, it should
allow user to view policies and accept them.

return: moodle_url|null (returns null if site policy is not defined)
param: bool $forguests

get_embed_url($forguests = false)   X-Ref
Returns URL of the site policy that needs to be displayed to the user (inside iframe or to use in WS such as mobile app)

This page should not have any header/footer, it does not also have any buttons/checkboxes. The caller needs to implement
the "Accept" button and call {@link self::accept()} on completion.

return: moodle_url|null
param: bool $forguests

accept()   X-Ref
Accept site policy for the current user

return: bool - false if sitepolicy not defined, user is not logged in or user has already agreed to site policy;

signup_form($mform)   X-Ref
Adds "Agree to site policy" checkbox to the signup form.

Sitepolicy handlers can override the simple checkbox with their own controls.

param: \MoodleQuickForm $mform