protected static function export_autosaves(\stdClass $user, \moodle_recordset $autosaves) {
        foreach ($autosaves as $autosave) {
            $context = \context::instance_by_id($autosave->contextid);
            $subcontext = [
                get_string('autosaves', 'editor_atto'),
                $autosave->id,
            ];

            $html = writer::with_context($context)
                ->rewrite_pluginfile_urls($subcontext, 'user', 'draft', $autosave->draftid, $autosave->drafttext);

            $data = (object) [
                'drafttext' => format_text($html, FORMAT_HTML, static::get_filter_options()),
                'timemodified' => \core_privacy\local\request\transform::datetime($autosave->timemodified),
            ];

            if ($autosave->userid != $user->id) {
                $data->author = \core_privacy\local\request\transform::user($autosave->userid);
            }

            writer::with_context($context)
                ->export_data($subcontext, $data)
                ->export_area_files($subcontext, 'user', 'draft', $autosave->draftid);
        }
        $autosaves->close();
    }
protected static function export_autosaves(\stdClass $user, \moodle_recordset $autosaves) {
        foreach ($autosaves as $autosave) {
            $context = \context::instance_by_id($autosave->contextid);
            $subcontext = [
                get_string('autosaves', 'editor_atto'),
                $autosave->id,
            ];

            $html = writer::with_context($context)
                ->rewrite_pluginfile_urls($subcontext, 'user', 'draft', $autosave->draftid, $autosave->drafttext);

            $data = (object) [
                'drafttext' => format_text($html, FORMAT_HTML, static::get_filter_options()),
                'timemodified' => \core_privacy\local\request\transform::datetime($autosave->timemodified),
            ];

            if ($autosave->userid != $user->id) {
                $data->author = \core_privacy\local\request\transform::user($autosave->userid);
            }

            writer::with_context($context)
                ->export_data($subcontext, $data)
                ->export_area_files($subcontext, 'user', 'draft', $autosave->draftid);
        }
        $autosaves->close();
    }
protected static function export_autosaves ( \ stdClass $ user , \ moodle_recordset $ autosaves ) { foreach ( $ autosaves as $ autosave ) { $ context = \ context :: instance_by_id ( $ autosave -> contextid ) ; $ subcontext = [ get_string ( 'autosaves' , 'editor_atto' ) , $ autosave -> id , ] ; $ html = writer :: with_context ( $ context ) -> rewrite_pluginfile_urls ( $ subcontext , 'user' , 'draft' , $ autosave -> draftid , $ autosave -> drafttext ) ; $ data = ( object ) [ 'drafttext' => format_text ( $ html , FORMAT_HTML , static :: get_filter_options ( ) ) , 'timemodified' => \ core_privacy \ local \ request \ transform :: datetime ( $ autosave -> timemodified ) , ] ; if ( $ autosave -> userid != $ user -> id ) { $ data -> author = \ core_privacy \ local \ request \ transform :: user ( $ autosave -> userid ) ; } writer :: with_context ( $ context ) -> export_data ( $ subcontext , $ data ) -> export_area_files ( $ subcontext , 'user' , 'draft' , $ autosave -> draftid ) ; } $ autosaves -> close ( ) ; }
Export all autosave records in the recordset, and close the recordset when finished.

@param   \stdClass   $user The user whose data is to be exported
@param   \moodle_recordset $autosaves The recordset containing the data to export
Export all autosave records in the recordset and close the recordset when finished .