Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update csvexport.php - resubmitted PR per Rob's request #1712

Merged
merged 2 commits into from
May 11, 2016

Conversation

bauer-git
Copy link

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.

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.
// Do additional processing if post-processing php file exists
$listid = $this->app->input->getInt('listid');
if(file_exists(JPATH_PLUGINS.'/fabrik_list/listcsv/scripts/list_'.$listid.'_csv_export.php')){
require(JPATH_PLUGINS.'/fabrik_list/listcsv/scripts/list_260_csv_export.php');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems you've left in a hard coded file name

oops - I could've sworn I caught and fixed that last week
@pollen8 pollen8 merged commit d545dbf into Fabrik:joomla3 May 11, 2016
@pollen8
Copy link
Member

pollen8 commented May 11, 2016

I merged.
It would be nicer if you use the Joomla code style to format your code changes. If you use phpstorm/eclipse the joomla website has tutorials on how to set that up.

@bauer-git bauer-git deleted the patch-24 branch May 11, 2016 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants