You are here

function constant_contact_export in Constant Contact 7.3

Same name and namespace in other branches
  1. 6.3 admin.export.inc \constant_contact_export()

Displays the export page

1 string reference to 'constant_contact_export'
constant_contact_menu in ./constant_contact.module
Implements hook_menu().

File

./admin.export.inc, line 11
Export contacts functions.

Code

function constant_contact_export() {
  $cc = constant_contact_create_object();
  if (!is_object($cc)) {
    return '';
  }
  $form['constant_contact']['export'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => t('Export Subscribers'),
  );
  $options = array(
    'CSV' => t('CSV'),
    'TXT' => t('TXT'),
  );
  $form['constant_contact']['export']['type'] = array(
    '#type' => 'radios',
    '#title' => t('File Format'),
    '#description' => t('Choose what format to use for the export'),
    '#size' => 60,
    '#options' => $options,
    '#default_value' => 'CSV',
    '#required' => TRUE,
  );
  $form['constant_contact']['export']['columns'] = array(
    '#type' => 'select',
    '#title' => t('Columns'),
    '#options' => $cc
      ->get_export_file_columns(),
    '#multiple' => TRUE,
    '#size' => 10,
    '#description' => t('You can select which columns to include in the export file'),
  );
  $lists = constant_contact_get_lists($cc, 0);
  $form['constant_contact']['export']['list'] = array(
    '#type' => 'select',
    '#title' => t('Contact list'),
    '#options' => $lists,
    '#size' => 1,
    '#description' => t('Select which contact list you want to export from'),
    '#required' => TRUE,
  );
  $sort_by = array(
    'DATE_DESC' => t('Date Subscribed'),
    'EMAIL_ADDRESS' => t('Email Address'),
  );
  $form['constant_contact']['export']['sort_by'] = array(
    '#type' => 'select',
    '#title' => t('Sort By'),
    '#description' => t('Choose how to sort the data'),
    '#options' => $sort_by,
    '#default_value' => 'DATE_DESC',
    '#required' => TRUE,
  );
  $form['#redirect'] = 'admin/settings/constant_contact/activities';
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Export'),
  );
  return $form;
}