function stats_download_csv_from_batch

7.x stats.module stats_download_csv_from_batch($batch_id)
6.x stats.module stats_download_csv_from_batch($batch_id)
5.x stats.module stats_download_csv_from_batch($batch_id)

Lets the user download a CSV file from a completed batch.

There are no permissions on this, except the can_access_stats permission.

Parameters

unknown_type $batch_id:

File

modules/stats/stats.module, line 218
This module displays statistics and reports for FlightPath

Code

function stats_download_csv_from_batch($batch_id) {

  $filename = fp_get_machine_readable(strtolower($_REQUEST ["filename"]));

  $batch = batch_get($batch_id);

  // Give it to the browser...  
  header('Content-type: text/csv');
  header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
  print $batch ["csv"];

  die;

}