00001 <?php
00002
00003 function getHtmlSong($id, $artistName, $albumName, $trackNum, $trackName, $trackLength, $numPlays, $genre, $rating)
00004 {
00005 static $alt = true;
00006 $alt = !$alt;
00007 $output = '<li'.($alt ? ' class="alt"' : '').
00008 ' ondblclick="pladd(\'song\','.$id.'); return false;">
00009 <a class="music" href="#"
00010 onclick="pladd(\'song\','.$id.'); return false;"
00011 title="'.t('Add Song to Current Playlist').'">
00012 <img src="'.pic_dir().'add.gif" /></a>
00013 <a class="music" href="#"
00014 onclick="play(\'song\','.$id.'); return false;"
00015 title="'.t('Play this Song Now').'">
00016 <img src="'.pic_dir().'play.gif" /></a> ';
00017
00018 if (!empty($artistName))
00019 $output .= (!empty($trackNum) ? $trackNum.'. ' : '').'<em>'.$artistName.'</em> - ';
00020
00021 $output .= $trackName;
00022
00023 $sub_output = '';
00024
00025 if (!empty($albumName))
00026 $sub_output .= sprintf(t('Track #%s from the album \'%s\''), $trackNum, $albumName).'<br>';
00027
00028 if (!empty($numPlays))
00029 {
00030 if (1 == $numPlays)
00031 $sub_output .= t('Played once').'<br>';
00032 else
00033 $sub_output .= sprintf(t('Played %s times'), $numPlays).'<br>';
00034 }
00035
00036 if (!empty($trackLength))
00037 $sub_output .= $trackLength.'<br>';
00038
00039 if(!empty($genre))
00040 $sub_output .= t('Genre').': '.$genre.'<br>';
00041
00042 if(!empty($rating))
00043 $sub_output .= t('Rating').': '.$rating.'<br>';
00044
00045 if (!empty($sub_output))
00046 {
00047 $output .= '<p>'.$sub_output.'</p>';
00048 }
00049
00050 $output .= '</li>';
00051 return $output;
00052 }
00053
00054
00055 function getHtmlAlbum($id, $albumName, $artistName='', $year='', $numTracks='', $length='', $extra='')
00056 {
00057 static $alt = true;
00058 $alt = !$alt;
00059 $output = '<li'.($alt ? ' class="alt"' : '').'>';
00060
00061 if (!empty($extra))
00062 $output .= '<small>'.$extra.'</small>';
00063
00064 $output .= '<a class="music" href="#"
00065 onclick="pladd(\'album\','.$id.'); return false;"
00066 title="'.t('Add Album to Current Playlist').'">
00067 <img src="'.pic_dir().'add.gif" /></a>
00068 <a class="music" href="#"
00069 onclick="play(\'album\','.$id.'); return false;"
00070 title="'.t('Play this Album Now').'">
00071 <img src="'.pic_dir().'play.gif" /></a>
00072 <a class="music" href="#"
00073 onclick="updateBox(\'album\','.$id.'); return false;"
00074 title="'.sprintf(t('View Details of %s'), $albumName).'">'.
00075 $albumName;
00076
00077 if (!empty($artistName))
00078 $output .= ' — <em>'.$artistName.'</em>';
00079
00080 $output .= '</a>';
00081
00082 $sub_output = '';
00083
00084 if (!empty($year))
00085 $sub_output .= t('Year').': '.$year.'<br>';
00086
00087 if (!empty($numTracks))
00088 $sub_output .= t('# Tracks').': '.$numTracks.'<br>';
00089
00090 if (!empty($length))
00091 $sub_output .= t('Total Length').': '.$length.'<br>';
00092
00093 if (!empty($sub_output))
00094 $output .= '<p>'.$sub_output.'</p>';
00095
00096 $output .= '</li>';
00097 return $output;
00098 }
00099
00100
00101 function getHtmlPlaylist($playlistId, $playlistName, $songcount, $length, $unsavedId = 0, $blnShowDelete = true)
00102 {
00103 return '<li>
00104 <a class="music" href="#"
00105 onclick="pladd(\'playlist\','.$playlistId.'); return false;"
00106 title="'.t('Add this Playlist as a Subplaylist').'">
00107 <img src="'.pic_dir().'add.gif" /></a>
00108 <a class="music" href="#"
00109 onclick="checkPlaylistLoad(\''.$playlistId.'\', '.$unsavedId.')'.
00110 ' && pladd(\'loadplaylist\','.$playlistId.'); return false;"
00111 title="'.t('Load this Saved Playlist').'">
00112 <img src="'.pic_dir().'add.gif" /></a>
00113 <a class="music" href="#"
00114 onclick="play(\'pl\','.$playlistId.'); return false;"
00115 title="'.t('Play this Playlist Now').'">
00116 <img src="'.pic_dir().'play.gif" /></a> '.
00117 ($blnShowDelete ? '<a class="music" href="#"
00118 onclick="deletePlaylist('.$playlistId.'); return false;"
00119 title="'.t('DELETE this Saved Playlist').'">
00120 <img src="'.pic_dir().'rem.gif" /></a> ' : '').
00121 '<a class="music" href="#"
00122 onclick="updateBox(\'saved_pl\','.$playlistId.'); return false;"
00123 title="'.t('Click to View Playlist').'"><em>'.
00124 $playlistName.
00125 '</em> - '.sprintf(t('%s Songs'), $songcount).' ('.$length.')'.
00126 '</a></li>';
00127 }
00128
00129 function getHtmlPlaylistEntry($id, $contents)
00130 {
00131 return '<li id="pl'.$id.'"
00132 onmouseover="setBgcolor(\'pl'.$id.'\',\'#FCF7A5\');"
00133 onmouseout="setBgcolor(\'pl'.$id.'\',\'#F3F3F3\');">
00134 <a class="music" href="#"
00135 onclick="movePLItem(\'up\',this.parentNode); return false;"
00136 title="'.t('Move Item Up in Playlist').'">
00137 <img src="'.pic_dir().'up.gif" /></a>
00138 <a class="music" href="#"
00139 onclick="movePLItem(\'down\',this.parentNode); return false;"
00140 title="'.t('Move Item Down in Playlist').'">
00141 <img src="'.pic_dir().'down.gif" /></a>
00142 <a class="music" href="#"
00143 onclick="plrem(this.parentNode); return false;"
00144 title="'.t('Remove Item from Playlist').'">
00145 <img src="'.pic_dir().'rem.gif" /></a> '.
00146 $contents.
00147 '</li>';
00148 }
00149
00150 function getHtmlPlaylistEntrySong($id, $artistName, $albumName, $trackNum, $trackName, $trackLength)
00151 {
00152 return getHtmlPlaylistEntry($id,
00153 '<em>'.$artistName.'</em> - '.$trackName.
00154 '<p>'.sprintf(t('Track #%s from the album \'%s\''), $trackNum, $albumName).
00155 '<br>'.$trackLength.'</p>');
00156 }
00157
00158 function getHtmlPlaylistEntryPlaylist($id, $playlistName, $playlistSongCount, $playlistTotalTime)
00159 {
00160 return getHtmlPlaylistEntry($id,
00161 sprintf(t('Playlist: %s'), '<em>'.$playlistName.'</em>').
00162 '<p>'.sprintf(t('%s Songs'), $playlistSongCount).
00163 '<br>'.sprintf(t('Total Time: %s'), $playlistTotalTime).'</p>');
00164 }
00165
00166 ?>