Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

Class containing utility methods for dataformats

Copyright: 2020 Paul Holden <paulh@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 148 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

dataformat:: (3 methods):
  get_format_instance()
  download_data()
  write_data()


Class: dataformat  - X-Ref

Dataformat utility class

get_format_instance(string $dataformat)   X-Ref
Return an instance of a dataformat writer from given dataformat type

param: string $dataformat
return: dataformat\base

download_data(string $filename, string $dataformat, array $columns, Iterable $iterator,callable $callback = null)   X-Ref
Sends a formatted data file to the browser

param: string $filename
param: string $dataformat
param: array $columns
param: Iterable $iterator
param: callable|null $callback Optional callback method to apply to each record prior to writing, which accepts two

write_data(string $filename, string $dataformat, array $columns, Iterable $iterator,callable $callback = null)   X-Ref
Writes a formatted data file with specified filename

param: string $filename
param: string $dataformat
param: array $columns
param: Iterable $iterator
param: callable|null $callback
return: string Complete path to the file on disk