Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/admin/lib/com/sergids/topmusic/view/SongAdminView.php
<?php

class SongAdminView{
	function printSongList($songList) {
		echo "<script language=\"javascript\" type=\"text/javascript\">\n";
		echo "function delItem(idartist,idalbum,idsong){\n";
		echo "	if(confirm('"._TOPMUSIC_SURESONG."')){\n";
		echo "		document.delForm.action='admin.php?op=topmusic&action=delSong&idartist='+idartist+'&idalbum='+idalbum+'&idsong='+idsong;\n";
		echo "		document.delForm.submit();\n";
		echo "	}\n";
		echo "}\n";
		echo "</script>\n";
		echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
		echo "<form name=\"delForm\" method=\"post\" action=\"\">\n";
		echo "	<tr><td><b>#</b></td><td>&nbsp;</td><td><b>"._TOPMUSIC_TITLE."</b></td><td>&nbsp;</td><td><b>&nbsp;</b></td><td>&nbsp;</td><td>&nbsp;</td><td></td></tr>\n";
		for($i=0;$i<count($songList);$i++){ 
			$songO=$songList[$i];
			echo "	<tr>\n";
			echo "		<td>".$songO->getNumber()."</td><td>&nbsp;</td>\n";
			echo "		<td>".$songO->getTitle()."</td><td>&nbsp;</td>\n";
			if($songO->getLyrics()!="")
				echo "<td><img src=\"modules/"._TOPMUSIC_MODULENAME."/admin/images/lyrics.gif\" title=\""._TOPMUSIC_WITHLYRICS."\"></td>";
			else
				echo "<td><img src=\"modules/"._TOPMUSIC_MODULENAME."/admin/images/nolyrics.gif\" title=\""._TOPMUSIC_NOLYRICS."\"></td>";
			if($songO->getTrack()!=""){
				if(substr($songO->getTrack(),0,4)!="http")
					echo "		<td><a href=\"modules/"._TOPMUSIC_MODULENAME."/tracks/".$songO->getTrack()."\"><img src=\"modules/"._TOPMUSIC_MODULENAME."/images/sound.gif\" border=\"0\"></a></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
				else
					echo "		<td><a href=\"".$songO->getTrack()."\"><img src=\"modules/"._TOPMUSIC_MODULENAME."/images/sound.gif\" border=\"0\" title=\""._TOPMUSIC_WITHTRACK."\"></a></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
			}else
				echo "		<td><img src=\"modules/"._TOPMUSIC_MODULENAME."/images/sound_off.gif\" border=\"0\" title=\""._TOPMUSIC_NOTRACK."\"></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
			echo "		<td><a href=\"admin.php?op=topmusic&action=editSong&idartist=".$songO->getIdartist()."&idalbum=".$songO->getIdalbum()."&idsong=".$songO->getId()."\"><img src=\"images/edit.gif\" border=\"0\" title=\"Edit\"></td>";
			echo "		<td>&nbsp;</td>";
			echo "		<td><a href=\"javascript:delItem(".$songO->getIdartist().",".$songO->getIdalbum().",".$songO->getId().")\"><img src=\"images/delete.gif\" border=\"0\" title=\"Delete\"></a></td>\n";
			echo "	</tr>\n";
		}
		echo "</form>\n";
		echo "</table>\n<br>\n";
	}
	function printOrphanSongList($songList) {
		echo "<script language=\"javascript\" type=\"text/javascript\">\n";
		echo "function delItem(idsong){\n";
		echo "	if(confirm('"._TOPMUSIC_SURESONG."')){\n";
		echo "		document.delForm.action='admin.php?op=topmusic&action=delSong&idartist=&idalbum=&idsong='+idsong;\n";
		echo "		document.delForm.submit();\n";
		echo "	}\n";
		echo "}\n";
		echo "</script>\n";
		echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
		echo "<form name=\"delForm\" method=\"post\" action=\"\">\n";
		echo "	<tr><td><b>#</b></td><td>&nbsp;</td><td><b>"._TOPMUSIC_TITLE."</b></td><td>&nbsp;</td><td><b>&nbsp;</b></td><td>&nbsp;</td><td></td></tr>\n";
		for($i=0;$i<count($songList);$i++){ 
			$songO=$songList[$i];
			echo "	<tr>\n";
			echo "		<td>".$songO->getNumber()."</td><td>&nbsp;</td>\n";
			echo "		<td>".$songO->getTitle()."</td><td>&nbsp;</td>\n";
			if($songO->getTrack()!=""){
				if(substr($songO->getTrack(),0,4)!="http")
					echo "		<td><a href=\"modules/"._TOPMUSIC_MODULENAME."/tracks/".$songO->getTrack()."\"><img src=\"modules/"._TOPMUSIC_MODULENAME."/images/sound.gif\" border=\"0\"></a></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
				else
					echo "		<td><a href=\"".$songO->getTrack()."\"><img src=\"modules/"._TOPMUSIC_MODULENAME."/images/sound.gif\" border=\"0\"></a></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
			}else
				echo "		<td><img src=\"modules/"._TOPMUSIC_MODULENAME."/images/sound_off.gif\" border=\"0\"></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
			echo "		<td><a href=\"admin.php?op=topmusic&action=editSong&idartist=".$songO->getIdartist()."&idalbum=".$songO->getIdalbum()."&idsong=".$songO->getId()."\"><img src=\"images/edit.gif\" border=\"0\" title=\"Edit\"></td>";
			echo "		<td>&nbsp;</td>";
			echo "		<td><a href=\"javascript:delItem(".$songO->getId().")\"><img src=\"images/delete.gif\" border=\"0\" title=\"Delete\"></a></td>\n";
			echo "	</tr>\n";
		}
		echo "</form>\n";
		echo "</table>\n<br>\n";
	}
	function printSongResult($songList,$module_name,$page=1) {
		echo "<script language=\"javascript\" type=\"text/javascript\">\n";
		echo "function changePage(page){\n";
		echo "		document.searchForm.page.value=page;\n";
		echo "		document.searchForm.method='post';\n";
		echo "		document.searchForm.action='admin.php?op=topmusic&action=search';\n";
		echo "		document.searchForm.submit();\n";
		echo "}\n";
		echo "function delItem(idartist,idalbum,idsong){\n";
		echo "	if(confirm('"._TOPMUSIC_SURESONG."')){\n";
		echo "		document.searchForm.action='admin.php?op=topmusic&action=delAlbum&idartist='+idartist+'&idalbum='+idalbum+'&idsong='+idsong;\n";
		echo "		document.searchForm.submit();\n";
		echo "	}\n";
		echo "}\n";
		echo "</script>\n";
		echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
		echo "	<tr><td><b>"._TOPMUSIC_TITLE."</b></td><td>&nbsp;</td><td><b>"._TOPMUSIC_ALBUM."</b></td><td>&nbsp;</td><td><b>"._TOPMUSIC_ARTIST."</b></td><td>&nbsp;</td><td><b>&nbsp;</b></td><td>&nbsp;</td><td></td><td>&nbsp;</td><td></td></tr>\n";
		for($i=0;$i<count($songList);$i++){
			$songO=$songList[$i];
			echo "	<tr>\n";
			echo "		<td>".$songO->getTitle()."</td><td>&nbsp;</td>\n";
			echo "		<td>".$songO->getAlbumname()."</td><td>&nbsp;</td>\n";
			echo "		<td>".$songO->getArtistname()."</td><td>&nbsp;</td>\n";
			if($songO->getTrack()!=""){
				if(substr($songO->getTrack(),0,4)!="http")
					echo "		<td><a href=\"modules/".$module_name."/tracks/".$songO->getTrack()."\"><img src=\"modules/".$module_name."/images/sound.gif\" border=\"0\"></a></td><td>&nbsp;</td>\n";
				else
					echo "		<td><a href=\"".$songO->getTrack()."\"><img src=\"modules/".$module_name."/images/sound.gif\" border=\"0\"></a></td><td>&nbsp;</td>\n";
			}else
				echo "		<td><img src=\"modules/".$module_name."/images/sound_off.gif\" border=\"0\"></td><td>&nbsp;</td>\n";
			echo "		<td><a href=\"admin.php?op=topmusic&action=editSong&idartist=".$songO->getIdartist()."&idalbum=".$songO->getIdalbum()."&idsong=".$songO->getId()."\"><img src=\"images/edit.gif\" border=\"0\" title=\"Edit\"></td>\n";
			echo "		<td>&nbsp;</td>\n";
			echo "		<td><a href=\"javascript:delItem(".$songO->getIdartist().",".$songO->getIdalbum().",".$songO->getId().")\"><img src=\"images/delete.gif\" border=\"0\" title=\"Delete\"></a></td>\n";
			echo "	</tr>\n";
		}
		echo "</table>\n<br>\n";
		$num=$songO->getCount();
        if($page>1)
	    	echo " <a href=\"javascript:changePage(".($page-1).")\">&lt; "._TOPMUSIC_PREVIOUS."</a> ";
	    	
      	if($page>0)
      		echo " ". $page." ";
     	else
      		echo " 1 "; 
  		echo " "._TOPMUSIC_OF." ";
        echo " ".(ceil($num/10))." ";
                  
        if($page<ceil($num/10))
          	echo " <a href=\"javascript:changePage(".($page+1).")\"> "._TOPMUSIC_NEXT." &gt;</a> ";

     }
}

?>
Return current item: Top Music module