Preprocesses data object that is going to be exported

@param data_controller $data
@param \stdClass $exportdata
@param array $subcontext
558935
public static function export_customfield_data(data_controller $data, \stdClass $exportdata, array $subcontext) {
        $context = $data->get_context();
        $exportdata->value = writer::with_context($context)
            ->rewrite_pluginfile_urls($subcontext, 'customfield_textarea', 'value',
                $exportdata->id, $exportdata->value);
        writer::with_context($context)
            ->export_data($subcontext, $exportdata)
            ->export_area_files($subcontext, 'customfield_textarea', 'value', $exportdata->id);
    }
636039
public void exportContext() {
		ContextExportDialog exportDialog = new ContextExportDialog(View.getSingleton().getMainFrame());
		exportDialog.setVisible(true);
	}
1002313
protected function exportDataTablesCallback(DataTablesProviderInterface $dtProvider, DataTablesRepositoryInterface $repository, DataTablesCSVExporterInterface $dtExporter, $windows) {

        $em = $this->getDoctrine()->getManager();

        $stream = fopen("php://output", "w+");

        // Export the columns.
        fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportColumns(), $windows), ";");

        // Paginates.
        $total = $repository->dataTablesCountExported($dtProvider);
        $pages = PaginateHelper::getPagesCount($total, DataTablesRepositoryInterface::REPOSITORY_LIMIT);

        // Handle each page.
        for ($i = 0; $i < $pages; ++$i) {

            // Get the offset and limit.
            list($offset, $limit) = PaginateHelper::getPageOffsetAndLimit($i, DataTablesRepositoryInterface::REPOSITORY_LIMIT, $total);

            // Get the export query with offset and limit.
            $result = $repository->dataTablesExportAll($dtProvider)
                ->setFirstResult($offset)
                ->setMaxResults($limit)
                ->getQuery()
                ->iterate();

            while (false !== ($row = $result->next())) {

                $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_EXPORT, [$row[0]]);

                fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportRow($row[0]), $windows), ";");

                // Detach the entity to avoid memory consumption.
                $em->detach($row[0]);

                $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_POST_EXPORT, [$row[0]]);
            }
        }

        // Close the file.
        fclose($stream);
    }
805732
protected function saveSubDataObjects()
    {
        foreach ($this->sub_data_objects as $name => $object) {
            $saver_method =
                'save' . str_replace(' ', '', ucwords(strtr($name, '_', ' ')));

            if (method_exists($this, $saver_method)) {
                call_user_func(array($this, $saver_method));
            }
        }

        /*
         * This handles the case where an internal property sub-dataobject also
         * exists in a sub-dataobject using a saver method. After the saver
         * method runs, the id of the internal property sub-dataobject is known
         * so we update it and then save this object's internal values again.
         */
        foreach (array_keys($this->internal_properties) as $name) {
            if ($this->hasSubDataObject($name)) {
                $sub_data_object = $this->getSubDataObject($name);
                if ($sub_data_object instanceof SwatDBDataObject) {
                    $id = $sub_data_object->getId();
                    $this->setInternalValue($name, $id);
                }
            }
        }
    }
525151
public static function export_feedback_user_data(assign_plugin_request_data $exportdata) {
        $currentpath = $exportdata->get_subcontext();
        $currentpath[] = get_string('privacy:path', 'assignfeedback_file');
        $assign = $exportdata->get_assign();
        $plugin = $assign->get_plugin_by_type('assignfeedback', 'file');
        $gradeid = $exportdata->get_pluginobject()->id;
        $filefeedback = $plugin->get_file_feedback($gradeid);
        if ($filefeedback) {
            $fileareas = $plugin->get_file_areas();
            foreach ($fileareas as $filearea => $notused) {
                \core_privacy\local\request\writer::with_context($exportdata->get_context())
                        ->export_area_files($currentpath, 'assignfeedback_file', $filearea, $gradeid);
            }
        }
    }
1239055
private static function readUnicodeStringLong($subData)
    {
        $value = '';

        // offset: 0: size: 2; length of the string (character count)
        $characterCount = self::getInt2d($subData, 0);

        $string = self::readUnicodeString(substr($subData, 2), $characterCount);

        // add 2 for the string length
        $string['size'] += 2;

        return $string;
    }
1216108
public function init(\stdClass $initData = null)
    {
        if ($initData === null) {
            $this->connection->connect();
        } else {
            $this->openConnection($initData);
        }
    }
418787
public function saveEntity($context, FormData $requestData, $subResource = NULL) {
    $this->setContext($context);
    return $this->saveFormular((array) $requestData);
  }
1204847
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext) {
        static::_export_gradingform_instance_data($context, $instanceid, $subcontext);
    }
1050726
public function export_file(array $subcontext, \stored_file $file) : content_writer {
        if (!$file->is_directory()) {
            $pathitems = array_merge(
                $subcontext,
                [$this->get_files_target_path($file->get_component(), $file->get_filearea(), $file->get_itemid())],
                [$file->get_filepath()]
            );
            $path = $this->get_path($pathitems, $file->get_filename());
            $fullpath = $this->get_full_path($pathitems, $file->get_filename());
            check_dir_exists(dirname($fullpath), true, true);
            $this->files[$path] = $file;
        }

        return $this;
    }
295575
public function exportFiles($data, FileBag $fileBag, Workspace $workspace)
    {
        foreach ($data['orderedTools'] as $key => $orderedToolData) {
            //copied from crud
            $name = 'export_tool_'.$orderedToolData['name'];
            //use an other even. StdClass is not pretty
            if (isset($orderedToolData['data'])) {
                /** @var ExportObjectEvent $event */
                $event = $this->dispatcher->dispatch($name, ExportObjectEvent::class, [
                    new \StdClass(), $fileBag, $orderedToolData['data'], $workspace,
                ]);
                $data['orderedTools'][$key]['data'] = $event->getData();
            }
        }

        return $data;
    }
535038
public function applyBehavioursOnSubmittedForm(ControllerContext $controllerContext)
    {
        if ($this->formObject->formWasSubmitted()) {
            $request = $controllerContext->getRequest()->getOriginalRequest();
            $formName = $this->formObject->getName();

            if ($request
                && $request->hasArgument($formName)
            ) {
                /** @var BehavioursManager $behavioursManager */
                $behavioursManager = GeneralUtility::makeInstance(BehavioursManager::class);

                /** @var array $originalForm */
                $originalForm = $request->getArgument($formName);

                $formProperties = $behavioursManager->applyBehaviourOnPropertiesArray(
                    $originalForm,
                    $this->formObject->getConfiguration()
                );

                $request->setArgument($formName, $formProperties);
            }
        }
    }
1296315
protected static function export_submission_data(\stdClass $submission, \context $context, array $currentpath) {
        $submissiondata = (object)[
            'timecreated' => transform::datetime($submission->timecreated),
            'timemodified' => transform::datetime($submission->timemodified),
            'status' => get_string('submissionstatus_' . $submission->status, 'mod_assign'),
            'groupid' => $submission->groupid,
            'attemptnumber' => ($submission->attemptnumber + 1),
            'latest' => transform::yesno($submission->latest)
        ];
        writer::with_context($context)
                ->export_data(array_merge($currentpath, [get_string('privacy:submissionpath', 'mod_assign')]), $submissiondata);
    }
786563
private function loadSubContexts($subcontexts)
    {
        foreach ($subcontexts as $path => $subcontext) {
            if (!file_exists($path)) {
                throw new \RuntimeException(sprintf('Subcontext path %s path does not exist.', $path));
            }

            // Load file.
            require_once $path;
        }
    }
272941
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext) {
        global $DB;
        // Get records from the provided params.
        $params = ['instanceid' => $instanceid];
        $sql = "SELECT gc.shortname, gc.description, gc.maxscore, gf.score, gf.remark
                  FROM {gradingform_guide_fillings} gf
                  JOIN {gradingform_guide_criteria} gc ON gc.id = gf.criterionid
                 WHERE gf.instanceid = :instanceid";
        $records = $DB->get_records_sql($sql, $params);
        if ($records) {
            $subcontext = array_merge($subcontext, [get_string('guide', 'gradingform_guide'), $instanceid]);
            writer::with_context($context)->export_data($subcontext, (object) $records);
        }
    }
821147
protected function export(array &$data)
    {
        array_walk_recursive($data, function (&$value, $name) {
            $value = $this->castPhpToDb($value, $name);
        });
    }
1147707
private function exportToMultiple(array $configurations, array $overrideData)
    {
        // Create export directory if it doesn't exist.
        if (!file_exists($this->path)) {
            mkdir($this->path, 2775, true);
        }

        foreach ($configurations as $dataTypeHandle => $configuration) {
            Schematic::info('Exporting '.$dataTypeHandle);
            foreach ($configuration as $recordName => $records) {
                // Check if there is data in the override file for the current record.
                if (isset($overrideData[$dataTypeHandle][$recordName])) {
                    $records = array_replace_recursive($records, $overrideData[$dataTypeHandle][$recordName]);
                }

                // Export records to file.
                $fileName = $this->toSafeFileName($dataTypeHandle.'.'.$recordName.'.yml');
                FileHelper::writeToFile($this->path.$fileName, Data::toYaml($records));
                Schematic::info('Exported '.$recordName.' to '.$fileName);
            }
        }
    }