function stats_download_csv_from_batch

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 228
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);

  watchdog('stats', "download_csv_from_batch batch_id:$batch_id, filename:$filename.csv", array());

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

  die;

}