Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/blocks/block-TMGenres.php
<?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-TMGenres.php",$_SERVER[PHP_SELF])) {
    Header("Location: ../index.php");
    die();
}

//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";
$content.="<tr><td colspan=\"3\">&nbsp;</td></tr>\n";
if(count($genreList)>0){
	foreach($genreList as $id_genre => $name_genre){
		$content.="<tr><td>&nbsp;</td><td><a href=\"#\" onClick=\"searchTMGenre(".$id_genre.")\">".$name_genre."</a></td><td>&nbsp;</td>";
		$content.="</tr>\n";
	}
}else{
	$content.="<tr><td>&nbsp;</td><td>No genres listed</td><td>&nbsp;</td></tr>";
}
$content.="<tr><td colspan=\"3\">&nbsp;</td></tr>";
$content.="</form>";
$content.="</table>\n";
?>
Return current item: Top Music module