From 1e9f582cf1dba653f45bbc5835fa662a3c163e69 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 13 May 2007 08:11:45 +0000 Subject: [PATCH] added clear and play to the basket --- lib/class/tmpplaylist.class.php | 13 +++++++++++++ server/ajax.server.php | 3 +++ stream.php | 3 +++ templates/show_playlist_bar.inc.php | 8 ++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/class/tmpplaylist.class.php b/lib/class/tmpplaylist.class.php index 562132fc..b59417d5 100644 --- a/lib/class/tmpplaylist.class.php +++ b/lib/class/tmpplaylist.class.php @@ -202,6 +202,19 @@ class tmpPlaylist { } // 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 * This function initializes a new tmpPlaylist it is assoicated with the current diff --git a/server/ajax.server.php b/server/ajax.server.php index b8053f72..d90d9115 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -82,6 +82,9 @@ switch ($action) { $GLOBALS['user']->playlist->add_object($song_id); } // end foreach break; + case 'clear_all': + $GLOBALS['user']->playlist->clear(); + break; default: case 'song': $GLOBALS['user']->playlist->add_object($_REQUEST['id']); diff --git a/stream.php b/stream.php index d4e1527b..c9c85188 100644 --- a/stream.php +++ b/stream.php @@ -51,6 +51,9 @@ switch ($action) { // Make sure they actually passed soemthing if (!count($song_ids)) { header("Location:" . return_referer()); exit; } 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 */ case 'tmp_playlist': $tmp_playlist = new tmpPlaylist($_REQUEST['tmpplaylist_id']); diff --git a/templates/show_playlist_bar.inc.php b/templates/show_playlist_bar.inc.php index cfff9e58..ee588cad 100644 --- a/templates/show_playlist_bar.inc.php +++ b/templates/show_playlist_bar.inc.php @@ -18,8 +18,12 @@ 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 ?> -
playlist->count_items()); ?>
+
+ + + playlist->count_items()); ?> +