diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-12-30 22:49:36 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-12-30 22:49:36 +0000 |
commit | a145e33a37948eda1d83e0272ee46faf6148d0e7 (patch) | |
tree | f96c3b642cc650c6bbd9d3778922283dd9fa70e9 /lib/class/tmp_playlist.class.php | |
parent | ec19be3ef82d41cfae99d555ce3eef7e162d74c9 (diff) | |
download | ampache-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.php | 22 |
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 |