Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
core\dataformat Class Reference

Dataformat utility class. More...

Static Public Member Functions

static download_data (string $filename, string $dataformat, array $columns, Iterable $iterator, callable $callback=null)
 Sends a formatted data file to the browser. More...
 
static write_data (string $filename, string $dataformat, array $columns, Iterable $iterator, callable $callback=null)
 Writes a formatted data file with specified filename. More...
 

Static Protected Member Functions

static get_format_instance (string $dataformat)
 Return an instance of a dataformat writer from given dataformat type. More...
 

Detailed Description

Dataformat utility class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ download_data()

static core\dataformat::download_data ( string  $filename,
string  $dataformat,
array  $columns,
Iterable  $iterator,
callable  $callback = null 
)
static

Sends a formatted data file to the browser.

Parameters
string$filename
string$dataformat
array$columns
Iterable$iterator
callable | null$callbackOptional callback method to apply to each record prior to writing, which accepts two parameters as such: function($record, bool $supportshtml) returning formatted record
Exceptions
coding_exception

◆ get_format_instance()

static core\dataformat::get_format_instance ( string  $dataformat)
staticprotected

Return an instance of a dataformat writer from given dataformat type.

Parameters
string$dataformat
Return values
dataformat::base
Exceptions
coding_exception

◆ write_data()

static core\dataformat::write_data ( string  $filename,
string  $dataformat,
array  $columns,
Iterable  $iterator,
callable  $callback = null 
)
static

Writes a formatted data file with specified filename.

Parameters
string$filename
string$dataformat
array$columns
Iterable$iterator
callable | null$callback
Return values
stringComplete path to the file on disk

The documentation for this class was generated from the following file: