Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Base class for dataformat. More...
Public Member Functions | |
close_output () | |
Write the end of the file. | |
close_output_to_file () | |
Write the data to disk. | |
close_sheet ($columns) | |
Write the end of the sheet containing the data. | |
get_extension () | |
Get the file extension. | |
send_http_headers () | |
Output file headers to initialise the download of the file. | |
set_filename ($filename) | |
Set download filename base. | |
set_filepath (string $filepath) | |
Set file path when writing to file. | |
set_sheettitle ($title) | |
Set the title of the worksheet inside a spreadsheet. | |
start_output () | |
Write the start of the file. | |
start_output_to_file () | |
Set the dataformat to be output to current file. | |
start_sheet ($columns) | |
Write the start of the sheet we will be adding data to. | |
supports_html () | |
Method to define whether the dataformat supports export of HTML. | |
write_record ($record, $rownum) | |
Write a single record. | |
Protected Member Functions | |
export_html_image_source (\stored_file $file) | |
Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original) | |
format_record ($record) | |
Apply formatting to the cells of a given record. | |
replace_pluginfile_images (?string $content) | |
We need to locate all img tags within a given cell that match pluginfile URL's. | |
Protected Attributes | |
$extension | $extension = ".txt" |
$filename | $filename = '' |
string | $filepath = '' |
The location to store the output content. | |
$mimetype | $mimetype = "text/plain" |
Base class for dataformat.
core\dataformat\base::close_output | ( | ) |
Write the end of the file.
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
core\dataformat\base::close_output_to_file | ( | ) |
Write the data to disk.
Calling code should have previously called {
bool | Whether the write succeeded |
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
core\dataformat\base::close_sheet | ( | $columns | ) |
Write the end of the sheet containing the data.
array | $columns |
Reimplemented in dataformat_html\writer, and dataformat_json\writer.
|
protected |
Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original)
stored_file | $file |
string|null |
Reimplemented in dataformat_pdf\writer.
|
protected |
Apply formatting to the cells of a given record.
array | stdClass | $record |
array |
core\dataformat\base::get_extension | ( | ) |
Get the file extension.
string | file extension |
|
protected |
We need to locate all img tags within a given cell that match pluginfile URL's.
Partly so the exported file will show the image without requiring the user is logged in; and also to prevent some of the dataformats requesting the file themselves, which is likely to fail due to them not having an active session
string | null | $content |
string |
core\dataformat\base::send_http_headers | ( | ) |
Output file headers to initialise the download of the file.
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
core\dataformat\base::set_filename | ( | $filename | ) |
Set download filename base.
string | $filename |
core\dataformat\base::set_filepath | ( | string | $filepath | ) |
core\dataformat\base::set_sheettitle | ( | $title | ) |
Set the title of the worksheet inside a spreadsheet.
For some formats this will be ignored.
string | $title |
Reimplemented in core\dataformat\spout_base, dataformat_excel\writer, and dataformat_ods\writer.
core\dataformat\base::start_output | ( | ) |
Write the start of the file.
Reimplemented in dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
core\dataformat\base::start_output_to_file | ( | ) |
Set the dataformat to be output to current file.
Calling code must call {
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
core\dataformat\base::start_sheet | ( | $columns | ) |
Write the start of the sheet we will be adding data to.
array | $columns |
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
core\dataformat\base::supports_html | ( | ) |
Method to define whether the dataformat supports export of HTML.
bool |
Reimplemented in dataformat_html\writer, and dataformat_pdf\writer.
|
abstract |
Write a single record.
array | $record | |
int | $rownum |
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.