You are here

function _download_count_details_table in Download Count 7.3

Create and output details table.

1 call to _download_count_details_table()
download_count_view_details in includes/download_count.pages.inc
Download_count details page callback.

File

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

Code

function _download_count_details_table($result, $caption, $range) {
  $header = array(
    array(
      'data' => t('#'),
      'class' => 'number',
    ),
    array(
      'data' => t($range),
      'class' => 'range',
    ),
    array(
      'data' => t('Downloads'),
      'class' => 'count',
    ),
  );
  $count = 1;
  $rows = array();
  $values = array();
  foreach ($result as $download) {
    $row = array();
    $row[] = $count;
    $row[] = $download->time_interval;
    $row[] = number_format($download->count);
    $values[] = $download->count;
    $rows[] = $row;
    $count++;
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'caption' => $caption,
    'sticky' => FALSE,
    'attributes' => array(
      'id' => 'download-count-' . drupal_strtolower(drupal_clean_css_identifier($caption)),
      'class' => 'download-count-details download-count-table',
    ),
  ));
  return array(
    'output' => $output,
    'values' => $values,
  );
}