Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403]

Privacy Subsystem implementation for core_question.

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

Defines 1 class


Class: provider  - X-Ref

Privacy Subsystem implementation for core_question.

get_metadata(collection $items)   X-Ref
Describe the types of data stored by the question subsystem.

param: collection  $items  The collection to add metadata to.
return: collection  The array of metadata

export_question_usage(int $userid,\context $context,array $usagecontext,int $usage,\question_display_options $options,bool $isowner)   X-Ref
Export the data for all question attempts on this question usage.

Where a user is the owner of the usage, then the full detail of that usage will be included.
Where a user has been involved in the usage, but it is not their own usage, then only their specific
involvement will be exported.

param: int             $userid     The userid to export.
param: \context        $context    The context that the question was used within.
param: array           $usagecontext  The subcontext of this usage.
param: int             $usage      The question usage ID.
param: \question_display_options   $options    The display options used for formatting.
param: bool            $isowner    Whether the user being exported is the user who used the question.

export_question_attempt_steps(int $userid,\context $context,array $questionnocontext,\question_attempt $qa,\question_display_options $options,$isowner)   X-Ref
Export the data for each step transition for each question in each question attempt.

Where a user is the owner of the usage, then all steps in the question usage will be exported.
Where a user is not the owner, but has been involved in the usage, then only their specific
involvement will be exported.

param: int                 $userid     The user to export for
param: \context            $context    The context that the question was used within.
param: array               $questionnocontext  The subcontext of this question number.
param: \question_attempt   $qa         The attempt being checked
param: \question_display_options   $options    The display options used for formatting.
param: bool                $isowner    Whether the user being exported is the user who used the question.

get_contexts_for_userid(int $userid)   X-Ref
Get the list of contexts where the specified user has either created, or edited a question.

To export usage of a question, please call {@link provider::export_question_usage()} from the module which
instantiated the usage of the question.

param: int             $userid The user to search.
return: contextlist     $contextlist The contextlist containing the list of contexts used in this plugin.

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.

get_related_question_usages_for_user(string $prefix, string $component, string $joinfield, int $userid)   X-Ref
Determine related question usages for a user.

param: string          $prefix     A unique prefix to add to the table alias
param: string          $component  The name of the component to fetch usages for.
param: string          $joinfield  The SQL field name to use in the JOIN ON - e.g. q.usageid
param: int             $userid     The user to search.
return: \qubaid_join

get_users_in_context_from_sql(userlist $userlist, string $prefix, string $insql, $params,int $contextid = null)   X-Ref
Add the list of users who have rated in the specified constraints.

param: userlist    $userlist   The userlist to add the users to.
param: string      $prefix     A unique prefix to add to the table alias to avoid interference with your own sql.
param: string      $insql      The SQL to use in a sub-select for the question_usages.id query.
param: array       $params     The params required for the insql.
param: int|null    $contextid  An optional context id, in case the $sql query is not already filtered by that.

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

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

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 specific context to delete data for.

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    The approved contexts and user information to delete information for.

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.