Base class for dataformat.
Copyright: | 2016 Brendan Heywood (brendan@catalyst-au.net) |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 261 lines (8 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
base:: (15 methods):
get_extension()
set_filename()
set_filepath()
set_sheettitle()
send_http_headers()
start_output_to_file()
start_output()
start_sheet()
supports_html()
format_record()
export_html_image_source()
replace_pluginfile_images()
close_sheet()
close_output()
close_output_to_file()
get_extension() X-Ref |
Get the file extension return: string file extension |
set_filename($filename) X-Ref |
Set download filename base param: string $filename |
set_filepath(string $filepath) X-Ref |
Set file path when writing to file param: string $filepath |
set_sheettitle($title) X-Ref |
Set the title of the worksheet inside a spreadsheet For some formats this will be ignored. param: string $title |
send_http_headers() X-Ref |
Output file headers to initialise the download of the file. |
start_output_to_file() X-Ref |
Set the dataformat to be output to current file. Calling code must call {@see base::close_output_to_file()} when finished |
start_output() X-Ref |
Write the start of the file. |
start_sheet($columns) X-Ref |
Write the start of the sheet we will be adding data to. param: array $columns |
supports_html() X-Ref |
Method to define whether the dataformat supports export of HTML return: bool |
format_record($record) X-Ref |
Apply formatting to the cells of a given record param: array|\stdClass $record return: array |
export_html_image_source(\stored_file $file) X-Ref |
Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original) param: \stored_file $file return: string|null |
replace_pluginfile_images(?string $content) X-Ref |
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 param: string|null $content return: string |
close_sheet($columns) X-Ref |
Write the end of the sheet containing the data. param: array $columns |
close_output() X-Ref |
Write the end of the file. |
close_output_to_file() X-Ref |
Write the data to disk. Calling code should have previously called {@see base::start_output_to_file()} return: bool Whether the write succeeded |