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.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

Data provider.

Author: Frédéric Massart <fred@branchup.tech>
Copyright: 2018 Frédéric Massart
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1280 lines (55 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: provider  - X-Ref

Data provider class.

get_metadata(collection $collection)   X-Ref
Returns metadata.

param: collection $collection The initialised collection to add items to.
return: collection A listing of user data stored through this system.

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 user to search.
return: contextlist $contextlist The contextlist containing the list of contexts used in this plugin.

get_users_in_context(\core_privacy\local\request\userlist $userlist)   X-Ref
Get the list of contexts that contain user information for the specified user.

param: \core_privacy\local\request\userlist    $userlist   The userlist containing the list of users who have data

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(\core_privacy\local\request\approved_userlist $userlist)   X-Ref
Delete multiple users within a single context.

param: \core_privacy\local\request\approved_userlist $userlist The approved context and user information to

delete_orphan_historical_grades($userid)   X-Ref
Delete orphan historical grades.

param: int $userid The user ID.
return: void

export_user_data_outcomes_in_contexts(approved_contextlist $contextlist)   X-Ref
Export the user data related to outcomes.

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

export_user_data_scales_in_contexts(approved_contextlist $contextlist)   X-Ref
Export the user data related to scales.

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

extract_grade_grade_from_record(stdClass $record, $ishistory = false)   X-Ref
Extract grade_grade from a record.

param: stdClass $record The record.
param: bool $ishistory Whether we're extracting a historical grade.
return: grade_grade

extract_record($record, $prefix)   X-Ref
Extract a record from another one.

param: object $record The record to extract from.
param: string $prefix The prefix used.
return: object

get_fields_sql($target, $alias, $prefix)   X-Ref
Get fields SQL for a grade related object.

param: string $target The related object.
param: string $alias The table alias.
param: string $prefix A prefix.
return: string

get_item_ids_from_course_ids($courseids)   X-Ref
Get all the items IDs from course IDs.

param: array $courseids The course IDs.
return: array

recordset_loop_and_export(\moodle_recordset $recordset, $splitkey, $initial,callable $reducer, callable $export)   X-Ref
Loop and export from a recordset.

param: moodle_recordset $recordset The recordset.
param: string $splitkey The record key to determine when to export.
param: mixed $initial The initial data to reduce from.
param: callable $reducer The function to return the dataset, receives current dataset, and the current record.
param: callable $export The function to export the dataset, receives the last value from $splitkey and the dataset.
return: void

transform_history_action($action)   X-Ref
Transform an history action.

param: int $action The action.
return: string

transform_grade(grade_grade $gg, context $context, bool $ishistory)   X-Ref
Transform a grade.

param: grade_grade $gg The grade object.
param: context $context The context.
param: bool $ishistory Whether we're extracting a historical grade.
return: array

delete_files(array $itemids, bool $ishistory, array $userids = null)   X-Ref
Handles deleting files for a given list of grade items.

If an array of userids if given then it handles deleting files for those users.

param: array $itemids
param: bool $ishistory
param: array|null $userids