You are here

function theme_uc_file_user_downloads in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.module \theme_uc_file_user_downloads()
  2. 7.3 uc_file/uc_file.pages.inc \theme_uc_file_user_downloads()

Themes user file downloads page.

Parameters

$files: Array of the files.

1 theme call to theme_uc_file_user_downloads()
uc_file_user_downloads in uc_file/uc_file.pages.inc
Table builder for user downloads.

File

uc_file/uc_file.pages.inc, line 38
File menu items.

Code

function theme_uc_file_user_downloads($header, $files) {
  $rows = array();
  $row = 0;
  foreach ($files as $file) {
    $rows[] = array(
      array(
        'data' => format_date($file['granted'], 'custom', variable_get('uc_date_format_default', 'm/d/Y')),
        'class' => 'date-row',
        'id' => 'date-' . $row,
      ),
      array(
        'data' => $file['link'],
        'class' => 'filename-row',
        'id' => 'filename-' . $row,
      ),
      array(
        'data' => $file['description'],
        'class' => 'description-row',
        'id' => 'description-' . $row,
      ),
      array(
        'data' => $file['accessed'] . '/' . ($file['download_limit'] ? $file['download_limit'] : t('Unlimited')),
        'class' => 'download-row',
        'id' => 'download-' . $row,
      ),
      array(
        'data' => count(unserialize($file['addresses'])) . '/' . ($file['address_limit'] ? $file['address_limit'] : t('Unlimited')),
        'class' => 'addresses-row',
        'id' => 'addresses-' . $row,
      ),
    );
    $row++;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No downloads found'),
        'colspan' => 5,
      ),
    );
  }
  $output = theme('table', $header, $rows);
  $output .= theme('pager', NULL, UC_FILE_PAGER_SIZE, 0);
  $output .= '<div class="form-item"><p class="description">' . t('Once your download is finished, you must refresh the page to download again. (Provided you have permission)') . '<br />' . t('Downloads will not be counted until the file is finished transferring, even though the number may increment when you click.') . '<br /><b>' . t('Do not use any download acceleration feature to download the file, or you may lock yourself out of the download.') . '</b>' . '</p></div>';
  return $output;
}