You are here

function constant_contact_download_activity in Constant Contact 7.3

Same name and namespace in other branches
  1. 6.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
Implements hook_menu().

File

./admin.activities.inc, line 94
Activities administration functions.

Code

function constant_contact_download_activity($filename) {
  $cc = constant_contact_create_object();
  if (!is_object($cc)) {
    return;
  }
  $filext = drupal_strtolower(drupal_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;
}