diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-15 22:46:28 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-15 22:46:28 +0000 |
commit | 1a475806e052e5c7d7115887002f98a3c2be500f (patch) | |
tree | 307290b1b1161ae72cb300469ca273a81d764214 /lib/class/democratic.class.php | |
parent | 4979ca79f67ae1328c14b186617b8cca5ce5e364 (diff) | |
download | ampache-1a475806e052e5c7d7115887002f98a3c2be500f.tar.gz ampache-1a475806e052e5c7d7115887002f98a3c2be500f.tar.bz2 ampache-1a475806e052e5c7d7115887002f98a3c2be500f.zip |
fix democratic play interface feedback issues and make the wizard actually work
Diffstat (limited to 'lib/class/democratic.class.php')
-rw-r--r-- | lib/class/democratic.class.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php index b41e1524..4e4a9011 100644 --- a/lib/class/democratic.class.php +++ b/lib/class/democratic.class.php @@ -88,6 +88,7 @@ class Democratic extends tmpPlaylist { return false; } // is_enabled + /** * set_parent * This returns the tmpPlaylist for this democratic play instance @@ -107,6 +108,30 @@ class Democratic extends tmpPlaylist { } // set_parent /** + * set_user_preferences + * This sets up a (or all) user(s) to use democratic play. This sets their play method + * and playlist method (clear on send) If no user is passed it does it for everyone and + * also locks down the ability to change to admins only + */ + public static function set_user_preferences($user=NULL) { + + //FIXME: Code in single user stuff + + $preference_id = Preference::id_from_name('play_type'); + Preference::update_level($preference_id,'75'); + Preference::update_all($preference_id,'democratic'); + + $allow_demo = Preference::id_from_name('allow_democratic_playback'); + Preference::update_all($allow_demo,'1'); + + $play_method = Preference::id_from_name('playlist_method'); + Preference::update_all($play_method,'clear'); + + return true; + + } // set_user_preferences + + /** * format * This makes the objects variables all purrty so that they can be displayed */ @@ -492,8 +517,15 @@ class Democratic extends tmpPlaylist { */ public function update($data) { + $name = Dba::escape($data['name']); + $base = Dba::escape($data['democratic']); + $cool = Dba::escape($data['cooldown']); + $id = Dba::escape($this->id); + $sql = "UPDATE `democratic` SET `name`='$name', `base_playlist`='$base',`cooldown`='$cool' WHERE `id`='$id'"; + $db_results = Dba::write($sql); + return true; } // update |