(no description)
File Size: | 277 lines (10 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
entries_exporter:: (12 methods):
__construct()
add_row()
add_to_current_row()
next_row()
set_export_file_name()
get_records_count()
add_file_from_string()
send_file()
file_exists()
create_unique_filename()
create_zip_archive()
finish_zip_archive()
Class: entries_exporter - X-Ref
Exporter class for exporting data and - if needed - files as well in a zip archive.__construct() X-Ref |
Creates an entries_exporter object. This object can be used to export data to different formats including files. If files are added, everything will be bundled up in a zip archive. |
add_row(array $row) X-Ref |
Adds a row (array of strings) to the export data. param: array $row the row to add, $row has to be a plain array of strings return: void |
add_to_current_row(string $cellcontent) X-Ref |
Adds a data string (so the content for a "cell") to the current row. param: string $cellcontent the content to add to the current row return: void |
next_row() X-Ref |
Signal the entries_exporter to finish the current row and jump to the next row. return: void |
set_export_file_name(string $exportfilename) X-Ref |
Sets the name of the export file. Only use the basename without path and without extension here. param: string $exportfilename name of the file without path and extension return: void |
get_records_count() X-Ref |
Returns the count of currently stored records (rows excluding header row). return: int the count of records/rows |
add_file_from_string(string $filename, string $filecontent, string $zipsubdir = 'files/') X-Ref |
Use this method to add a file which should be exported to the entries_exporter. param: string $filename the name of the file which should be added param: string $filecontent the content of the file as a string param: string $zipsubdir the subdirectory in the zip archive. Defaults to 'files/'. return: void |
send_file(bool $sendtouser = true) X-Ref |
Sends the generated export file. Care: By default this function finishes the current PHP request and directly serves the file to the user as download. param: bool $sendtouser true if the file should be sent directly to the user, if false the file content will be returned return: string|null file content as string if $sendtouser is true |
file_exists(string $filename, string $zipsubdir = 'files/') X-Ref |
Checks if a file with the given name has already been added to the file export bundle. Care: Filenames are compared to all files in the specified zip subdirectory which defaults to 'files/'. param: string $filename the filename containing the zip path of the file to check param: string $zipsubdir The subdirectory in which the filename should be looked for, return: bool true if file with the given name already exists, false otherwise |
create_unique_filename(string $filename) X-Ref |
Creates a unique filename based on the given filename. This method adds "_1", "_2", ... to the given file name until the newly generated filename is not equal to any of the already saved ones in the export file bundle. param: string $filename the filename based on which a unique filename should be generated return: string the unique filename |
create_zip_archive() X-Ref |
Prepares the zip archive. return: void |
finish_zip_archive() X-Ref |
Closes the zip archive. return: void |