You are here

function theme_uc_file_user_downloads in Ubercart 7.3

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

Themes user file downloads page.

Parameters

$variables: An associative array containing:

  • header: Table header array, in format required by theme_table().
  • files: Associative array of downloadable files, containing:
    • granted: Timestamp of file grant.
    • link: URL of file.
    • description: File name, as it should appear to user after downloading.
    • accessed: Integer number of times file has been downloaded.
    • download_limit: Integer limit on downloads.
    • addresses: Integer number of IP addresses used.
    • address_limit: Integer limit on IP addresses.

See also

theme_table()

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 49
File menu items.

Code

function theme_uc_file_user_downloads($variables) {
  $header = $variables['header'];
  $files = $variables['files'];
  $rows = array();
  $row = 0;
  foreach ($files as $file) {
    $rows[] = array(
      array(
        'data' => format_date($file['granted'], 'uc_store'),
        'class' => array(
          'date-row',
        ),
        'id' => 'date-' . $row,
      ),
      array(
        'data' => $file['link'],
        'class' => array(
          'filename-row',
        ),
        'id' => 'filename-' . $row,
      ),
      array(
        'data' => $file['description'],
        'class' => array(
          'description-row',
        ),
        'id' => 'description-' . $row,
      ),
      array(
        'data' => $file['accessed'] . '/' . ($file['download_limit'] ? $file['download_limit'] : t('Unlimited')),
        'class' => array(
          'download-row',
        ),
        'id' => 'download-' . $row,
      ),
      array(
        'data' => count(unserialize($file['addresses'])) . '/' . ($file['address_limit'] ? $file['address_limit'] : t('Unlimited')),
        'class' => array(
          'addresses-row',
        ),
        'id' => 'addresses-' . $row,
      ),
    );
    $row++;
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No downloads found'),
  ));
  $output .= theme('pager');
  $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;
}