@@ -155,7 +155,7 @@ public function displayExportOptions($template_name, $params)
155
155
$ smarty ->assign ("is_admin " , $ is_admin );
156
156
$ smarty ->assign ("page_vars " , $ page_vars );
157
157
$ smarty ->assign ("L " , $ L );
158
- $ smarty ->assign ("SESSION " , Settings ::get ("export_manager " ));
158
+ $ smarty ->assign ("SESSION " , Sessions ::get ("export_manager " ));
159
159
$ smarty ->assign ("LANG " , $ params ["LANG " ]);
160
160
$ smarty ->assign ("export_icon_folder " , "$ root_url/modules/export_manager/images/icons " );
161
161
@@ -389,10 +389,11 @@ private function addXmlExportGroup ()
389
389
"visibility " => "hide " ,
390
390
"icon " => "xml.jpg " ,
391
391
"action_button_text " => $ L ["word_generate " ],
392
- "smarty_template " => "<?xml version= \"1.0 \" encoding= \"utf - 8 \" ?> \r\n\r\n{ \$export_type_smarty_template} "
392
+ "smarty_template " => "<?xml version= \"1.0 \" encoding= \"utf- 8 \" ?> \r\n\r\n{ \$export_type_smarty_template} "
393
393
), $ L );
394
394
395
395
$ xml_smarty_template =<<< END
396
+ {strip}
396
397
<export>
397
398
<export_datetime>{ \$datetime}</export_datetime>
398
399
<export_unixtime>{ \$U}</export_unixtime>
@@ -420,6 +421,7 @@ private function addXmlExportGroup ()
420
421
{/foreach}
421
422
</submissions>
422
423
</export>
424
+ {/strip}
423
425
END ;
424
426
425
427
ExportTypes::addExportType (array (
@@ -441,12 +443,38 @@ private function addCsvExportGroup()
441
443
"visibility " => "hide " ,
442
444
"icon " => "csv.gif " ,
443
445
"action_button_text " => $ L ["word_generate " ],
444
- "headers " => "Content-type: application/xml ; charset= \"octet - stream \"\r\nContent-Disposition: attachment; filename={ \$filename} " ,
445
- "smarty_template " => "<?xml version= \" 1.0 \" encoding= \" utf - 8 \" ?> \r\n\r\n { \$export_type_smarty_template} "
446
+ "headers " => "Content-type: text/csv ; charset= \"octet- stream \"\r\nContent-Disposition: attachment; filename={ \$filename} " ,
447
+ "smarty_template " => "{ \$export_type_smarty_template} "
446
448
), $ L );
447
449
448
450
$ csv_smarty_template =<<< END
449
- {strip} \r\n {foreach from= \$display_fields item=column name=row} \r\n {* workaround for an absurd Microsoft Excel problem, in which the first \r\n two characters of a file cannot be ID; see: \r\n http://support.microsoft.com /kb/323626 *} \r\n {if \$smarty.foreach.row.first && \$column.field_title == \"ID \"} \r\n .ID \r\n {else} \r\n { \$column.field_title|escape:''csv''} \r\n {/if} \r\n {if ! \$smarty.foreach.row.last},{/if} \r\n {/foreach} \r\n{/strip} \r\n{foreach from= \$submissions item=submission name=row}{strip} \r\n {foreach from= \$display_fields item=field_info name=col_row} \r\n {assign var=col_name value= \$field_info.col_name} \r\n {assign var=value value= \$submission. \$col_name} \r\n {smart_display_field form_id= \$form_id view_id= \$view_id \r\n submission_id= \$submission.submission_id field_info= \$field_info \r\n field_types= \$field_types settings= \$settings value= \$value \r\n escape= \"csv \"} \r\n {* if this wasn''t the last row, output a comma *} \r\n {if ! \$smarty.foreach.col_row.last},{/if} \r\n {/foreach} \r\n{/strip} \r\n{if ! \$smarty.foreach.row.last} \r\n{/if} \r\n{/foreach}
451
+ {strip}
452
+ {foreach from= \$display_fields item=column name=row}
453
+ {* workaround for an absurd Microsoft Excel problem, in which the first
454
+ two characters of a file cannot be ID; see:
455
+ http://support.microsoft.com/kb/323626 *}
456
+ {if \$smarty.foreach.row.first && \$column.field_title == "ID"}
457
+ 'ID
458
+ {else}
459
+ { \$column.field_title|escape:'csv'}
460
+ {/if}
461
+ {if ! \$smarty.foreach.row.last},{/if}
462
+ {/foreach}
463
+ {/strip}
464
+ {foreach from= \$submissions item=submission name=row}{strip}
465
+ {foreach from= \$display_fields item=field_info name=col_row}
466
+ {assign var=col_name value= \$field_info.col_name}
467
+ {assign var=value value= \$submission. \$col_name}
468
+ {smart_display_field form_id= \$form_id view_id= \$view_id
469
+ submission_id= \$submission.submission_id field_info= \$field_info
470
+ field_types= \$field_types settings= \$settings value= \$value
471
+ escape="csv"}
472
+ {* if this wasn't the last row, output a comma *}
473
+ {if ! \$smarty.foreach.col_row.last},{/if}
474
+ {/foreach}{/strip}
475
+ {if ! \$smarty.foreach.row.last}
476
+ {/if}
477
+ {/foreach}
450
478
END ;
451
479
452
480
ExportTypes::addExportType (array (
0 commit comments