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.

This file contains the core_privacy\local\request helper.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 308 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: helper  - X-Ref

The core_privacy\local\request\helper class with useful shared functionality.

add_shared_contexts_to_contextlist_for(int $userid, contextlist $contextlist)   X-Ref
Add core-controlled contexts which are related to a component but that component may know about.

For example, most activities are not aware of activity completion, but the course implements it for them.
These should be included.

return: contextlist     The final contextlist
param: int             $userid The user being added for.
param: contextlist     $contextlist The contextlist being appended to.

add_shared_users_to_userlist(\core_privacy\local\request\userlist $userlist)   X-Ref
Add core-controlled contexts which are related to a component but that component may know about.

For example, most activities are not aware of activity completion, but the course implements it for them.
These should be included.

return: contextlist     The final contextlist
param: \core_privacy\local\request\userlist    $userlist

export_data_for_null_provider(approved_contextlist $contextlist)   X-Ref
Handle export of standard data for a plugin which implements the null provider and does not normally store data
of its own.

This is used in cases such as activities like mod_resource, which do not store their own data, but may still have
data on them (like Activity Completion).

Any context provided in a contextlist should have base data exported as a minimum.

param: approved_contextlist    $contextlist    The approved contexts to export information for.

delete_data_for_all_users_in_context(string $component, \context $context)   X-Ref
Handle removal of 'standard' data for any plugin.

This will handle deletion for things such as activity completion.

param: string          $component The component being deleted for.
param: context         $context   The specific context to delete data for.

delete_data_for_user(approved_contextlist $contextlist)   X-Ref
Delete all 'standard' user data for the specified user, in the specified contexts.

This will handle deletion for things such as activity completion.

param: approved_contextlist    $contextlist    The approved contexts and user information to delete information for.

get_context_data(\context $context, \stdClass $user)   X-Ref
Get all general data for this context.

return: \stdClass
param: \context        $context The context to retrieve data for.
param: \stdClass       $user The user being written.

export_context_files(\context $context, \stdClass $user)   X-Ref
Export all files for this context.

return: \stdClass
param: \context        $context The context to export files for.
param: \stdClass       $user The user being written.

add_shared_contexts_to_contextlist_for_course_module(int $userid, contextlist $contextlist)   X-Ref
Add core-controlled contexts which are related to a component but that component may know about.

For example, most activities are not aware of activity completion, but the course implements it for them.
These should be included.

return: contextlist     The final contextlist
param: int             $userid The user being added for.
param: contextlist     $contextlist The contextlist being appended to.

get_context_module_data(\context_module $context, \stdClass $user)   X-Ref
Get all general data for the activity module at this context.

return: \stdClass
param: \context_module $context The context to retrieve data for.
param: \stdClass       $user The user being written.

get_context_block_data(\context_block $context, \stdClass $user)   X-Ref
Get all general data for the block at this context.

return: \stdClass General data about this block instance.
param: \context_block $context The context to retrieve data for.
param: \stdClass $user The user being written.

export_context_module_files(\context_module $context, \stdClass $user)   X-Ref
Get all general data for the activity module at this context.

return: \stdClass
param: \context_module $context The context to retrieve data for.
param: \stdClass       $user The user being written.

delete_data_for_all_users_in_context_course_module(string $component, \context $context)   X-Ref
Handle removal of 'standard' data for course modules.

This will handle deletion for things such as activity completion.

param: string              $component The component being deleted for.
param: \context            $context The context to delete all data for.

delete_data_for_user_in_course_module(approved_contextlist $contextlist)   X-Ref
Delete all 'standard' user data for the specified user in course modules.

This will handle deletion for things such as activity completion.

param: approved_contextlist    $contextlist    The approved contexts and user information to delete information for.