Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Privacy Subsystem implementation for mod_data.

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

Defines 1 class


Class: provider  - X-Ref

Implementation of the privacy subsystem plugin provider for the database activity module.

get_metadata(collection $collection)   X-Ref
Return the fields which contain personal data.

param: collection $collection a reference to the collection to use to store the metadata.
return: collection the updated collection of metadata items.

get_contexts_for_userid(int $userid)   X-Ref
Get the list of contexts that contain user information for the specified user.

param: int $userid the userid.
return: contextlist the list of contexts containing user info for the user.

get_users_in_context(userlist $userlist)   X-Ref
Get the list of users who have data within a context.

param: userlist    $userlist   The userlist containing the list of users who have data in this context/plugin combination.

extract_object_from_record($record, $prefix, $additionalfields = [])   X-Ref
Creates an object from all fields in the $record where key starts with $prefix

param: \stdClass $record
param: string $prefix
param: array $additionalfields
return: \stdClass

export_data_content($context, $recordobj, $fieldobj, $contentobj)   X-Ref
Export one field answer in a record in database activity module

param: \context $context
param: \stdClass $recordobj record from DB table {data_records}
param: \stdClass $fieldobj record from DB table {data_fields}
param: \stdClass $contentobj record from DB table {data_content}

sql_fields()   X-Ref
SQL query that returns all fields from {data_content}, {data_fields} and {data_records} tables

return: string

export_user_data(approved_contextlist $contextlist)   X-Ref
Export personal data for the given approved_contextlist. User and context information is contained within the contextlist.

param: approved_contextlist $contextlist a list of contexts approved for export.

export_data_record($context, $user, $recordobj)   X-Ref
Export one entry in the database activity module (one record in {data_records} table)

param: \context $context
param: \stdClass $user
param: \stdClass $recordobj

export_data($context, $user)   X-Ref
Export basic info about database activity module

param: \context $context
param: \stdClass $user

delete_data_for_all_users_in_context(\context $context)   X-Ref
Delete all data for all users in the specified context.

param: \context $context the context to delete in.

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

param: approved_contextlist $contextlist a list of contexts approved for deletion.

delete_data_for_users(approved_userlist $userlist)   X-Ref
Delete multiple users within a single context.

param: approved_userlist    $userlist The approved context and user information to delete information for.

mark_data_content_for_deletion($context, $row)   X-Ref
Marks a data_record/data_content for deletion

Also invokes callback from datafield plugin in case it stores additional data that needs to be deleted

param: \context $context
param: \stdClass $row result of SQL query - tables data_content, data_record, data_fields join together

delete_data_records($context, $recordstobedeleted)   X-Ref
Deletes records marked for deletion and all associated data

Should be executed after all records were marked by {@link mark_data_content_for_deletion()}

Deletes records from data_content and data_records tables, associated files, tags, comments and ratings.

param: \context $context
param: array $recordstobedeleted list of ids of the data records that need to be deleted