You are here

function download_count_export_form_submit in Download Count 7.3

Same name and namespace in other branches
  1. 6.2 includes/download_count.export.inc \download_count_export_form_submit()

Implements hook_submit().

File

includes/download_count.export.inc, line 78
Page callback file for the download_count module export feature.

Code

function download_count_export_form_submit($form, &$form_state) {
  variable_set('download_count_export_range', $form_state['values']['download_count_export_range']);
  $filename = 'download_count_export_' . ($form_state['values']['download_count_file_info'] == 'all' ? 'all_files' : check_plain($form_state['values']['download_count_file_info']->filename)) . '_' . date('Y-m-d') . '.csv';
  $range = $form_state['values']['download_count_export_range'];
  $file_info = $form_state['values']['download_count_file_info'];
  $start = $form_state['values']['download_count_export_date_range_from'];
  $end = $form_state['values']['download_count_export_date_range_to'];
  $result = download_count_export_data($filename, $range, $file_info, $start, $end);
  drupal_set_message($filename . " has been successfully exported.", 'status');
  return;
}