<?php
require_once("modules/topMusic/lib/com/sergids/topmusic/view/GenericView.php");
class SongView{
function setRatesCode($songlist,$module_name,$theme){
if(count($songlist)){
foreach($songlist as $song){
$avg=$song->getAvgvotes();
$rate_code=GenericView::getRateCode(round($avg,1),$module_name,$theme);
$song->setAvgvotes($rate_code);
$songlist2[]=$song;
}
}
return $songlist2;
}
function getCoverUrl($module_name,$song){
if($song->getAlbumcoverFile()!=""){
$cover_url="modules/$module_name/photos/albums/".$song->getAlbumcoverFile();
}else
$cover_url=$song->getAlbumcoverUrl();
return $cover_url;
}
function getCoverThumbUrl($module_name,$song,$width,$height){
if($song->getAlbumcoverFile()!=""){
$url_cover="modules/$module_name/photos/albums/".$song->getAlbumcoverFile();
if($thumb=Image::createThumbnail($url_cover,$width,$height))
$url_cover=$thumb;
else
$url_cover=null;
}else
$url_cover=null;
return $url_cover;
}
}
?>