protected static function export_user_data_in_user_contexts($userid, array $contexts) {
        global $DB;

        $mycontext = context_user::instance($userid);
        $contextids = array_map(function($context) {
            return $context->id;
        }, $contexts);
        $exportowncontext = in_array($mycontext->id, $contextids);
        $othercontexts = array_filter($contextids, function($contextid) use ($mycontext) {
            return $contextid != $mycontext->id;
        });

        if ($exportowncontext) {
            static::export_user_data_learning_plans($mycontext);
            static::export_user_data_competencies($mycontext);
            static::export_user_data_user_evidence($mycontext);
        }

        foreach ($othercontexts as $contextid) {
            static::export_user_data_learning_plans_related_to_me($userid, context::instance_by_id($contextid));
            static::export_user_data_competencies_related_to_me($userid, context::instance_by_id($contextid));
            static::export_user_data_user_evidence_related_to_me($userid, context::instance_by_id($contextid));
        }
    }
protected static function export_user_data_in_user_contexts($userid, array $contexts) {
        global $DB;

        $mycontext = context_user::instance($userid);
        $contextids = array_map(function($context) {
            return $context->id;
        }, $contexts);
        $exportowncontext = in_array($mycontext->id, $contextids);
        $othercontexts = array_filter($contextids, function($contextid) use ($mycontext) {
            return $contextid != $mycontext->id;
        });

        if ($exportowncontext) {
            static::export_user_data_learning_plans($mycontext);
            static::export_user_data_competencies($mycontext);
            static::export_user_data_user_evidence($mycontext);
        }

        foreach ($othercontexts as $contextid) {
            static::export_user_data_learning_plans_related_to_me($userid, context::instance_by_id($contextid));
            static::export_user_data_competencies_related_to_me($userid, context::instance_by_id($contextid));
            static::export_user_data_user_evidence_related_to_me($userid, context::instance_by_id($contextid));
        }
    }
protected static function export_user_data_in_user_contexts ( $ userid , array $ contexts ) { global $ DB ; $ mycontext = context_user :: instance ( $ userid ) ; $ contextids = array_map ( function ( $ context ) { return $ context -> id ; } , $ contexts ) ; $ exportowncontext = in_array ( $ mycontext -> id , $ contextids ) ; $ othercontexts = array_filter ( $ contextids , function ( $ contextid ) use ( $ mycontext ) { return $ contextid != $ mycontext -> id ; } ) ; if ( $ exportowncontext ) { static :: export_user_data_learning_plans ( $ mycontext ) ; static :: export_user_data_competencies ( $ mycontext ) ; static :: export_user_data_user_evidence ( $ mycontext ) ; } foreach ( $ othercontexts as $ contextid ) { static :: export_user_data_learning_plans_related_to_me ( $ userid , context :: instance_by_id ( $ contextid ) ) ; static :: export_user_data_competencies_related_to_me ( $ userid , context :: instance_by_id ( $ contextid ) ) ; static :: export_user_data_user_evidence_related_to_me ( $ userid , context :: instance_by_id ( $ contextid ) ) ; } }
Export the user data in user context.

@param int $userid The user ID.
@param array $contexts The contexts.
@return void
Export the user data in user context .