Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

File Size: 2191 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.

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

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

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

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.

We skip the enabled check for competencies, as there could be historical data. This avoids exceptions thrown from
the {@see api::require_enabled} method, which is called at various points during export via the competency API

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.

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

delete_user_plans($userid)   X-Ref
User plans.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return: void
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.

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.

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

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

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

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

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

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

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

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

return: void
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.

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

return: void
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.

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.

return: void
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.

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

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

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

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

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

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

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

return: array
param: competency $competency The competency.

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

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

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

return: array
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.

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

return: array
param: competency_framework $framework The framework.

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

return: array
param: template $template The Template.

transform_proficiency($proficiency)   X-Ref
Transform proficiency.

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

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

return: array
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.

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

return: array
param: int $userid The user we are exporting for.
param: user_evidence $ue The evidence of prior learning.

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

return: void
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.