Skip navigation
Help

theme_uc_file_user_downloads

6 uc_file.pages.inc theme_uc_file_user_downloads($header, $files)
7 uc_file.pages.inc theme_uc_file_user_downloads($variables)

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()

Related topics

File

ubercart/uc_file/uc_file.pages.inc, line 48
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;
}