summaryrefslogtreecommitdiffstats
path: root/lib/class/playlist.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/class/playlist.class.php')
-rw-r--r--lib/class/playlist.class.php54
1 files changed, 20 insertions, 34 deletions
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index 6624540c..42638820 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -46,13 +46,9 @@
* @link http://www.ampache.org/
* @since Class available since Release 1.0
*/
-class Playlist extends database_object {
+class Playlist extends playlist_object {
/* Variables from the database */
- public $id;
- public $name;
- public $user;
- public $type;
public $genre;
public $date;
@@ -94,43 +90,33 @@ class Playlist extends database_object {
} // build_cache
/**
- * format
- * This takes the current playlist object and gussies it up a little
- * bit so it is presentable to the users
+ * get_playlists
+ * Returns a list of playlists accessible by the current user.
*/
- public function format() {
-
- $this->f_name = truncate_with_ellipsis($this->name,Config::get('ellipse_threshold_title'));
- $this->f_link = '<a href="' . Config::get('web_path') . '/playlist.php?action=show_playlist&amp;playlist_id=' . $this->id . '">' . $this->f_name . '</a>';
-
- $this->f_type = ($this->type == 'private') ? get_user_icon('lock',_('Private')) : '';
+ public static function get_playlists() {
+ $sql = "SELECT `id` from `playlist` WHERE `type`='public' OR " .
+ "`user`='" . $GLOBALS['user']->id . "' ORDER BY `name`";
+ $db_results = Dba::read($sql);
- $client = new User($this->user);
+ $results = array();
- $this->f_user = $client->fullname;
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $results[] = $row['id'];
+ }
- } // format
+ return $results;
+ } // get_playlists
/**
- * has_access
- * This function returns true or false if the current user
- * has access to this playlist
+ * format
+ * This takes the current playlist object and gussies it up a little
+ * bit so it is presentable to the users
*/
- public function has_access() {
-
- if (!Access::check('interface','25')) {
- return false;
- }
- if ($this->user == $GLOBALS['user']->id) {
- return true;
- }
- else {
- return Access::check('interface','100');
- }
-
- return false;
+ public function format() {
+ parent::format();
+ $this->f_link = '<a href="' . Config::get('web_path') . '/playlist.php?action=show_playlist&amp;playlist_id=' . $this->id . '">' . $this->f_name . '</a>';
- } // has_access
+ } // format
/**
* get_track