You are here

function constant_contact_import in Constant Contact 7.3

Same name and namespace in other branches
  1. 5 constant_contact.module \constant_contact_import()
  2. 6.3 admin.import.inc \constant_contact_import()
  3. 6 constant_contact.module \constant_contact_import()

Displays the import page

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

File

./admin.import.inc, line 11
Contact import functions.

Code

function constant_contact_import() {
  $cc = constant_contact_create_object();
  if (!is_object($cc)) {
    return '';
  }
  $form = array();
  $form['#attributes'] = array(
    'enctype' => "multipart/form-data",
  );

  // Upload.
  $form['constant_contact']['import'] = array(
    '#type' => 'fieldset',
    '#title' => t('Import Subscribers'),
  );
  $form['constant_contact']['import']['file'] = array(
    '#type' => 'file',
    '#title' => t('CSV file'),
    '#description' => t('Upload a CSV or TXT file containing your subscribers, see <a href="@fileformat" target="_blank">this page</a> for help with formatting the file', array(
      '@fileformat' => 'http://constantcontact.custhelp.com/cgi-bin/constantcontact.cfg/php/enduser/std_adp.php?p_faqid=2523',
    )),
    '#size' => 60,
  );
  $lists = constant_contact_get_lists($cc);
  $form['constant_contact']['import']['lists'] = array(
    '#type' => 'select',
    '#title' => t('Contact lists'),
    '#options' => $lists,
    '#multiple' => TRUE,
    '#size' => 10,
    '#description' => t('Select which contact lists you want to subscribe these users to, you must select at least one list'),
    '#required' => TRUE,
  );
  $form['#redirect'] = 'admin/config/services/constant_contact/activities';
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Import'),
  );
  return $form;
}