Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/includes/menu.php
<?php
require_once("modules/$module_name/lib/com/sergids/common/StringUtils.php");
if($_GET['idartist']!=""){
	require_once('modules/'.$module_name.'/lib/com/sergids/topmusic/model/ArtistDAO.php');
	$artistDAO=new ArtistDAO($db,$prefix);
	$menu_artistname=$artistDAO->getArtistName($_GET['idartist']);
	$artistname=urlencode($menu_artistname);
	$menu_artistname=StringUtils::truncate($menu_artistname,12);
}
if($_GET['idalbum']!=""){
	require_once('modules/'.$module_name.'/lib/com/sergids/topmusic/model/AlbumDAO.php');
	$albumDAO=new AlbumDAO($db,$prefix);
	$menu_albumname=$albumDAO->getAlbumTitle($_GET['idalbum']);
	$albumname=urlencode($menu_albumname);
	$menu_albumname=StringUtils::truncate($menu_albumname,12);
}
if($_GET['idsong']!=""){
	require_once('modules/'.$module_name.'/lib/com/sergids/topmusic/model/SongDAO.php');
	$songDAO=new SongDAO($db,$prefix);
	$menu_songname=$songDAO->getSongTitle($_GET['idsong']);
	$songname=urlencode($menu_songname);
	$menu_songname=StringUtils::truncate($menu_songname,12);
}

$tm_menu_idartist=$_GET['idartist'];
$tm_menu_artistname=
$tm_menu_op=$_GET['op'];
$tm_menu_idalbum=$_GET['idalbum'];
$tm_menu_idsong=$_GET['idsong'];
//artist
if($tm_menu_idartist!="" && ($tm_menu_op!="artist" && $tm_menu_op!="voteArtist")){
	$url_artist="<li>";
	if($config->getEasyURL() && !$config->getEasyURLType())
    	$url_artist.= "<a href=\"".$config->getBaseURL()."/music.php/artist/".$artistname."\" title=\""._TOPMUSIC_ARTIST."/"._TOPMUSIC_GROUP."\">";
    elseif($config->getEasyURL() && $config->getEasyURLType()==2)
    	$url_artist.= "<a href=\"artist".$tm_menu_idartist.".html\" title=\""._TOPMUSIC_ARTIST."/"._TOPMUSIC_GROUP."\">";
    elseif($config->getEasyURL())
    	$url_artist.= "<a href=\"".$BaseURL."/music.php/artist/".$tm_menu_idartist."\" title=\""._TOPMUSIC_ARTIST."/"._TOPMUSIC_GROUP."\">";
    else
    	$url_artist.= "<a href=\"modules.php?name=".$module_name."&op=artist&idartist=".$tm_menu_idartist."&idalbum=".$tm_menu_idalbum."&idsong=".$tm_menu_idsong."\" title=\""._TOPMUSIC_ARTIST."/"._TOPMUSIC_GROUP."\">";
}elseif($tm_menu_op=="artist" || $tm_menu_op=="voteArtist"){
    $url_artist= "<li id=\"selected\"><a href=\"#\">";
}else
	$url_artist= "<li id=\"disabled\"><a href=\"#\">";
if($menu_artistname!="")
	$url_artist.=$menu_artistname;
else
	$url_artist.=_TOPMUSIC_ARTIST."/"._TOPMUSIC_GROUP;
$url_artist.="</a></li>";

//album
if($tm_menu_idalbum!="" && ($tm_menu_op!="album" && $tm_menu_op!="voteAlbum")){
	$url_album="<li>";
	if(!$config->getEasyURL())
		$url_album.= "<a href=\"modules.php?name=".$module_name."&op=album&idartist=".$tm_menu_idartist."&idalbum=".$tm_menu_idalbum."&idsong=".$tm_menu_idsong."\" title=\""._TOPMUSIC_ALBUM."\">";
	elseif(!$config->getEasyURLType()){
		$url_album.= "<a href=\"".$config->getBaseURL()."/music.php/artist/".$artistname."/album/".$albumname."\" title=\""._TOPMUSIC_ALBUM."\">";
	}elseif($config->getEasyURLType()==2){
		$url_album.= "<a href=\"album".$tm_menu_idartist."_".$tm_menu_idalbum.".html\" title=\""._TOPMUSIC_ALBUM."\">";
	}else{
		$url_album.= "<a href=\"".$config->getBaseURL()."/music.php/artist/".$tm_menu_idartist."/album/".$tm_menu_idalbum."\" title=\""._TOPMUSIC_ALBUM."\">";
	}
}elseif($tm_menu_op=="album" || $tm_menu_op=="voteAlbum")
	$url_album= "<li id=\"selected\"><a href=\"#\">";
else
	$url_album= "<li id=\"disabled\"><a href=\"#\">";
if($menu_albumname!="")
	$url_album.=$menu_albumname;
else
	$url_album.=_TOPMUSIC_ALBUM;
$url_album.="</a></li>";

//song
if($tm_menu_idsong!="" && ($tm_menu_op!="song" && $tm_menu_op!="voteSong")){
	$url_song="<li>";
	if(!$config->getEasyURL())
		$url_song.= "<a href=\"modules.php?name=".$module_name."&op=song&idartist=".$tm_menu_idartist."&idalbum=".$tm_menu_idalbum."&idsong=".$tm_menu_idsong."\" title=\""._TOPMUSIC_SONG."\">";
	elseif(!$config->getEasyURLType()){
		$url_song.= "<a href=\"".$config->getBaseURL()."/music.php/artist/".$artistname."/album/".$albumname."/song/".$songname."\" title=\""._TOPMUSIC_SONG."\">";
	}elseif($config->getEasyURLType()==2){
		$url_song.= "<a href=\"song".$tm_menu_idartist."_".$tm_menu_idalbum."_".$tm_menu_idsong.".html\" title=\""._TOPMUSIC_SONG."\">";
	}else{
		$url_song.= "<a href=\"".$config->getBaseURL()."/music.php/artist/".$tm_menu_idartist."/album/".$tm_menu_idalbum."/song/".$tm_menu_idsong."\" title=\""._TOPMUSIC_SONG."\">";
	}
}elseif($tm_menu_op=="song" || $tm_menu_op=="voteSong")
	$url_song= "<li id=\"selected\"><a href=\"#\">";
else
	$url_song= "<li id=\"disabled\"><a href=\"#\">";
if($menu_songname!="")
	$url_song.=$menu_songname;
else
	$url_song.=_TOPMUSIC_SONG;
$url_song.="</a></li>";
 	
//ranking
if($tm_menu_op!="ranking" && !($tm_menu_op=="" && $config->getMain_page()=="ranking")){
	$ranking_url="<li>";
	if(!$config->getEasyURL())
		$ranking_url.= "<a href=\"modules.php?name=$module_name&op=ranking\">";
	else{
		if($config->getEasyURLType()==2)
			$ranking_url.="<a href=\"tops.html\">";
		else
			$ranking_url.="<a href=\"".$config->getBaseURL()."/music.php/ranking\">";
	}
}else//if($tm_menu_op=="ranking")
	$ranking_url="<li id=\"selected\"><a href=\"#\">";
$ranking_url.=_TOPMUSIC_RANKING;
$ranking_url.="</a></li>";

//charts
if($tm_menu_op!="charts" && !($tm_menu_op=="" && $config->getMain_page()=="charts")){
	$charts_url="<li>";
	if(!$config->getEasyURL())
		$charts_url.= "<a href=\"modules.php?name=$module_name&op=charts\">";
	else{
		if($config->getEasyURLType()==2)
			$charts_url.="<a href=\"charts.html\">";
		else
			$charts_url.="<a href=\"".$config->getBaseURL()."/music.php/charts\">";
	}
}else//if($tm_menu_op=="charts")
	$charts_url="<li id=\"selected\"><a href=\"#\">";
$charts_url.=_TOPMUSIC_CHARTS;
$charts_url.="</a></li>";

//search
if($tm_menu_op!="search" && !($tm_menu_op=="" && $config->getMain_page()=="search")){
	$search_url="<li>";
	if(!$config->getEasyURL())
		$search_url.="<a href=\"modules.php?name=".$module_name."&op=search\">";
	else{
		if($config->getEasyURLType()==2)
			$search_url.="<a href=\"search.html\">";
		else
			$search_url.="<a href=\"music.php/search\">";
	}
}else
	$search_url="<li id=\"selected\"><a href=\"#\">";
$search_url.=_TOPMUSIC_SEARCH;
$search_url.="</a></li>";
	
//AZ
if($tm_menu_op!="AZ" && !($tm_menu_op=="" && $config->getMain_page()=="AZ")){
	$az_url="<li>";
	if(!$config->getEasyURL())
		$az_url.="<a href=\"modules.php?name=".$module_name."\">";
	else{
		if($config->getEasyURLType()==2)
			$az_url.="<a href=\"az.html\">";
		else
			$az_url.="<a href=\"".$config->getBaseURL()."/music.php/AZ\">";
	}
}else
	$az_url="<li id=\"selected\"><a href=\"#\">";
$az_url.=_TOPMUSIC_AZ;
$az_url.="</a></li>";

//biography
if($tm_menu_idartist!="" && $tm_menu_op!="bio"){
	$url_bio="<li>";
	if(!$config->getEasyURL())
		$url_bio.="<a href=\"modules.php?name=".$module_name."&op=bio&idartist=".$tm_menu_idartist."&idalbum=".$tm_menu_idalbum."&idsong=".$tm_menu_idsong."\">";
	elseif(!$config->getEasyURLType())
		$url_nio.="<a href=\"".$config->getBaseURL()."/music.php/artist/".$artistname."/biography\">";
	elseif($config->getEasyURLType()==2)
		$url_bio.="<a href=\"biography".$tm_menu_idartist.".html\">";
	else
		$url_bio.="<a href=\"".$config->getBaseURL()."/music.php/artist/".$tm_menu_idartist."/biography\">";
}elseif($tm_menu_op=="bio")
	$url_bio.="<li id=\"selected\"><a href=\"#\">";
else
	$url_bio.="<li id=\"disabled\"><a href=\"#\">";
$url_bio.=_TOPMUSIC_BIOGRAPHY;
$url_bio.="</a></li>";



//albumlist
if($tm_menu_idartist!="" && ($tm_menu_op!="discography" && $tm_menu_op!="albumlist")){
	$url_albumlist="<li>";
	if(!$config->getEasyURL())
		$url_albumlist.="<a href=\"modules.php?name=".$module_name."&op=albumlist&idartist=".$tm_menu_idartist."&idalbum=".$tm_menu_idalbum."&idsong=".$tm_menu_idsong."\">";
	elseif(!$config->getEasyURLType())
		$url_albumlist.="<a href=\"".$config->getBaseURL()."/music.php/artist/".$artistname."/discography\">";
	elseif($config->getEasyURLType()==2)
		$url_albumlist.="<a href=\"discography".$tm_menu_idartist.".html\">";
	else
		$url_albumlist.="<a href=\"".$config->getBaseURL()."/music.php/artist/".$tm_menu_idartist."/discography\">";
}elseif($tm_menu_op=="discography" || $tm_menu_op=="albumlist")
	$url_albumlist="<li id=\"selected\"><a href=\"#\">";
else
	$url_albumlist="<li id=\"disabled\"><a href=\"#\">";
$url_albumlist.=_TOPMUSIC_LISTOFALBUMS;
$url_albumlist.="</a></li>";



$smarty_menu = new Smarty;
$smarty_menu->template_dir = "modules/$module_name/themes/".$tm_theme."/";
$smarty_menu->compile_dir = "modules/$module_name/themes_c/".$tm_theme."/";
$smarty_menu->cache_dir = $smarty->compile_dir;

$smarty_menu->assign("artist",$url_artist);
$smarty_menu->assign("album",$url_album);
$smarty_menu->assign("song",$url_song);
$smarty_menu->assign("bio",$url_bio);
$smarty_menu->assign("albumlist",$url_albumlist);
$smarty_menu->assign("songlist",$url_songlist);

$smarty_menu->assign("ranking",$ranking_url);
$smarty_menu->assign("charts",$charts_url);
$smarty_menu->assign("search",$search_url);
$smarty_menu->assign("az",$az_url);

$tm_content_menu=$smarty_menu->fetch('menu.tpl');
?>
Return current item: Top Music module