Location: PHPKode > projects > Axis Groupware > musiclib/browse.php
<?
$phpgw_info["flags"] = array ("currentapp" => "musiclib",
							 "enable_nextmatchs_class" => true);
$GLOBALS['phpgw_info']['cursor_focus'] = "document.defaultsearch.searchFor.focus();
										  document.defaultsearch.searchFor.select();";
	 
$rows = 2;

include ("../header.inc.php"); #PHP Groupware header

include ("inc/config.inc.php");
include ("inc/functions.inc.php");
include ("inc/sidebar.inc.php");

if ($table=='albums') 
{
	$title = "Browse Albums";
} 
else if ($table=='misc') 
{
	$title = "Browse Misc";
}

include ("inc/header.inc.php");

if ($listAllSongs) 
{

	switch ($mode) 
	{
		case 'misc':
			$query = construct_song_select("WHERE repository=2 ORDER BY path, filename");
		break;
		default:
			$query = construct_song_select("WHERE repository=1 ORDER BY artist_name, album_title, track");
	}
	
	list_music($mode,$table,$query, "no", "yes");
	include ("inc/footer.inc.php");

	exit;
}

if ($listAllAlbums) 
{
	$query = construct_album_select("ORDER BY artist_name, album_title");
	list_music($mode,$table,$query, "no", "yes");
	include ("inc/footer.inc.php");

	exit;
}


$text = "<b>Note:</b> Most artists are listed alphabetically by first name rather than last name.<br>";
$text .= "This also means that artists beginning with 'The' are listed under T.<br><br>";

for ($i=65 ; $i<=90 ; $i++) 
{
	$letter = chr ($i);
	$text .= "<a href=\"";
	$text .= $GLOBALS['phpgw']->link("/musiclib/browse.php","mode=".$mode."&beginningWith=$letter");
	$text .= "\">$letter</a> ";
	if ($i != 90) 
	{ 
		$text .= "| "; 
	}
}

	$text .= "<BR>";

for ($i=48 ; $i<=57 ; $i++) 
{
	$letter = chr ($i);
	$text .= "<a href=\"";
	$text .= $GLOBALS['phpgw']->link("/musiclib/browse.php","mode=".$mode."&beginningWith=$letter");
	$text .= "\">$letter</a> ";
	if ($i != 57) { $text .= "| "; }
}

$text .= "<BR><BR>\n";

if ($mode == 'album') 
{
	$text .= "List <a href=\"";
	$text .= $GLOBALS['phpgw']->link("/musiclib/browse.php","mode=".$mode."&listAllAlbums=true");
	$text .= "\" class=dik>All Albums</a><BR>\n";

	$text .= "List <a href=\"";
	$text .= $GLOBALS['phpgw']->link("/musiclib/browse.php","mode=song&table=".$table."&listAllSongs=true");
	$text .= "\" class=dik>All Songs</a><BR>\n";

	showBox ("Browse the Albums by clicking on the first letter of the Artist", $text);
} 
else 
{
	$text .= "List <a href=\"";
	$text .= $GLOBALS['phpgw']->link("/musiclib/browse.php","mode=".$mode."&listAllSongs=true");
	$text .= "\" class=dik>All Songs</a><BR>\n";

	showBox ("Browse the misc songs by path and filename", $text);
}

echo "<br>";
if (isset($beginningWith))
{
	switch ($mode) 
	{
		case 'misc':
			$query = construct_song_select("WHERE filename LIKE '" . strtolower($beginningWith) . "%' 
			  						 ORDER BY path, filename");
		
		break;
		default:
			$query = construct_album_select("WHERE artist_name LIKE '" . strtolower($beginningWith) . "%' 
			  						 OR artist_name LIKE '" . strtoupper($beginningWith)  . "%' 
			  						 ORDER BY artist_name, album_title");
	}
			  
	list_music($mode,$table,$query, "no", "yes");
}

include ("inc/footer.inc.php");
?>
Return current item: Axis Groupware