You are here

function theme_asset_bonus_mp3player in Asset 5.2

Same name and namespace in other branches
  1. 5 asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
  2. 6 asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
  3. 6 contrib/asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
1 theme call to theme_asset_bonus_mp3player()
asset_bonus_mp3player_preview in contrib/asset_bonus/asset_bonus.module

File

contrib/asset_bonus/asset_bonus.module, line 342

Code

function theme_asset_bonus_mp3player($asset, $options = array()) {
  drupal_add_js(drupal_get_path('module', 'asset_bonus') . '/swfobject/swfobject.js');
  drupal_add_js(drupal_get_path('module', 'asset_bonus') . '/audioplayer/audio-player.js');
  $swffile = base_path() . drupal_get_path('module', 'asset_bonus') . '/audioplayer/player.swf';
  $colors = asset_bonus_mp3player_colors();
  foreach ($colors as $key => $color_data) {
    $color = variable_get('asset_bonus_mp3player_' . $key, $color_data['default']);
    if ($color) {
      $color = str_replace('#', '0x', $color);
      $colorvars .= "oSwf.addVariable('{$key}','{$color}');";
    }
  }
  $file_url = file_create_url($asset->file['filepath']);
  $output = <<<OUT
  <div id="mp3player-{<span class="php-variable">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">aid</span>}" class="asset-swfobject">Audio placeholder</div>
  <script type="text/javascript">
    var oSwf = new SWFObject("{<span class="php-variable">$swffile</span>}","mp3player-object-{<span class="php-variable">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">aid</span>}","190","24","7","#FFFFFF");
    oSwf.addVariable('playerID','{<span class="php-variable">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">aid</span>}');
    oSwf.addVariable('soundFile','{<span class="php-variable">$file_url</span>}');
    {<span class="php-variable">$colorvars</span>}
    oSwf.addParam('wmode','transparent');
    oSwf.addParam('menu','false');
    oSwf.write("mp3player-{<span class="php-variable">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">aid</span>}");
    oSwf = null;
  </script>
OUT;
  return $output;
}