Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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: 2194 lines (96 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(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.

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.

Here we only delete the private data of user, not whether they modified, are reviewing,
or are associated with the record on at a second level. Only data directly linked to the
user will be affected.

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.

Here we only delete the private data of users, not whether they modified, are reviewing,
or are associated with the record on at a second level. Only data directly linked to the
user will be affected.

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

delete_user_evidence_of_prior_learning($userid)   X-Ref
Delete evidence of prior learning.

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

delete_user_plans($userid)   X-Ref
User plans.

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

delete_user_competencies($userid)   X-Ref
Delete user competency data.

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

delete_user_competencies_in_course($courseid, $userids = [])   X-Ref
Delete the record of competencies for user(s) in a course.

param: int $courseid The course ID.
param: int[] $userids The user IDs, if deleting for specific user(s).
return: void

export_user_data_in_user_contexts($userid, array $contexts)   X-Ref
Export the user data in user context.

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

export_user_data_in_system_context($userid)   X-Ref
Export the user data in systen context.

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

export_user_data_in_category_contexts($userid, array $contexts)   X-Ref
Export the user data in category contexts.

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

export_user_data_in_course_contexts($userid, array $contexts)   X-Ref
Export the user data in course contexts.

param: int $userid The user whose data we're exporting.
param: array $contexts A list of contexts.
return: void

export_user_data_in_course_contexts_rated_by_me($userid, $courseids, $path,performance_helper $helper)   X-Ref
Export the ratings given in a course.

param: int $userid The user ID.
param: array $courseids The course IDs.
param: array $path The root path.
param: performance_helper $helper The performance helper.
return: void

export_user_data_in_course_contexts_associations($userid, $courseids, $path)   X-Ref
No description

export_user_data_in_course_contexts_settings($userid, $courseids, $path)   X-Ref
Export user data in course contexts related to course settings.

param: int $userid The user ID.
param: array $courseids The course IDs.
param: array $path The root path to export at.
return: void

export_user_data_in_module_contexts($userid, array $contexts)   X-Ref
Export the user data in module contexts.

param: int $userid The user whose data we're exporting.
param: array $contexts A list of contexts.
return: void

export_user_data_competencies(context_user $context)   X-Ref
Export a user's competencies.

param: context_user $context The context of the user requesting the export.
return: void

export_user_data_learning_plans(context_user $context)   X-Ref
Export a user's learning plans.

param: context_user $context The context of the user requesting the export.
return: void

export_user_data_learning_plans_related_to_me($userid, context_user $context)   X-Ref
Export a user's data related to learning plans.

param: int $userid The user ID we're exporting for.
param: context_user $context The context of the user in which we're gathering data.
return: void

export_user_data_competencies_related_to_me($userid, context_user $context)   X-Ref
Export a user's data related to competencies.

param: int $userid The user ID we're exporting for.
param: context_user $context The context of the user in which we're gathering data.
return: void

export_user_data_user_evidence_related_to_me($userid, context_user $context)   X-Ref
Export a user's data related to evidence of prior learning.

param: int $userid The user ID we're exporting for.
param: context_user $context The context of the user in which we're gathering data.
return: void

export_user_data_user_evidence(context_user $context)   X-Ref
Export the evidence of prior learning of a user.

param: context_user $context The context of the user we're exporting for.
return: void

export_user_data_frameworks_in_context($userid, context $context)   X-Ref
Export the user data related to frameworks in context.

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

export_user_data_templates_in_context($userid, context $context)   X-Ref
Export the user data related to templates in contexts.

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

transform_competency_brief(competency $competency)   X-Ref
Transform a competency into a brief description.

param: competency $competency The competency.
return: array

transform_competency_grade(competency $competency, $grade, performance_helper $helper)   X-Ref
Transform a competency rating.

param: competency $competency The competency.
param: int $grade The grade.
param: performance_helper $helper The performance helper.
return: string

transform_evidence($userid, evidence $evidence, competency $competency, performance_helper $helper)   X-Ref
Transform an evidence.

param: int $userid The user ID we are exporting for.
param: evidence $evidence The evidence.
param: competency $competency The associated competency.
param: performance_helper $helper The performance helper.
return: array

transform_framework_brief(competency_framework $framework)   X-Ref
Transform a framework into a brief description.

param: competency_framework $framework The framework.
return: array

transform_template_brief(template $template)   X-Ref
Transform a template into a brief description.

param: template $template The Template.
return: array

transform_proficiency($proficiency)   X-Ref
Transform proficiency.

param: null|bool $proficiency The proficiency.
return: string

transform_user_competency($userid, $uc, competency $competency, performance_helper $helper)   X-Ref
Transform user competency.

param: int $userid The user ID we are exporting for.
param: user_competency|user_competency_plan|user_competency_course $uc The user competency.
param: competency $competency The associated competency.
param: performance_helper $helper The performance helper.
return: array

transform_user_evidence($userid, user_evidence $ue)   X-Ref
Transform a user evidence.

param: int $userid The user we are exporting for.
param: user_evidence $ue The evidence of prior learning.
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