You are here

function download_count_export_form in Download Count 7.3

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

Download_count export form.

1 string reference to 'download_count_export_form'
download_count_menu in ./download_count.module
Implements hook_menu().

File

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

Code

function download_count_export_form($form, $form_state, $dc_entry = NULL) {
  drupal_add_js(drupal_get_path('module', 'download_count') . '/js/download_count.js');
  if ($dc_entry == 'all') {
    drupal_set_title(t('Download Count Export CSV - All Files'));
  }
  else {
    drupal_set_title(t('Download Count Export CSV - @filename from @type @id', array(
      '@filename' => $dc_entry->filename,
      '@type' => $dc_entry->type,
      '@id' => $dc_entry->id,
    )));
  }
  $form['download_count_export_note'] = array(
    '#prefix' => '<div id="download-count-export-note">',
    '#suffix' => '</div>',
    '#markup' => l(t('&#0171; Back to summary'), 'admin/reports/download-count', array(
      'html' => TRUE,
    )) . '<br /><br />' . t('The following data will be exported:') . '<ul>' . '<li>' . t('Download count id') . '<li>' . t('File id') . '<li>' . t('File name') . '<li>' . t('File size') . '<li>' . t('Entity type') . '<li>' . t('Entity id') . '<li>' . t('Downloading user id') . '<li>' . t('Downloading username') . '<li>' . t('Downloading user ip address') . '<li>' . t('HTTP referrer') . '<li>' . t('Date - time (YYYY-MM-DD  HH:MM:SS)') . '</ul>',
  );
  $form['download_count_export_range'] = array(
    '#type' => 'radios',
    '#title' => t('Export Range'),
    '#options' => array(
      t('export all data'),
      t('export data for a specified date range'),
    ),
    '#default_value' => variable_get('download_count_export_range', 0),
  );
  $form['download_count_export_date_range_from'] = array(
    '#type' => 'date',
    '#title' => t('Export Range From Date'),
    '#description' => t('This field will be ignored if the Export Range \'export all data\' option is selected above.'),
  );
  $form['download_count_export_date_range_to'] = array(
    '#type' => 'date',
    '#title' => t('Export Range To Date'),
    '#description' => t('This field will be ignored if the Export Range \'export all data\' option is selected above.'),
  );
  $form['download_count_file_info'] = array(
    '#type' => 'value',
    '#value' => $dc_entry,
  );
  $form['download_count_export_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Export'),
  );
  $form['download_count_export_cancel'] = array(
    '#value' => '<a href="javascript:history.back(-1)">' . t('Cancel') . '</a>',
  );
  $form_state['#redirect'] = TRUE;
  return $form;
}