You are here

function download_count_reset_form in Download Count 7.3

Same name and namespace in other branches
  1. 6.2 includes/download_count.pages.inc \download_count_reset_form()
  2. 7.2 includes/download_count.pages.inc \download_count_reset_form()

Download count reset function.

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

File

includes/download_count.pages.inc, line 147
Administrative page callbacks for the download_count module.

Code

function download_count_reset_form($form, $form_state, $dc_entry = NULL) {
  $form = array();
  if ($dc_entry != 'all') {
    $form['dcid'] = array(
      '#type' => 'value',
      '#value' => $dc_entry->dcid,
    );
    $form['filename'] = array(
      '#type' => 'value',
      '#value' => check_plain($dc_entry->filename),
    );
    $form['fid'] = array(
      '#type' => 'value',
      '#value' => $dc_entry->fid,
    );
    $form['type'] = array(
      '#type' => 'value',
      '#value' => check_plain($dc_entry->type),
    );
    $form['id'] = array(
      '#type' => 'value',
      '#value' => $dc_entry->id,
    );
    return confirm_form($form, t('Are you sure you want to reset the download count for %filename on %entity #%id?', array(
      '%filename' => $dc_entry->filename,
      '%entity' => $dc_entry->type,
      '%id' => $dc_entry->id,
    )), 'admin/reports/download-count', t('This action cannot be undone.'), t('Reset'), t('Cancel'));
  }
  else {
    $form['dcid'] = array(
      '#type' => 'value',
      '#value' => 'all',
    );
    return confirm_form($form, t('Are you sure you want to reset all download counts?'), 'admin/reports/download-count', t('This action cannot be undone.'), t('Reset All'), t('Cancel'));
  }
}