Location: PHPKode > projects > Axis Groupware > musiclib/playlists.php
<?php
# playlists.php
#
# displays user's playlists
#
if (!$id) { $id = $HTTP_POST_VARS['playlist_select']; };

if ($id == 'random') 
{
       
    $phpgw_info["flags"] = array("currentapp" => "musiclib",
                               "enable_nextmatchs_class" => true,
                               "noheader" => true);
  
    include ("../header.inc.php"); #PHP Groupware header
  
    include ("inc/config.inc.php");
    include ("inc/functions.inc.php");
  
    $query = construct_song_select("ORDER BY RAND() LIMIT ".$musiclib['config']['random_playlist_size']);
	generate_playlist($mode,$query);

} 
else if ($mode == 'print') 
{
	
	$phpgw_info["flags"] = array("currentapp" => "musiclib",
								 "enable_nextmatchs_class" => true,
								 "nonavbar" => true);
 
	include ("../header.inc.php"); #PHP Groupware header

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

	$query = construct_playlists_select("WHERE id=".$id);

	$result = $GLOBALS['phpgw']->db->query($query);
	$GLOBALS['phpgw']->db->next_record();
	$playlist_title = $GLOBALS['phpgw']->db->f('playlist_title');

	playlist_printable_view($id,$playlist_title);
	
} 
else 
{

	$phpgw_info["flags"] = array("currentapp" => "musiclib",
								 "enable_nextmatchs_class" => True);
	if ($mode == 'new') 
	{
		$GLOBALS['phpgw_info']['cursor_focus'] = "document.playlisttitle.playlist_title.focus();
												  document.playlisttitle.playlist_title.select();";
	} 
	else 
	{
		$GLOBALS['phpgw_info']['cursor_focus'] = "document.defaultsearch.searchFor.focus();
											  	  document.defaultsearch.searchFor.select();";
 	}
 	
	include ("../header.inc.php"); #PHP Groupware header

	include ("inc/config.inc.php");
	include ("inc/functions.inc.php");
	include ("inc/sidebar.inc.php");
	$title = "Playlists";
	include ("inc/header.inc.php");

	
	if (is_numeric($id)) 
	{
    		$query = construct_playlists_select("WHERE id=".$id);
    
    		$result = $GLOBALS['phpgw']->db->query($query);
    		$GLOBALS['phpgw']->db->next_record();
    		$playlist_title = $GLOBALS['phpgw']->db->f('playlist_title');
    
    		list_playlist_contents($id,$playlist_title);
	} 
	else 
	{
    	if ($mode == 'user')
    	{
        	if ($uid)
        	{
        		echo '<b>User:</b> '.$lid;
        		$query = construct_user_playlists_select("WHERE id=".$uid);
        		$result = $GLOBALS['phpgw']->db->query($query);
        		list_playlists($uid);
        	}
        	else
        	{
        		$query = construct_user_playlists_select("");
        		$result = $GLOBALS['phpgw']->db->query($query);
        		list_playlist_users($result);
        	}
    	}
    	else
    	{
    		echo '<b><font size=2><a href="'
    			.$GLOBALS['phpgw']->link("/musiclib/playlists.php",'mode=user')
    			.'">View Shared Playlists</a></font></b><BR><BR>'."\n";
    		echo "<b><font size=2>Here Are Your playlists:</font></b><BR>\n";
    
    		#echo $query;
    		list_playlists($GLOBALS['phpgw_info']['user']['account_id']);
    	}
	}

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