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

contrib/asset_bonus/asset_bonus.module, line 328

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 = '/' . 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}');";
    }
  }
  $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">$asset</span>-&gt;<span class="php-function-or-constant property member-of-variable">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;
}