You are here

function theme_video_multidownload_download in Video 6

Same name and namespace in other branches
  1. 5 plugins/video_multidownload/video_multidownload.module \theme_video_multidownload_download()
  2. 6.2 plugins/video_multidownload/video_multidownload.module \theme_video_multidownload_download()

Outputs the HTML for the download page when multi-file download are turned on.

Parameters

$node: object with node information

Return value

string of content to display

1 theme call to theme_video_multidownload_download()
video_multidownload_download in plugins/video_multidownload/video_multidownload.module

File

plugins/video_multidownload/video_multidownload.module, line 281
Enable multiple file download in video module.

Code

function theme_video_multidownload_download($node) {
  $output = '';

  //Replace some common file types with full name and links.
  $find = array(
    'mov',
    'wmv',
    'rm',
    'avi',
    'zip',
    'divx',
    'flv',
    'ogg',
  );
  $replace = array(
    '<a href="http://www.apple.com/quicktime" title="' . t('QuickTime Homepage') . '">' . t('Quicktime') . '</a>',
    '<a href="http://www.microsoft.com/windowsmedia" title="' . t('Windows Media Homepage') . '">' . t('Windows Media') . '</a>',
    '<a href="http://www.real.com" title="' . t('Real Media Homepage') . '">' . t('Real Media') . '</a>',
    '<a href="http://en.wikipedia.org/wiki/AVI" title="' . t('AVI Information at wikipedia.org') . '">' . t('AVI') . '</a>',
    '<a href="http://en.wikipedia.org/wiki/ZIP_file_format" title="' . t('ZIP Information at wikipedia.org') . '">' . t('ZIP') . '</a>',
    '<a href="http://www.divx.com" title="' . t('Divx Homepage') . '">' . t('DIVX') . '</a>',
    '<a href="http://www.macromedia.com/go/getflashplayer" title="' . t('Macromedia Flash Homepage') . '">' . t('Flash FLV') . '</a>',
    '<a href="http://www.theora.org/theorafaq.html" title="' . t('Ogg Theora FAQ at theora.org') . '">' . t('Ogg Theora FAQ') . '</a>, <a href="http://en.wikipedia.org/wiki/Wikipedia:Media_help_(Ogg)" title="' . t('Ogg Theora media help at Wikipedia') . '">' . t('Ogg Theora help') . '</a>',
  );
  $output .= '<br /><div class="videodownload">';

  //Enclose all HTML in "videodownload" class.
  foreach ($node->file_array as $file) {

    //Goes through the array of video files and gets them ready for display.
    $file_type = str_replace($find, $replace, $file['type']);

    //Match and replace common file types.
    $link = l($file['file'], "node/{$node->nid}/multidownload/" . $file['encoded_url']);

    //Create link to download file.
    $file_array_table[] = array(
      $link,
      format_size($file['size']),
      $file_type,
    );

    //Create table row.
  }
  $headers = array(
    t('File Link'),
    t('File Size'),
    t('File Type'),
  );
  $output .= theme_table($headers, $file_array_table);

  //Create the table of files.
  $output .= '</div>';

  //Close the "videodownload" class.

  //Adds a breadcrumb back to view on the download page. This may not be needed but some better breadcrumbs are.
  $breadcrumb = drupal_get_breadcrumb();
  $breadcrumb[] = l(t('View'), "node/{$node->nid}");
  drupal_set_breadcrumb($breadcrumb);
  drupal_set_title(t('Downloading') . ' ' . theme('placeholder', $node->title));
  return theme("page", $output);
}