summaryrefslogtreecommitdiffstats
path: root/lib/class/democratic.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-03-14 05:33:55 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-03-14 05:33:55 +0000
commit94f37cd899d3b5bf8b95f837f0f25839f4556f48 (patch)
tree4d694ca4384045d212b25b6e8fcbda9eb77ef1e7 /lib/class/democratic.class.php
parent7372bddcd04404cfab6f18139a3162221a0f7508 (diff)
downloadampache-94f37cd899d3b5bf8b95f837f0f25839f4556f48.tar.gz
ampache-94f37cd899d3b5bf8b95f837f0f25839f4556f48.tar.bz2
ampache-94f37cd899d3b5bf8b95f837f0f25839f4556f48.zip
fixed some pretty dumb issues with democratic play
Diffstat (limited to 'lib/class/democratic.class.php')
-rw-r--r--lib/class/democratic.class.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php
index df323f62..af1be060 100644
--- a/lib/class/democratic.class.php
+++ b/lib/class/democratic.class.php
@@ -26,6 +26,9 @@
*/
class Democratic extends tmpPlaylist {
+ // Build local, buy local
+ public $tmp_playlist;
+
/**
* constructor
* We need a constructor for this class. It does it's own thing now
@@ -61,6 +64,24 @@ class Democratic extends tmpPlaylist {
} // get_info
/**
+ * set_parent
+ * This returns the tmpPlaylist for this democratic play instance
+ */
+ public function set_parent() {
+
+ $demo_id = Dba::escape($this->id);
+
+ $sql = "SELECT * FROM `tmp_playlist` WHERE `session`='$demo_id'";
+ $db_results = Dba::query($sql);
+
+ $row = Dba::fetch_assoc($db_results);
+
+ $this->tmp_playlist = $row['id'];
+
+
+ } // set_parent
+
+ /**
* format
* This makes the objects variables all purrty so that they can be displayed
*/
@@ -160,7 +181,7 @@ class Democratic extends tmpPlaylist {
/* Select all objects from this playlist */
$sql = "SELECT `tmp_playlist_data`.`id`,`tmp_playlist_data`.`object_type`, `user_vote`.`date`, `tmp_playlist_data`.`object_id` " .
"FROM `tmp_playlist_data` $vote_join " .
- "WHERE `tmp_playlist_data`.`tmp_playlist`='" . Dba::escape($this->id) . "' $order";
+ "WHERE `tmp_playlist_data`.`tmp_playlist`='" . Dba::escape($this->tmp_playlist) . "' $order";
$db_results = Dba::query($sql);
/* Define the array */
@@ -300,7 +321,7 @@ class Democratic extends tmpPlaylist {
*/
public function has_vote($object_id,$type='') {
- $tmp_id = Dba::escape($this->id);
+ $tmp_id = Dba::escape($this->tmp_playlist);
$object_id = Dba::escape($object_id);
$type = $type ? Dba::escape($type) : 'song';
$user_id = Dba::escape($GLOBALS['user']->id);
@@ -329,7 +350,7 @@ class Democratic extends tmpPlaylist {
public function add_vote($object_id,$object_type='') {
$object_id = Dba::escape($object_id);
- $tmp_playlist = Dba::escape($this->id);
+ $tmp_playlist = Dba::escape($this->tmp_playlist);
$object_type = $object_type ? Dba::escape($object_type) : 'song';
/* If it's on the playlist just vote */