1
I have a view that prints a report on the screen. I put a button and am doing a function to export this report to excel. My question is:
How to send this data that is in an array to my controller?
My button is like this, Via get I can only pass a variable.
echo $this->Html->link('Exportar', array('controller' => 'reports', 'action' => 'export', $prospects), array('class' => 'btn btn-primary'));
I believe in the same way that you obtained the data to assemble this report in this action, you may have this data in another action to export. As done in this report?
– Paulo Rodrigues
I thought about it sending my filter, else would I have the code rewritten? Is there any way to pass a data vector from one controller to another? Another question I can send a vector from one controller to another?
– Devidy Oliviera
You don’t have to rewrite everything. If you have a single private method that does the processing and gives you a vector, in both actions (view and export) you call this method and only the output will be different, since one will mount a view and the other will export to Excel.
– Paulo Rodrigues
I have this report_prospects action in my controller and I have the report_prospects view in my Reports folder where I save the views. Plus my method to export this data is in a specific controller, I would like to know how to pass this data from one controller to another. Does cakephp have this feature? If so, how?
– Devidy Oliviera