[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/audiofield/ -> audiofield_formatter.inc (source)

   1  <?php
   2  // $Id: audiofield_formatter.inc,v 1.22 2011/01/31 17:55:44 tamerzg Exp $:
   3  /**@file
   4   * Theme function for 'embedded' audio.
   5   */
   6  function theme_audiofield_formatter_audiofield_embedded($element) {
   7    global $user;
   8    //Don't render player if there is no file.
   9    if (!$element['#item']['filepath']) {
  10      return '';
  11    }
  12  
  13    $info = pathinfo($element['#item']['filename']);
  14    $op = $info['extension'];
  15    $audiofile=file_create_url($element['#item']['filepath']);
  16    $output= audiofield_get_player($audiofile, $op);
  17    
  18    if (!empty($element['#item']['data']['description'])) {
  19      $output .= '<div class="audio-description">' . $element['#item']['data']['description'].'</div>';
  20    }
  21    
  22    //If user is file owner check for download permission and display download link
  23    if ($user->uid==$element['#item']['uid'] && user_access('download own audio files')) {
  24      $output .= '<div class="audio-download"><b>Download:</b>' . theme('filefield_file', $element['#item']) . '</div>';
  25    }
  26    elseif (user_access('download all audio files')) {
  27      //If user has permission to download all audio files, then display download link
  28      $output .= '<div class="audio-download"><b>Download:</b>' . theme('filefield_file', $element['#item']) . '</div>';
  29    }
  30  
  31    return $output;
  32  }
  33  
  34  /** 
  35   * TODO:Theme function for popup audiofield field formatter. 
  36   */
  37   /*
  38  function theme_audiofield_formatter_audiofield_popup($element) {
  39    
  40    return $output;
  41  }
  42  */


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7