<?php
/************************************************************************/
/* PHP-NUKE: Top Music Genres */
/* ======================================= */
/* */
/* 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 */
/*****************/
//if you have changed the Top Music Module name, reflect it here:
$tmModuleName="topMusic";
//what do you want to show on genres click? albums, songs, artists
$tmWhat="artists";
/***************************************************************/
//Don't touch this code please
if (eregi("block-TopMusic_Genres.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
global $currentlang;
if(file_exists("modules/".$tmModuleName."/language/lang-".$currentlang.".php")) {
require_once("modules/".$tmModuleName."/language/lang-".$currentlang.".php");
} else {
require_once("modules/".$tmModuleName."/language/lang-english.php");
}
//global $prefix, $db;
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/GenreDAO.php");
global $db,$prefix,$currentlang;
$genreDAO=new GenreDAO($db,$prefix);
$genreList=$genreDAO->getActiveGenreList($tmWhat,$currentlang);
$content="<script>
function searchTMGenre(id_genre){
var tmsearch=document.getElementById('TMSearchGenre');
tmsearch.what.value='".$tmWhat."';
tmsearch.genre.value=id_genre;
tmsearch.submit();
}
</script>
";
$content.="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\">\n";
$content.="<form name=\"TMSearch\" id=\"TMSearchGenre\" action=\"modules.php?name=".$tmModuleName."&op=search&hide=1\" method=\"post\">\n";
$content.="<input type=\"hidden\" name=\"genre\">\n";
$content.="<input type=\"hidden\" name=\"what\">\n";
if(count($genreList)>0){
$content.="<tr><td colspan=\"3\"> </td></tr>\n";
foreach($genreList as $id_genre => $name_genre){
$content.="<tr><td> </td><td><a href=\"#\" onClick=\"searchTMGenre(".$id_genre.")\">".$name_genre."</a></td><td> </td>";
$content.="</tr>\n";
}
$content.="<tr><td colspan=\"3\"> </td></tr>";
}else{
$content.="<tr><td align=\"center\">"._TOPMUSIC_NOGENRESLISTED."</td></tr>";
}
$content.="</form>";
$content.="</table>\n";
?>