You are here

function theme_asset_bonus_mp3player in Asset 6

Same name in this branch
  1. 6 asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
  2. 6 contrib/asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
Same name and namespace in other branches
  1. 5.2 contrib/asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
  2. 5 asset_bonus/asset_bonus.module \theme_asset_bonus_mp3player()
2 theme calls to theme_asset_bonus_mp3player()
asset_bonus_mp3player_preview in contrib/asset_bonus/asset_bonus.module
asset_bonus_mp3player_preview in asset_bonus/asset_bonus.module

File

asset_bonus/asset_bonus.module, line 332

Code

function theme_asset_bonus_mp3player($asset, $options = array()) {

  // We're not using drupal_add_js(drupal_get_path('module','asset_bonus') . '/3rdparty/swfobject/swfobject.js') because of caching issues
  // We're not using drupal_add_js(drupal_get_path('module','asset_bonus') . '/3rdparty/audioplayer/audio-player.js') because of caching issues
  $swfobject = base_path() . drupal_get_path('module', 'asset_bonus') . '/3rdparty/swfobject/swfobject.js';
  $audobject = base_path() . drupal_get_path('module', 'asset_bonus') . '/3rdparty/audioplayer/audio-player.js';
  $swffile = base_path() . drupal_get_path('module', 'asset_bonus') . '/3rdparty/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}');";
    }
  }
  $output = <<<OUT
\t<script type="text/javascript" src="{<span class="php-variable">$swfobject</span>}"></script>
\t<script type="text/javascript" src="{<span class="php-variable">$audobject</span>}"></script>
\t<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>
\t<script type="text/javascript" defer="defer">
\tvar 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>}","290","24","7","#FFFFFF");
\toSwf.addVariable('playerID','{<span class="php-variable">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">aid</span>}');
\toSwf.addVariable('soundFile','{<span class="php-variable">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">url</span>}');
\t{<span class="php-variable">$colorvars</span>}
\toSwf.addParam('wmode','transparent');
\toSwf.addParam('menu','false');
\toSwf.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;
}