<?php
/************************************************************************/
/* PHP-NUKE: Top Music Most Voted Albums */
/* ===================================== */
/* */
/* 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 albums to show
$tmNumVotedAlbums=3;
//if you have changed the Top Music Module name, reflect it here:
$tmModuleName="topMusic";
//show covers? (0=no 1=yes)
$tmShowCover=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-TMMostVotedAlbums.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
//global $prefix, $db;
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/AlbumO.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/AlbumDAO.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/view/AlbumView.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();
$albumDAO=new AlbumDAO($db,$prefix);
$albumList=$albumDAO->getMostVotedAlbums($tmNumVotedAlbums);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\" align=\"center\">\n";
for($i=0;$i<count($albumList);$i++){
$album=$albumList[$i];
$title=$album->getTitle();
$idalbum=$album->getId();
$idartist=$album->getIdartist();
$artistname=$album->getArtistname();
if($TMEasyURL){
if(!$TMEasyURLType)
$tm_url="music.php/artist/".urlencode($album->getArtistname())."/album/".urlencode($title);
elseif($TMEasyURLType==1)
$tm_url="music.php/artist/".$idartist."/album/".$idalbum;
else
$tm_url="album".$idartist."_".$idalbum."-".urlencode($title).".html";
}else
$tm_url="modules.php?name=".$tmModuleName."&op=album&idartist=".$idartist."&idalbum=".$idalbum;
$content.="<tr><td align=\"center\"><a href=\"".$tm_url."\">";
if($tmShowCover){
if($album->getFrontCoverFile()!=""){
$frontcover_url=AlbumView::getCoverUrl($tmModuleName,$album,"Front");
$frontcover_thumburl=AlbumView::getCoverThumbUrl($tmModuleName,$album,"Front",110,0);
if($frontcover_thumburl!="")
$content.="<img src=\"".$frontcover_thumburl."\" title=\"".$title." - ".$artistname."\" border=\"0\">";
else
$content.="<img src=\"".$frontcover_url."\" title=\"".$title." - ".$artistname."\" border=\"0\" width=\"110\">";
}else
$content.="<img src=\"".$album->getFrontcoverUrl()."\" alt=\"".$title." - ".$artistname."\" border=\"0\" width=\"110\">";
}
if($tmShowCover && $tmShowText)
$content.="<br>";
if($tmShowText)
$content.=$title;
if($tmShowText && $tmShowStars)
$content.="<br>";
if($tmShowStars){
$genericView=new GenericView();
$avg=$album->getAvgvotes();
$theme=$tm_config->getTheme();
$stars=$genericView->getRateCode($avg,$tmModuleName,$theme);
$content.=$stars;
}
$content.="</a></td>";
$content.="</tr>";
$content.="<tr><td> </td></tr>";
}
$content.="</table>\n";
?>