diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-15 08:57:52 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-15 08:57:52 +0000 |
commit | 637656f08dfde4f8843cfaef257e2a2a3c49d770 (patch) | |
tree | 052a9ff6423a24fff04f49675fad7f79aead5cc4 /lib/class/tmp_playlist.class.php | |
parent | 8cae71c489090f2c59822d04b1622520b8e6b1b0 (diff) | |
download | ampache-637656f08dfde4f8843cfaef257e2a2a3c49d770.tar.gz ampache-637656f08dfde4f8843cfaef257e2a2a3c49d770.tar.bz2 ampache-637656f08dfde4f8843cfaef257e2a2a3c49d770.zip |
added db update for tmp playlist and added initial class definition
Diffstat (limited to 'lib/class/tmp_playlist.class.php')
-rw-r--r-- | lib/class/tmp_playlist.class.php | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php new file mode 100644 index 00000000..7c29c235 --- /dev/null +++ b/lib/class/tmp_playlist.class.php @@ -0,0 +1,81 @@ +<?php +/* + + Copyright (c) 2001 - 2006 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +/** + * TempPlaylist Class + * This class handles the temporary playlists in ampache, it handles the + * tmp_playlist and tmp_playlist_data tables, and sneaks out at night to + * visit user_vote from time to time + */ +class tmpPlaylist { + + /* Variables from the Datbase */ + var $id; + var $session; + var $type; + var $object_type; + var $base_playlist; + + /* Generated Elements */ + var $items = array(); + + + /** + * Constructor + * This takes a playlist_id as an optional argument and gathers the information + * if not playlist_id is passed returns false (or if it isn't found + */ + function tmpPlaylist($playlist_id = 0) { + + if (!$playlist_id) { return false; } + + $this->id = intval($playlist_id); + $info = $this->_get_info(); + + /* If we get something back */ + if (count($info)) { + $this->session = $info['session']; + $this->type = $info['type']; + $this->object_type = $info['object_type']; + $this->base_playlist = $info['base_playlist']; + } + + return true; + + } // tmpPlaylist + + /** + * _get_info + * This is an internal (private) function that gathers the information for this object from the + * playlist_id that was passed in. + */ + function _get_info() { + + $sql = "SELECT * FROM tmp_playlist WHERE id='" . sql_escape($this->id) . "'"; + $db_results = mysql_query($sql, dbh()); + + $results = mysql_fetch_assoc($db_results); + + return $results; + + } // _get_info + +} // class tmpPlaylist |