SOLVED: Using the CMSexcel module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Splynx
Forum Members
Forum Members
Posts: 20
Joined: Tue Jun 26, 2007 2:41 pm

SOLVED: Using the CMSexcel module

Post by Splynx »

Hello

I am trying to export some data via a link to an excel sheet.

I have tried using some classes, but every time I export I get the whole admin page exported with it :-(

I have a link (this is backend BTW) pointing to a file like so:

$record->link_export = $this->CreateLink($id, 'list_export', $returnid, $icon_export, array('invitation_id'=>$record->id));

And in the file action.list_export.php I then try different stuff to get my SQL array exported - but every time I get the WHOLE admin page exported with it (as well as it does not format the data properly)

I have now imported the CMSexcel module - but I am at a loss on how to use it.

Can anyone show me a simple example on how to get my SQL data exported via a link? The help part of that module does not help me at all - any help would be appreciated - does not have to be that module (at the moment I am trying a 3rd party class)
Last edited by Splynx on Sun Oct 09, 2011 6:56 am, edited 1 time in total.
Splynx
Forum Members
Forum Members
Posts: 20
Joined: Tue Jun 26, 2007 2:41 pm

Re: Using the CMSexcel module

Post by Splynx »

Found the solution to this

Code: Select all

$excel_db = &$gCms->GetDb();
	$excel_query = 'SELECT * from '.cms_db_prefix().'module_iminvitation_invited WHERE invitation_id = ?';
	$excel_result = $excel_db->Execute($excel_query, array($record->id));
	$aData = array();
	while ($excel_result !== false && $excel_row = $excel_result->FetchRow()) {
		$aData[] = $excel_row;
	}
	$excel_data = array('invitation' => $aData);
	$stack = $gCms->modules['CMSExcel']['object']->buildExcel($excel_data, $params = array());
	$record->link_export = $gCms->modules['CMSExcel']['object']->getExcelLink($stack,$params = array());
Where the $record->link_export is for the TPL file ofc - and to be treated as a normal link in the template.
Post Reply

Return to “Modules/Add-Ons”