<?php
/************************************************************************/
/* PHP-NUKE: Top Music Most Voted Songs */
/* ==================================== */
/* */
/* 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 songs to show
$tmNumVotedSongs=3;
//if you have changed the Top Music Module name, reflect it here:
$tmModuleName="topMusic";
//show album covers? (0=no 1=yes)
$tmShowCover=1;
$tmPhotoWidth = 110;
//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-TMMostVotedSongs.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/SongDAO.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");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/view/GenericView.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/view/SongView.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();
$songDAO=new SongDAO($db,$prefix);
$songList=$songDAO->getMostVotedSongs($tmNumVotedSongs);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\">\n";
for($i=0;$i<count($songList);$i++){
$song=$songList[$i];
$title=$song->getTitle();
$idsong=$song->getId();
$idartist=$song->getIdartist();
$idalbum=$song->getIdalbum();
if($TMEasyURL){
if(!$TMEasyURLType)
$tm_url="music.php/artist/".urlencode($song->getArtistname())."/album/".urlencode($song->getAlbumname())."/song/".urlencode($title);
elseif($TMEasyURLType==1)
$tm_url="music.php/artist/".$idartist."/album/".$idalbum."/song/".$idsong;
else
$tm_url="song".$idartist."_".$idalbum."_".$idsong."-".urlencode($title).".html";
}else
$tm_url="modules.php?name=".$tmModuleName."&op=song&idartist=".$idartist."&idalbum=".$idalbum."&idsong=".$idsong;
$content.="<tr><td align=\"center\"><a href=\"".$tm_url."\">";
if($tmShowCover){
if($song->getAlbumcoverFile()!=""){
$frontcover_url=SongView::getCoverUrl($tmModuleName,$song);
$frontcover_thumburl=SongView::getCoverThumbUrl($tmModuleName,$song,$tmPhotoWidth,0);
if($frontcover_thumburl!="")
$content.="<img src=\"".$frontcover_thumburl."\" title=\"".$title." - ".$song->getArtistname()."\" border=\"0\">";
else
$content.="<img src=\"".$frontcover_url."\" title=\"".$title." - ".$song->getArtistname()."\" border=\"0\" width=\"".$tmPhotoWidth."\">";
}else
$content.="<img src=\"".$song->getAlbumcoverUrl()."\" title=\"".$title." - ".$song->getArtistname()."\" border=\"0\" width=\"".$tmPhotoWidth."\">";
}
if($tmShowCover && $tmShowText)
$content.="<br>";
if($tmShowText)
$content.=$title;
if($tmShowText && $tmShowStars)
$content.="<br>";
if($tmShowStars){
$genericView=new GenericView();
$avg=$song->getAvgvotes();
$tmTheme=$tm_config->getTheme();
$stars=$genericView->getRateCode($avg,$tmModuleName,$tmTheme);
$content.=$stars."</a>";
}else
$content.="</a> (".round($song->getAvgvotes(),1).")";
$content.="</td>";
$content.="</tr>";
$content.="<tr><td> </td></tr>";
}
$content.="</table>\n";
?>