1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

added clear and play to the basket

This commit is contained in:
Karl 'vollmerk' Vollmer 2007-05-13 08:11:45 +00:00
parent 49c26695c9
commit 1e9f582cf1
4 changed files with 25 additions and 2 deletions

View file

@ -202,6 +202,19 @@ class tmpPlaylist {
} // count_items } // count_items
/**
* clear
* This clears all the objects out of a single playlist
*/
public function clear() {
$sql = "DELETE FROM `tmp_playlist_data` WHERE `tmp_playlist_data`.`tmp_playlist`='" . $this->id . "'";
$db_results = Dba::query($sql);
return true;
} // clear
/** /**
* create * create
* This function initializes a new tmpPlaylist it is assoicated with the current * This function initializes a new tmpPlaylist it is assoicated with the current

View file

@ -82,6 +82,9 @@ switch ($action) {
$GLOBALS['user']->playlist->add_object($song_id); $GLOBALS['user']->playlist->add_object($song_id);
} // end foreach } // end foreach
break; break;
case 'clear_all':
$GLOBALS['user']->playlist->clear();
break;
default: default:
case 'song': case 'song':
$GLOBALS['user']->playlist->add_object($_REQUEST['id']); $GLOBALS['user']->playlist->add_object($_REQUEST['id']);

View file

@ -51,6 +51,9 @@ switch ($action) {
// Make sure they actually passed soemthing // Make sure they actually passed soemthing
if (!count($song_ids)) { header("Location:" . return_referer()); exit; } if (!count($song_ids)) { header("Location:" . return_referer()); exit; }
break; break;
case 'basket':
$song_ids = $GLOBALS['user']->playlist->get_items();
break;
/* This is run if we need to gather info based on a tmp playlist */ /* This is run if we need to gather info based on a tmp playlist */
case 'tmp_playlist': case 'tmp_playlist':
$tmp_playlist = new tmpPlaylist($_REQUEST['tmpplaylist_id']); $tmp_playlist = new tmpPlaylist($_REQUEST['tmpplaylist_id']);

View file

@ -18,8 +18,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
$web_path = Config::get('web_path'); $ajax_url = Config::get('ajax_url');
// Get the count of the number of items in their playlist // Get the count of the number of items in their playlist
?> ?>
<div><?php echo __('There are currently %count% items in your playlist','%count%',$GLOBALS['user']->playlist->count_items()); ?></div> <div>
<a href="#" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=basket&amp;type=clear_all');return true;"><?php echo get_user_icon('delete'); ?></a>
<a href="<?php echo Config::get('web_path'); ?>/stream.php?action=basket"><?php echo get_user_icon('all'); ?></a>
<?php echo __('There are currently %count% items in your playlist','%count%',$GLOBALS['user']->playlist->count_items()); ?>
</div>