Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/blocks/block-TopMusic_Artist_Rank_Albums.php
<?php

/************************************************************************/
/* PHP-NUKE: Top Music Artist Rank Albums block                                  */
/* ====================================                                 */
/*                                                                      */
/* Copyright (c) 2004-2005 by Sergids                                  */
/* http://www.sergids.com                                                */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

/*****************/
/* configuration */
/*****************/
//number of bands to show in rank (0=unlimited)
$tmNumBands=10;

//if you have changed the Top Music Module name, reflect it here:
$tmModuleName="topMusic";

//show photos? (0=no 1=yes)
$tmShowPhoto=0;
//show text? (0=no 1=yes)
$tmShowText=1;
//show hits? (0=no 1=yes)
$tmShowCount=1;

/***************************************************************/
//Don't touch this code please


if (eregi("block-TopMusic_Artist_Rank_Albums.php", $_SERVER['PHP_SELF']))
{
    Header("Location: index.php");
    die();
}

require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ArtistDAO.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/view/ArtistView.php");
global $db,$prefix,$currentlang;

if(!is_object($tm_config)){
   require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ConfigDAO.php");
   require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ConfigO.php");
   $configDAO= new ConfigDAO($db,$prefix);
   $tm_config=$configDAO->load();
}
//use easy URL? (according to settings in Top Music module administration)
$TMEasyURL=$tm_config->getEasyURL();
//Eeasy URL Type (according to settings in Top Music module administration)
$TMEasyURLType=$tm_config->getEasyURLType();

$artistDAO=new ArtistDAO($db,$prefix);
$bandList=$artistDAO->getArtistRankAlbums($tmNumBands);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\" align=\"center\">\n";

if(count($bandList)>0){
	for($i=0;$i<count($bandList);$i++){
		$band=$bandList[$i];
		$idartist=$band->getId();
		$name=$band->getName();
	   if($TMEasyURL){
	      if(!$TMEasyURLType)
		     $tm_url="music.php/artist/".urlencode($band->getName());
	      elseif($TMEasyURLType==1)
		     $tm_url="music.php/artist/".$idartist;
	      else
		     $tm_url="artist".$idartist."-".urlencode($band->getName()).".html";

	   }else
		  $tm_url="modules.php?name=".$tmModuleName."&op=artist&idartist=".$idartist;
		if($tmShowPhoto)
			$tm_align="center";
		else
			$tm_align="left";

		$content.="<tr><td align=\"$tm_align\" valign=\"top\"><a href=\"".$tm_url."\">";

		if($tmShowPhoto){
			if($band->getPhotoFile()!=""){
				$photo_url=ArtistView::getPhotoUrl($band,$tmModuleName);
				$photo_thumburl=ArtistView::getPhotoThumbUrl($band,$tmModuleName,110,0);
				if($photo_thumburl!="")
					$content.="<img src=\"".$photo_thumburl."\" title=\"".$title."\" border=\"0\">";
				else
					$content.="<img src=\"".$photo_url."\" title=\"".$title."\" border=\"0\" width=\"110\">";
			}elseif($band->getPhotoUrl()!=""){
				$content.="<img src=\"modules/".$tmModuleName."/photos/".$band->getPhotoUrl()."\" title=\"".$title."\" border=\"0\" width=\"110\">";
			}
			$content.="<br>";
		}
		if($tmShowText){
			if(!$tmShowPhoto)
				$content.="</a>".($i+1).".-</td><td><a href=\"".$tm_url."\">";
			$content.=$name;
		}
		if($tmShowCount && !$tmShowPhoto)
			$content.=" </a></td><td>(".$band->getCount().")";
		elseif($tmShowCount)
			$content.="</a> (".$band->getCount().")<br><br>";
		else
			$content.="</a>";
		$content.="</td></tr>";
	}
} else {
	$content.="<tr><td align=\"center\">"._TOPMUSIC_NOBANDSLISTED."</td></tr>";
}

$content.="</table>\n";
?> 
Return current item: Top Music module