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

/************************************************************************/
/* PHP-NUKE: Top Music Most Visited Bands                                 */
/* =====================================                                 */
/*                                                                      */
/* 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
$tmNumVisitedBands=3;

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

//show photos? (0=no 1=yes)
$tmShowPhoto=1;
//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_Most_Visited_Bands.php",$_SERVER[PHP_SELF])) {
    Header("Location: ../index.php");
    die();
}

//global $prefix, $db;
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->getMostVisitedBands($tmNumVisitedBands);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\" align=\"center\">\n";

//echo "count=".count($bandList)."<br>";
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;
		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." (".$band->getBornyear().")\" border=\"0\">";
				else
					$content.="<img src=\"".$photo_url."\" title=\"".$title." (".$band->getBornyear().")\" border=\"0\" width=\"110\">";
			}elseif($band->getPhotoUrl()!="")
				$content.="<img src=\"modules/".$tmModuleName."/photos/".$band->getPhotoUrl()."\" title=\"".$title." (".$band->getBornyear().")\" border=\"0\" width=\"110\">";
			$content.="<br>";
		}
		if($tmShowText){
			if(!$tmShowPhoto)
				$content.=($i+1).".-</a></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