Update csvexport.php - resubmitted PR per Rob's request #1712
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is really a pretty simple 2-line addition with an if condition. (None of the rest of the "changed" lines are actually changed - just indented because of the inserted 'if' condition.)
This change would accommodate (at least half of) my long-standing problem regarding the need to provide a TRUE Excel spreadsheet from a Fabrik list. It’s just a few lines of code and it doesn’t affect anything else in Fabrik.
What this would do is implement the inclusion of a php script that acts as a replacement for the routine run by Fabrik in the downloadFile() function of csvexprt.php. Look at it as an extension/alternative for the listcsv plugin.
The inclusion and success of the Export is based on one simple rule (Just like what is done for form_x.js, list_x.js, and details.js files.) If the file exists “./plugins/fabrik_list/listcsv/scripts/list_[ListID]_csv_export.php”, then that file is imported via php require() rather than the normal downloadFile() processing done by Fabrik.
For example,in my php script I use phpExcel to transform the CSV file into an xlsx file – adding my own formatting, password protection, locks and freezes on certain columns or rows of the spreadsheet.
It works for me - and I think it would be a good addition to Fabrik. This wouldn’t have to be used just for Excel files, using the phpExcel library. It could be used to create any kind of file based on the data in the CSV file – using whatever 3rd party tool (like phpExcel) is required to do so.
I’ll post an example of how to use it with phpExcel in the Wiki, once I see that you have committed my pull request.