This CodeLet creates a floating bar at the bottom edge of the browser. The CodeLet specifically created for music player over the floating bar in the same manner as MySpace.
<?php
/**
* @file
*
* Display a floating music player
* @author DrupalD
*/
/**
* Implementation of hook_init
*
* @return unknown_type
* @author DrupalD
*/
function music_player_init() {
drupal_add_css(drupal_get_path("module", 'music_player') ."/music_player.css");
drupal_add_js(drupal_get_path("module", 'music_player') ."/music_player.js");
}
/**
* Implementation of hook_theme
*
* @param unknown_type $existing
* @param unknown_type $type
* @param unknown_type $theme
* @param unknown_type $path
* @return unknown_type
* @author DrupalD
*/
function music_player_theme($existing, $type, $theme, $path) {
return array(
'music_player' => array(
'arguments' => array(),
),
);
}
/**
* theme_music_player
*
* @return unknown_type
* @author DrupalD
*/
function theme_music_player() {
$form = array(
'#type' => "select",
'#title' => t("Playlist"),
'#multiple' => TRUE,
'#size' => 3,
'#options' => get_playlist(),
'#attributes' => array('class' => 'playlist'),
);
$ss__playlist = drupal_render(form_builder($form_id, $form, $form_status));
return
'
'. $ss__playlist .'
';
}
/**
* Implementation of hook_footer
* @param $main
* @return unknown_type
* @author DrupalD
*/
function music_player_footer($main = 0) {
global $user;
if (in_array('Fan', $user->roles) || in_array('admin', $user->roles) || $user->uid == 1) {
return theme('music_player');
}
}
/**
* get_playlist
*
* @author DrupalD
*/
function get_playlist() {
$r__result = db_query("SELECT title, nid FROM {node} WHERE type = 'myPlaylist' AND status = 1");
while($om__result = db_fetch_object($r__result)) {
$am__playlist[$om__result->nid] = $om__result->title;
}
return $am__playlist;
}
?>