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

/************************************************************************/
/* PHP-NUKE: Top Music Menu 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.       */
/************************************************************************/

//change this variable if you have changed Top Music module name
$TMMenu_modulename="topMusic";


/**************************************/
//don't change this code

global $db,$prefix,$currentlang;

if(!is_object($tm_config)){
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/ConfigDAO.php");
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/ConfigO.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();

$getArtist=$_GET['idartist'];
$getAlbum=$_GET['idalbum'];

$getSong=$_GET['idsong'];
$tm_action=$_GET['op'];
if($getArtist!=""){
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/ArtistDAO.php");	
	$artistDAOB=new ArtistDAO($db,$prefix);
	$artistOB=$artistDAOB->getArtist($getArtist,$currentlang);
}else{
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/ArtistO.php");
	$artistOB=new ArtistO();
}
if($getAlbum!=""){
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/AlbumDAO.php");	
	$albumDAOB=new AlbumDAO($db,$prefix);
	$albumOB=$albumDAOB->getAlbum($getAlbum,$currentlang);
}else{
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/AlbumO.php");
	$albumOB=new AlbumO();
}
if($getSong!=""){
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/SongDAO.php");	
	$songDAOB=new SongDAO($db,$prefix);
	$songOB=$songDAOB->getSong($getSong,$currentlang);
}else{
	require_once("modules/".$TMMenu_modulename."/lib/com/sergids/topmusic/model/SongO.php");
	$songOB=new SongO();
}
if(file_exists("modules/".$TMMenu_modulename."/language/lang-".$currentlang.".php")) {
	require_once("modules/".$TMMenu_modulename."/language/lang-".$currentlang.".php");
} else {
	require_once("modules/".$TMMenu_modulename."/language/lang-english.php");
}

$content="	<table border=\"0\">\n
	<tr>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n";
if($tm_action!="ranking"){
	$content.="
		  <tr>\n
		    <td>::</td>\n";
	if($TMEasyURL){
	//die($TMEasyURLType);
		if($TMEasyURLType!=2)
			$content.="<td><a href=\"music.php/ranking\">"._TOPMUSIC_RANKING."</a></td>\n";
		else
			$content.="<td><a href=\"tops.html\">"._TOPMUSIC_RANKING."</a></td>\n";
	}else
		$content.="<td><a href=\"modules.php?name=topMusic&op=ranking\">"._TOPMUSIC_RANKING."</a></td>\n";
	$content.="<td>&nbsp;</td>\n
		  </tr>\n";
}else{
	$content.="
	  <tr>\n
	    <td><b>::</b></td>\n
	    <td>"._TOPMUSIC_RANKING."</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n";	
}
if($tm_action!="search"){
	$content.="
		  <tr>\n
		    <td>::</td>\n";
	if(!$TMEasyURL)
		$content.="<td><a href=\"modules.php?name=topMusic&op=search\">"._TOPMUSIC_SEARCH."</a></td>\n";
	elseif(!$TMEasyURLType){
		$content.="<td><a href=\"music.php/search\">"._TOPMUSIC_SEARCH."</a></td>\n";
	}else
		$content.="<td><a href=\"search.html\">"._TOPMUSIC_SEARCH."</a></td>\n";
			
	$content.="<td>&nbsp;</td>\n
		  </tr>\n";
}else{
	$content.="
	  <tr>\n
	    <td><b>::</b></td>\n
	    <td>"._TOPMUSIC_SEARCH."</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n";	
}


$content.="
		<tr>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n
	  <tr>\n
	    <td scope=\"col\">&nbsp;</td>\n
	    <td scope=\"col\"><strong>"._TOPMUSIC_ARTISTS."/"._TOPMUSIC_GROUPS."</strong></td>\n
	    <td scope=\"col\">&nbsp;</td>\n
	  </tr>";
if($getArtist!=""){
	if($tm_action!="artist"){
		$content.="	  
			<tr>\n
		    <td>::</td>\n";
		if(!$TMEasyURL)
			$content.="<td><a href=\"modules.php?name=topMusic&op=artist&idartist=".$artistOB->getId()."\">".$artistOB->getName()."</a></td>\n";
		else{
			if(!$TMEasyURLType)
				$content.="<td><a href=\"music.php/artist/".urlencode($artistOB->getName())."\">".$artistOB->getName()."</a></td>\n";
			elseif($TMEasyURLType==1)
				$content.="<td><a href=\"music.php/artist/".$artistOB->getId()."\">".$artistOB->getName()."</a></td>\n";
			else	
				$content.="<td><a href=\"artist".$artistOB->getId()."-".urlencode($artistOB->getName()).".html\">".$artistOB->getName()."</a></td>\n";
		}
		$content.="<td>&nbsp;</td>\n
		  </tr>\n";
	}else{
		$content.="	  
			<tr>\n
		    <td><b>::</b></td>\n
		    <td>".$artistOB->getName()."</td>\n
		    <td>&nbsp;</td>\n
		  </tr>\n";
	}
}

if($getArtist!=""){
	if($tm_action!="bio"){
		$content.="	
			  <tr>\n
			    <td>::</td>\n";
			    if(!$TMEasyURL){
			    	$content.="<td><a href=\"modules.php?name=topMusic&op=bio&idartist=".$artistOB->getId()."\">"._TOPMUSIC_BIOGRAPHY."</a></td>\n";
			    }else{
			    	if(!$TMEasyURLType)
			    		$content.="<td><a href=\"music.php/artist/".urlencode($artistOB->getName())."/biography\">"._TOPMUSIC_BIOGRAPHY."</a></td>\n";
			    	if($TMEasyURLType==1)
			    		$content.="<td><a href=\"music.php/artist/".$artistOB->getId()."/biography\">"._TOPMUSIC_BIOGRAPHY."</a></td>\n";
			    	else
			    		$content.="<td><a href=\"biography".$artistOB->getId()."-".urlencode($artistOB->getName()).".html\">"._TOPMUSIC_BIOGRAPHY."</a></td>\n";
			    }
			    $content.="<td>&nbsp;</td>\n  
			  </tr>\n";
	}else{
			$content.="
			  <tr>\n
			    <td><b>::</b></td>\n
			    <td>"._TOPMUSIC_BIOGRAPHY."</td>\n
			    <td>&nbsp;</td>\n
			  </tr>\n";
	}
}

if($tm_action!="AZ" && $tm_action!="" || $_GET['name']!=$TMMenu_modulename){
	$content.="	
		  <tr>\n
		    <td>::</td>\n";
		    if($TMEasyURL){
		    	if($TMEasyURLType==2)
		    		$content.="<td><a href=\"az.html\">"._TOPMUSIC_AZ."</a></td>\n";
		    	else
		    		$content.="<td><a href=\"music.php/AZ\">"._TOPMUSIC_AZ."</a></td>\n";
		    }else
				$content.="<td><a href=\"modules.php?name=topMusic&op=AZ\">"._TOPMUSIC_AZ."</a></td>\n";
		    $content.="<td>&nbsp;</td>\n  
		  </tr>\n";
}else{
		$content.="
		  <tr>\n
		    <td><b>::</b></td>\n
		    <td>"._TOPMUSIC_AZ."</td>\n
		    <td>&nbsp;</td>\n
		  </tr>\n";
}


$content.="
	  <tr>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n
	  <tr>\n
	    <td>&nbsp;</td>\n
	    <td><strong>"._TOPMUSIC_ALBUMS."</strong></td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n";
if($getAlbum!=""){
	if($tm_action!="album"){
		$content.="
		  <tr>\n
		    <td>::</td>\n";
		if($TMEasyURL){
			if(!$TMEasyURLType)
				$content.="<td><a href=\"music.php/artist/".urlencode($artistOB->getName())."/album/".urlencode($albumOB->getTitle())."\">".$albumOB->getTitle()."</a></td>\n";
			elseif($TMEasyURLType==1)
		    	$content.="<td><a href=\"music.php/artist/".$artistOB->getId()."/album/".$albumOB->getId()."\">".$albumOB->getTitle()."</a></td>\n";
			else
				$content.="<td><a href=\"album".$artistOB->getId()."_".$albumOB->getId()."-".urlencode($albumOB->getTitle()).".html\">".$albumOB->getTitle()."</a></td>\n";
		}else
		    $content.="<td><a href=\"modules.php?name=topMusic&op=album&idartist=".$artistOB->getId()."&idalbum=".$albumOB->getId()."\">".$albumOB->getTitle()."</a></td>\n";
		$content.="<td>&nbsp;</td>\n
		  </tr>\n";
	}else{
		$content.="
		  <tr>\n
		    <td><b>::</b></td>\n
		    <td>".$albumOB->getTitle()."</td>\n
		    <td>&nbsp;</td>\n
		  </tr>\n";
	}
}
if($getArtist!=""){
	if($tm_action!="albumlist"){
		$content.="
		  <tr>\n
		    <td>::</td>\n";
		if($TMEasyURL){
			if(!$TMEasyURLType)
				$content.="<td><a href=\"music.php/artist/".urlencode($artistOB->getName())."/discography\">"._TOPMUSIC_LISTOFALBUMS."</a></td>\n";
			elseif($TMEasyURLType==1)
				$content.="<td><a href=\"music.php/artist/".$artistOB->getId()."/discography\">"._TOPMUSIC_LISTOFALBUMS."</a></td>\n";
			else
				$content.="<td><a href=\"discography".$artistOB->getId()."-".urlencode($artistOB->getName()).".html\">"._TOPMUSIC_LISTOFALBUMS."</a></td>\n";
		}else	
			$content.="<td><a href=\"modules.php?name=topMusic&op=albumlist&idartist=".$artistOB->getId()."\">"._TOPMUSIC_LISTOFALBUMS."</a></td>\n";
		$content.="<td>&nbsp;</td>\n
		  </tr>\n";
	}else{
		$content.="
		  <tr>\n
		    <td><b>::</b></td>\n
		    <td>"._TOPMUSIC_LISTOFALBUMS."</td>\n
		    <td>&nbsp;</td>\n
		  </tr>\n";
	}
}else{
		$content.="<tr>\n
		    <td colspan=\"3\">"._TOPMUSIC_SELECTARTIST."</td>\n
		  </tr>\n";
}

$content.="
	  <tr>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n
	  <tr>\n
	    <td>&nbsp;</td>\n
	    <td><strong>"._TOPMUSIC_SONGS."</strong></td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n";
if($getSong!=""){
	if($tm_action!="song"){
		$content.="
		  <tr>\n
		    <td>::</td>\n";
		if($TMEasyURL){
		    if(!$TMEasyURLType)
		    	$content.="<td><a href=\"music.php/artist/".urlencode($artistOB->getName())."/album/".urlencode($albumOB->getTitle())."/song/".urlencode($songOB->getTitle())."\">".$songOB->getTitle()."</a></td>\n";
		    elseif($TMEasyURLType==1)
		    	$content.="<td><a href=\"music.php/artist/".$artistOB->getId()."/album/".$albumOB->getId()."/song/".$songOB->getId()."\">".$songOB->getTitle()."</a></td>\n";
		    else
		    	$content.="<td><a href=\"song".$artistOB->getId()."_".$albumOB->getId()."_".$songOB->getId()."-".urlencode($songOB->getTitle()).".html\">".$songOB->getTitle()."</a></td>\n";
		}else
		    $content.="<td><a href=\"modules.php?name=topMusic&op=artist&idartist=".$artistOB->getId()."&idalbum=".$albumOB->getId()."&idsong=".$songOB->getId()."\">".$songOB->getTitle()."</a></td>\n";
		$content.="<td>&nbsp;</td>\n
		  </tr>\n";
	}else{
		$content.="
		  <tr>\n
		    <td><b>::</b></td>\n
		    <td>".$songOB->getTitle()."</td>\n
		    <td>&nbsp;</td>\n
		  </tr>\n";
	}
}
if($getAlbum!=""){
	if($tm_action!="songlist"){
		 $content.="
		  <tr>\n
		    <td>::</td>\n";
		 if($TMEasyURL){
		 	if(!$TMEasyURLType)
		 		$content.="<td><a href=\"music.php/artist/".urlencode($artistOB->getName())."/album/".urlencode($albumOB->getTitle())."/songList\">"._TOPMUSIC_SONGLIST."</a></td>\n";
		 	elseif($TMEasyURLType==1)
		 		$content.="<td><a href=\"music.php/artist/".$artistOB->getId()."/album/".$albumOB->getId()."/songList\">"._TOPMUSIC_SONGLIST."</a></td>\n";
		 	else
		 		$content.="<td><a href=\"songlist".$artistOB->getId()."_".$albumOB->getId()."-".urlencode($albumOB->getTitle()).".html\">"._TOPMUSIC_SONGLIST."</a></td>\n";
		 }else	
			$content.="<td><a href=\"modules.php?name=topMusic&op=songlist&idartist=".$artistOB->getId()."&idalbum=".$albumOB->getId()."\">"._TOPMUSIC_SONGLIST."</a></td>\n";  
		$content.="<td>&nbsp;</td>\n
		  </tr>\n";
	}else{
		$content.="
		  <tr>\n
		    <td><b>::</bZ</td>\n
		    <td>"._TOPMUSIC_SONGLIST."</td>\n
		    <td>&nbsp;</td>\n
		  </tr>\n";
	}
}else{
		$content.="<tr>\n
		    <td colspan=\"3\">"._TOPMUSIC_SELECTALBUM."</td>\n
		  </tr>\n";
}
$content.="
	  <tr>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	    <td>&nbsp;</td>\n
	  </tr>\n
	</table>\n";
Return current item: Top Music module