Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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.

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

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.

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

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.

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

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

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

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.

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

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

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

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

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

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

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

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.