Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/lib/com/sergids/topmusic/view/AlbumView.php
<?php
require_once("modules/topMusic/lib/com/sergids/topmusic/view/GenericView.php");
require_once("modules/topMusic/lib/com/sergids/common/Image.php");
class AlbumView{
	function getSonglistUrl($module_name,$config,$album){
		if(!$config->getEasyURL())
           	$songlist_url="modules.php?name=".$module_name."&op=songlist&idartist=".$album->idartist."&idalbum=".$album->id;
        elseif($config->getEasyURLType()==2)
           	$songlist_url="songlist".$album->idartist."_".$album->id.".html";
        elseif(!$config->getEasyURLType())
           	$songlist_url="music.php/artist/".urlencode($album->artistname)."/album/".urlencode($album->title)."/songList";
        else
          	$songlist_url="music.php/artist/".$album->getIdartist()."/album/".$album->getId()."/songList";
        return $songlist_url;
	}
	function getAlbumUrl($module_name,$config,$album){
		if(!$config->getEasyURL())
           	$album_url="modules.php?name=".$module_name."&op=album&idartist=".$album->getIdartist()."&idalbum=".$album->getId();
        elseif($config->getEasyURLType()==2)
           	$album_url="album".$album->getIdartist()."_".$album->getId().".html";
        elseif(!$config->getEasyURLType())
           	$album_url="music.php/artist/".urlencode($album->getArtistname())."/album/".urlencode($album->getTitle());
        else
          	$album_url="music.php/artist/".$album->getIdartist()."/album/".$album->getId();
        return "<a href=\"".$album_url."\">";
	}
	function setRatesCode($albumlist,$module_name,$theme){
    	if(count($albumlist)){
	    	foreach($albumlist as $album){
	    		$avg=$album->getAvgvotes();
	    		$rate_code=GenericView::getRateCode(round($avg,1),$module_name,$theme);
	    		$album->setAvgvotes($rate_code);
	    		$albumlist2[]=$album;
	    	}
    	}
    	return $albumlist2;
    }
    function getCoverUrl($module_name,$album,$which){
		if($album->{$which."cover_file"}!="")
			$cover_url="modules/$module_name/photos/albums/".$album->{$which."cover_file"};
		else
			$cover_url=$album->{$which."cover_url"};
        return $cover_url;
	}
	function getCoverThumbUrl($module_name,$album,$which,$width,$height){
    	if($album->{$which."coverFile"}!=""){
    		$url_cover="modules/$module_name/photos/albums/".$album->{"get".$which."coverFile"}();
    		if($thumb=Image::createThumbnail($url_cover,$width,$height))
				$url_cover=$thumb;
			else
				$url_cover=null;
    	}else
    		$url_cover=null;
		return $url_cover;
	}
	function getShopUrl($album){
		if(substr($album->shopurl,0,7)=="http://"){
			return $album->shopurl;
		}elseif($album->shopurl!=""){
			return "http://www.amazon.com/gp/product/".$album->shopurl."?ie=UTF8&tag=sergidscom02-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=".$album->shopurl;
		}else
			return null;
	
	}
	function parseThumbs($module_name,&$albumList,$width,$height){
		for($i=0;count($albumList)>$i;$i++){
			$thumb_front=AlbumView::getCoverThumbUrl($module_name,$albumList[$i],"front",$width,$height);
			if($thumb_front!="")
				$albumList[$i]->frontcover_thumbfile=$thumb_front;
			$thumb_back=AlbumView::getCoverThumbUrl($module_name,$albumList[$i],"back",$width,$height);
			if($thumb_back!="")
				$albumList[$i]->backcover_thumbfile=$thumb_back;
		}
	}
}

?>
Return current item: Top Music module