<?php
/************************************************************************/
/* PHP-NUKE: Top Music Most Voted 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
$tmNumVotedBands=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 stars? (0=no 1=yes)
$tmShowStars=1;
/***************************************************************/
//Don't touch this code please
if (eregi("block-TMMostVotedBands.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ArtistO.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ArtistDAO.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/view/ArtistView.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/view/GenericView.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);
$artistList=$artistDAO->getMostVotedArtists($tmNumVotedBands);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\" align=\"center\">\n";
for($i=0;$i<count($artistList);$i++){
$artistBlock=$artistList[$i];
$artistnameBlock=$artistBlock->getName();
$idartist=$artistBlock->getId();
if($TMEasyURL){
if(!$TMEasyURLType)
$tm_url="music.php/artist/".urlencode($artistnameBlock);
elseif($TMEasyURLType==1)
$tm_url="music.php/artist/".$idartist;
else
$tm_url="artist".$idartist."-".urlencode($artistnameBlock).".html";
}else
$tm_url="modules.php?name=".$tmModuleName."&op=artist&idartist=".$idartist;
$content.="<tr><td valign=\"top\" align=\"center\"><a href=\"".$tm_url."\">";
if($tmShowPhoto){
if($artistBlock->getPhotoFile()!=""){
$photo_url=ArtistView::getPhotoUrl($artistBlock,$tmModuleName);
$photo_thumburl=ArtistView::getPhotoThumbUrl($artistBlock,$tmModuleName,110,0);
if($photo_thumburl!="")
$content.="<img src=\"".$photo_thumburl."\" title=\"".$artistnameBlock." (".$artistBlock->getBornyear().")\" border=\"0\">";
else
$content.="<img src=\"".$photo_url."\" title=\"".$artistnameBlock." (".$artistBlock->getBornyear().")\" border=\"0\" width=\"110\">";
}elseif($artistBlock->getPhotoUrl()!="")
$content.="<img src=\"".$artistBlock->getPhotoUrl()."\" alt=\"".$artistnameBlock." (".$artistBlock->getBornyear().")\" border=\"0\" width=\"110\">";
else
$content.="<img src=\"modules/".$tmModuleName."/photos/compilation.jpg\" alt=\"".$artistnameBlock." (".$artistBlock->getBornyear().")\" border=\"0\" width=\"110\">";
}
if($tmShowPhoto && $tmShowText)
$content.="<br>";
if($tmShowText)
$content.=$artistnameBlock;
if($tmShowText && $tmShowStars)
$content.="<br>";
if($tmShowStars){
$avg=$artistBlock->getAvgvotes();
$tmTheme=$tm_config->getTheme();
$stars=GenericView::getRateCode($avg,$tmModuleName,$tmTheme);
$content.=$stars;
}
$content.="</a></td>";
$content.="</tr>";
$content.="<tr><td> </td></tr>";
}
$content.="</table>\n";
?>