You are here

function cc::export_contacts in Constant Contact 6.3

Same name and namespace in other branches
  1. 6.2 class.cc.php \cc::export_contacts()
  2. 7.3 class.cc.php \cc::export_contacts()

* This method creates a new export contacts activity * It returns the activity ID to use to check the status * * *

Parameters

array An array: fieldnames to export: see fieldnames.html: * @param int The ID of the list to export * @param string The format of the export, either CSV or TXT * * @access public

File

./class.cc.php, line 1129

Class

cc
@file

Code

function export_contacts($list_id, $export_type = 'CSV', $columns = array(), $sort_by = 'DATE_DESC') {
  if (!is_array($columns) || !count($columns)) {
    $columns = $this
      ->get_export_file_columns();
  }
  $params['activityType'] = 'EXPORT_CONTACTS';
  $params['fileType'] = $export_type;
  $params['exportOptDate'] = 'true';
  $params['exportOptSource'] = 'true';
  $params['exportListName'] = 'false';
  $params['sortBy'] = $sort_by;
  $params['columns'] = $columns;
  $params['listId'] = $this
    ->get_list_url($list_id);
  $this
    ->http_set_content_type('application/x-www-form-urlencoded');
  $xml = $this
    ->load_url("activities", 'post', $params, 201);
  if ($xml) {
    return true;
  }

  /*
  		if(isset($this->http_response_headers['Location']) && trim($this->http_response_headers['Location']) != ''):
  			return $this->get_id_from_link($this->http_response_headers['Location']);
  		endif;
  */
  return false;
}