summaryrefslogtreecommitdiffstats
path: root/lib/class/tmp_playlist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-30 22:49:36 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-30 22:49:36 +0000
commita145e33a37948eda1d83e0272ee46faf6148d0e7 (patch)
treef96c3b642cc650c6bbd9d3778922283dd9fa70e9 /lib/class/tmp_playlist.class.php
parentec19be3ef82d41cfae99d555ce3eef7e162d74c9 (diff)
downloadampache-a145e33a37948eda1d83e0272ee46faf6148d0e7.tar.gz
ampache-a145e33a37948eda1d83e0272ee46faf6148d0e7.tar.bz2
ampache-a145e33a37948eda1d83e0272ee46faf6148d0e7.zip
added ability to clear entire democratic playlist
Diffstat (limited to 'lib/class/tmp_playlist.class.php')
-rw-r--r--lib/class/tmp_playlist.class.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php
index e39bc482..b024c454 100644
--- a/lib/class/tmp_playlist.class.php
+++ b/lib/class/tmp_playlist.class.php
@@ -441,5 +441,27 @@ class tmpPlaylist {
} // delete_track
+ /**
+ * clear_playlist
+ * This is really just a wrapper function, it clears the entire playlist
+ * including all votes etc.
+ */
+ function clear_playlist() {
+
+ $tmp_id = sql_escape($this->id);
+
+ /* Clear all votes then prune */
+ $sql = "DELETE FROM user_vote USING user_vote " .
+ "LEFT JOIN tmp_playlist_data ON user_vote.object_id = tmp_playlist_data.id " .
+ "WHERE tmp_playlist_data.tmp_playlist='$tmp_id'";
+ $db_results = mysql_query($sql,dbh());
+
+ // Prune!
+ $this->prune_tracks();
+
+ return true;
+
+ } // clear_playlist
+
} // class tmpPlaylist