Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/blocks/block-TopMusic_Database.php
<?php

/************************************************************************/
/* PHP-NUKE: Top Music Database block                                  */
/* ====================================                                 */
/*                                                                      */
/* 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";

//show artist count? (0=no 1=yes)
$tmShowArtist=1;
//show album count? (0=no 1=yes)
$tmShowAlbum=1;
//show song count? (0=no 1=yes)
$tmShowSong=1;
//show genre count? (0=no 1=yes)
$tmShowGenre=1;
//show label count? (0=no 1=yes)
$tmShowLabel=1;
//show lyric count? (0=no 1=yes)
$tmShowLyric=0;
//show ranks count? (0=no 1=yes)
$tmShowRanks=1;

/***************************************************************/
//Don't touch this code please


if (eregi("block-TopMusic_Database.php", $_SERVER['PHP_SELF']))
{
    Header("Location: index.php");
    die();
}

global $db,$prefix,$currentlang;

function getTotal($getTotal){
   global $db,$prefix;
   $sSql="   SELECT
           *
         FROM
           ".$prefix."_topmusic_".$getTotal."";
//   echo "sql=".$sSql."<br>";
   $stmt=$db->sql_query($sSql);
   $total_found = mysql_numrows($stmt);
   $db->sql_freeresult($stmt);
   return $total_found;
}

$content="<table align=\"center\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\">\n";
if($tmShowArtist==1 && getTotal('artist')>-1) {
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_ARTISTS.":</td><td align=\"right\"><b>".getTotal('artist')."</b></td></tr>";   
}else{
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_ARTISTS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
}
if($tmShowAlbum==1 && getTotal('album')>-1) {
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_ALBUMS.":</td><td align=\"right\"><b>".getTotal('album')."</b></td></tr>";   
}else{
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_ALBUMS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
}
if($tmShowSong==1 && getTotal('song')>-1) {
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_SONGS.":</td><td align=\"right\"><b>".getTotal('song')."</b></td></tr>";   
}else{
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_SONGS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
}
if($tmShowGenre==1 && getTotal('genre')>-1) {
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_GENRES.":</td><td align=\"right\"><b>".getTotal('genre')."</b></td></tr>";   
}else{
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_GENRES.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
}
if($tmShowLabel==1 && getTotal('label')>-1) {
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_LABELS.":</td><td align=\"right\"><b>".getTotal('label')."</b></td></tr>";   
}else{
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_LABELS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
}
if($tmShowLyric==1 && getTotal('lyric')>-1) {
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_LYRICS.":</td><td align=\"right\"><b>".getTotal('lyric')."</b></td></tr>";   
}else{
	$content.="<tr><td valign=\"top\">"._TOPMUSIC_LYRICS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
}

if($tmShowRanks==1) {
	$content.="<tr><td colspan=\"2\" align=\"center\" valign=\"top\"><b>&nbsp;"._TOPMUSIC_RANKS."&nbsp;</b></td></tr>";
	if(getTotal('artist_votes')>-1) {
		$content.="<tr><td valign=\"top\">"._TOPMUSIC_ARTISTS.":</td><td align=\"right\"><b>".getTotal('artist_votes')."</b></td></tr>";   
	}else{
		$content.="<tr><td valign=\"top\">"._TOPMUSIC_ARTISTS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
	}
	if(getTotal('album_votes')>-1) {
		$content.="<tr><td valign=\"top\">"._TOPMUSIC_ALBUMS.":</td><td align=\"right\"><b>".getTotal('album_votes')."</b></td></tr>";   
	}else{
		$content.="<tr><td valign=\"top\">"._TOPMUSIC_ALBUMS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
	}
	if(getTotal('song_votes')>-1) {
		$content.="<tr><td valign=\"top\">"._TOPMUSIC_SONGS.":</td><td align=\"right\"><b>".getTotal('song_votes')."</b></td></tr>";   
	}else{
		$content.="<tr><td valign=\"top\">"._TOPMUSIC_SONGS.":</td><td align=\"right\"><b>"._TOPMUSIC_NA."</b></td></tr>";
	}
}

$content.="</table>\n";
?> 
Return current item: Top Music module