uc_file.theme.inc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * @file
  4. * Theme functions for the uc_file module.
  5. */
  6. /**
  7. * Themes the download table at the user account page.
  8. *
  9. * @param $variables
  10. * An associative array containing:
  11. * - form: A render element representing the form.
  12. *
  13. * @return string
  14. * The HTML output.
  15. *
  16. * @ingroup themeable
  17. */
  18. function theme_uc_file_hook_user_file_downloads($variables) {
  19. $form = $variables['form'];
  20. $header = array(
  21. array('data' => t('Remove' )),
  22. array('data' => t('Filename' )),
  23. array('data' => t('Expiration')),
  24. array('data' => t('Downloads' )),
  25. array('data' => t('Addresses' )),
  26. );
  27. $rows = array();
  28. $output = '';
  29. foreach (element_children($form['file_download']) as $key) {
  30. if (!isset($form['file_download'][$key]['addresses_in'])) {
  31. continue;
  32. }
  33. $file_download = &$form['file_download'][$key];
  34. $rows[] = array(
  35. 'data' => array(
  36. array('data' => drupal_render($file_download['remove'])),
  37. array('data' => drupal_render($file_download['filename'])),
  38. array(
  39. 'data' =>
  40. drupal_render($file_download['expires']) . ' <br />' .
  41. '<div class="duration">' .
  42. drupal_render($file_download['time_polarity']) .
  43. drupal_render($file_download['time_quantity']) .
  44. drupal_render($file_download['time_granularity']) .
  45. '</div>',
  46. ),
  47. array(
  48. 'data' =>
  49. '<div class="download-table-index">' .
  50. drupal_render($file_download['downloads_in']) . '/' . drupal_render($file_download['download_limit']) .
  51. '</div>',
  52. ),
  53. array(
  54. 'data' =>
  55. '<div class="download-table-index">' .
  56. drupal_render($file_download['addresses_in']) . '/' . drupal_render($file_download['address_limit']) .
  57. '</div>',
  58. ),
  59. ),
  60. 'class' => array('download-table-row'),
  61. );
  62. }
  63. $output .= theme('table', array(
  64. 'header' => $header,
  65. 'rows' => $rows,
  66. 'attributes' => array('id' => 'download-table'),
  67. 'empty' => t('No files can be downloaded by this user.'),
  68. ));
  69. $output .= drupal_render_children($form);
  70. return $output;
  71. }