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

/************************************************************************/
/* PHP-NUKE: Top Music Artist Rank 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=0;

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

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

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

require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ArtistDAO.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 config.php in module directory)
$TMEasyURL=$tm_config->getEasyURL();
//EasyURL type (URL content)
$TMEasyURLType=$tm_config->getEasyURLType();


$artistDAO=new ArtistDAO($db,$prefix);

$content="<table cellspacing=\"4\" cellpadding=\"0\" border=\"0\" width=\"100%\" align=\"center\">\n";
$content.="<tr>";
$content.="<td align=\"center\" valign=\"top\">";
//albums
$content.="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\">\n";
$content.="<tr><td colspan=\"2\" align=\"center\"><b>"._TOPMUSIC_ALBUMS."</b></td></tr>";
$bandList=$artistDAO->getArtistRankAlbums($tmNumBands);
if(count($bandList)>0){
	for($i=0;$i<count($bandList);$i++){
		$band=$bandList[$i];
		$name=$band->getName();
		$idartist=$band->getId();
		if($TMEasyURL){
			if(!$TMEasyURLType)
				$tm_url="music.php/artist/".urlencode($name);
			elseif($TMEasyURLType==1)
				$tm_url="music.php/artist/".$idartist;
			else
				$tm_url="artist".$idartist."-".urlencode($name).".html";
		}else
			$tm_url="modules.php?name=".$tmModuleName."&op=artist&idartist=".$idartist;
		$content.="<tr><td valign=\"top\">".($i+1).".-</td><td><a href=\"".$tm_url."\">".$name."</a></td>";
		$content.="<td> (".$band->getCount().") </td>";
		$content.="</tr>";	
	}
} else {
	$content.="<tr><td align=\"center\">"._TOPMUSIC_NOBANDSLISTED."</td></tr>";
}
$content.="</table>\n";
//end albums
$content.="</td>";
$content.="<td width=\"1\" bgcolor=\"#000000\"></td>";
$content.="<td align=\"center\" valign=\"top\">";
//songs
$content.="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\">\n";
$content.="<tr><td colspan=\"2\" align=\"center\"><b>"._TOPMUSIC_SONGS."</b></td></tr>";
$bandList=$artistDAO->getArtistRankSongs($tmNumBands);
if(count($bandList)>0){
	for($i=0;$i<count($bandList);$i++){
		$band=$bandList[$i];
		$name=$band->getName();
		$idartist=$band->getId();
		if($TMEasyURL){
			if(!$TMEasyURLType)
				$tm_url="music.php/artist/".urlencode($name);
			elseif($TMEasyURLType==1)
				$tm_url="music.php/artist/".$idartist;
			else
				$tm_url="artist".$idartist."-".urlencode($name).".html";
		}else
			$tm_url="modules.php?name=".$tmModuleName."&op=artist&idartist=".$idartist;
		$content.="<tr><td valign=\"top\">".($i+1).".-</td><td><a href=\"".$tm_url."\">".$name."</a></td>";
		$content.="<td> (".$band->getCount().") </td>";
		$content.="</tr>";	
	}
} else {
	$content.="<tr><td align=\"center\">"._TOPMUSIC_NOBANDSLISTED."</td></tr>";
}
$content.="</table>\n";
//end songs

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