You are here

function constant_contact_export_submit in Constant Contact 6.3

Same name and namespace in other branches
  1. 7.3 admin.export.inc \constant_contact_export_submit()

Submit handler for the module export page

File

./admin.export.inc, line 74

Code

function constant_contact_export_submit($form, &$form_state) {
  $cc = constant_contact_create_object();
  if (!is_object($cc)) {
    return;
  }
  $type = $form_state['values']['export']['type'];
  $columns = array_values($form_state['values']['export']['columns']);
  $list_id = $form_state['values']['export']['list'];
  $sort_by = $form_state['values']['export']['sort_by'];

  // check we have an object
  $cc = constant_contact_create_object();
  $status = false;
  $status = $cc
    ->export_contacts($list_id, $type, $columns, $sort_by);
  if ($status) {
    drupal_set_message(t('An export activity has been created and the download will be available soon'));
  }
  else {
    drupal_set_message(t('Your subscribers could not be exported: ' . $cc->last_error), 'error');
  }
}