<?php
/************************************************************************/
/* PHP-NUKE: Top Music Most Visited 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
$tmNumVisitedAlbums=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 hits? (0=no 1=yes)
$tmShowCount=1;
/***************************************************************/
//Don't touch this code please
if (eregi("block-TopMusic_Most_Visited_Albums.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
//global $prefix, $db;
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/common/Image.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();
$albumDAO=new AlbumDAO($db,$prefix);
$albumList=$albumDAO->getMostVisitedAlbums($tmNumVisitedAlbums);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\" align=\"center\">\n";
if(count($albumList)>0){
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()."\" title=\"".$title." - ".$artistname."\" border=\"0\" width=\"110\">";
}
if($tmShowCover && $tmShowText)
$content.="<br>";
if($tmShowText)
$content.=$title;
if($tmShowCount)
$content.=" (".$album->getCount().")";
$content."</a></td>";
$content.="</tr>";
$content.="<tr><td> </td></tr>";
}
} else {
$content.="<tr><td align=\"center\">"._TOPMUSIC_NOALBUMSLISTED."</td></tr>";
}
$content.="</table>\n";
?>