You are here

function constant_contact_download_activity in Constant Contact 6.3

Same name and namespace in other branches
  1. 7.3 admin.activities.inc \constant_contact_download_activity()

Download an activity file

1 string reference to 'constant_contact_download_activity'
constant_contact_menu in ./constant_contact.module
Adds an admin menu for the Cnstant Contact module

File

./admin.activities.inc, line 92

Code

function constant_contact_download_activity($filename) {

  // create the object
  $cc = constant_contact_create_object();
  if (!is_object($cc)) {
    return;
  }
  $filext = strtolower(substr($filename, -4));
  if ($filext == '.csv') {
    header('Content-type: text/csv');
  }
  elseif ($filext == '.txt') {
    header('Content-type: text/plain');
  }
  else {
    header('Content-type: application/octet-stream');
  }
  header('Content-Disposition: attachment; filename="' . $filename . '"');
  echo $cc
    ->download_activity_file($filename);
  exit;
}