diff --git a/lib/class/album.class.php b/lib/class/album.class.php index f1ef7821..86b782ca 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -129,10 +129,6 @@ class Album extends database_object implements library_item * @var string $f_name */ public $f_name; - /** - * @var string $f_name_link - */ - public $f_name_link; /** * @var string $link */ @@ -602,16 +598,15 @@ class Album extends database_object implements library_item $this->f_name = $this->full_name; $this->link = $web_path . '/albums.php?action=show&album=' . scrub_out($this->id); - $this->f_name_link = "link . "\" title=\"" . scrub_out($this->full_name) . "\">" . scrub_out($this->f_name); + $this->f_link = "link . "\" title=\"" . scrub_out($this->full_name) . "\">" . scrub_out($this->f_name); // Looking if we need to combine or display disks if ($this->disk && (!$this->allow_group_disks || ($this->allow_group_disks && !AmpConfig::get('album_group')))) { - $this->f_name_link .= " [" . T_('Disk') . " " . $this->disk . "]"; + $this->f_link .= " [" . T_('Disk') . " " . $this->disk . "]"; } - $this->f_name_link .=""; + $this->f_link .=""; - $this->f_link = $this->f_name_link; $this->f_title = $this->full_name; if ($this->artist_count == '1') { $artist = trim(trim($this->artist_prefix) . ' ' . trim($this->artist_name)); @@ -735,6 +730,31 @@ class Album extends database_object implements library_item return 'default'; } + public function get_description() + { + // Album description is not supported yet, always return artist description + $artist = new Artist($this->artist_id); + return $artist->get_description(); + } + + public function display_art($thumb = 2) + { + $id = null; + $type = null; + + if (Art::has_db($this->id, 'album')) { + $id = $this->id; + $type = 'album'; + } else if (Art::has_db($this->artist_id, 'artist')) { + $id = $this->artist_id; + $type = 'artist'; + } + + if ($id !== null && $type !== null) { + Art::display($type, $id, $this->get_fullname(), $thumb, $this->link); + } + } + /** * get_random_songs * gets a random number, and a random assortment of songs from this album diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index 8eb9f429..a432a154 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -105,10 +105,6 @@ class Artist extends database_object implements library_item * @var string $f_link */ public $f_link; - /** - * @var string $f_name_link - */ - public $f_name_link; /** * @var string $f_time */ @@ -437,10 +433,10 @@ class Artist extends database_object implements library_item if ($this->catalog_id) { $this->link = AmpConfig::get('web_path') . '/artists.php?action=show&catalog=' . $this->catalog_id . '&artist=' . $this->id; - $this->f_link = $this->f_name_link = "link . "\" title=\"" . $this->f_full_name . "\">" . $name . ""; + $this->f_link = "link . "\" title=\"" . $this->f_full_name . "\">" . $name . ""; } else { $this->link = AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $this->id; - $this->f_link = $this->f_name_link = "link . "\" title=\"" . $this->f_full_name . "\">" . $name . ""; + $this->f_link = "link . "\" title=\"" . $this->f_full_name . "\">" . $name . ""; } if ($details) { @@ -566,6 +562,26 @@ class Artist extends database_object implements library_item return 'default'; } + public function get_description() + { + return $this->summary; + } + + public function display_art($thumb = 2) + { + $id = null; + $type = null; + + if (Art::has_db($this->id, 'artist')) { + $id = $this->id; + $type = 'artist'; + } + + if ($id !== null && $type !== null) { + Art::display($type, $id, $this->get_fullname(), $thumb, $this->link); + } + } + /** * check * diff --git a/lib/class/broadcast.class.php b/lib/class/broadcast.class.php index 15c9312b..81c65ae6 100644 --- a/lib/class/broadcast.class.php +++ b/lib/class/broadcast.class.php @@ -269,6 +269,18 @@ class Broadcast extends database_object implements library_item return 'default'; } + public function get_description() + { + return null; + } + + public function display_art($thumb = 2) + { + if (Art::has_db($this->id, 'broadcast')) { + Art::display('broadcast', $this->id, $this->get_fullname(), $thumb, $this->link); + } + } + /** * Get all broadcasts sql query. * @return string diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 179ce0b9..74997600 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -75,9 +75,13 @@ abstract class Catalog extends database_object */ public $f_name; /** - * @var string $f_name_link + * @var string $link */ - public $f_name_link; + public $link; + /** + * @var string $f_link + */ + public $f_link; /** * @var string $f_update */ @@ -496,9 +500,8 @@ abstract class Catalog extends database_object public function format() { $this->f_name = $this->name; - $this->f_name_link = '' . + $this->link = AmpConfig::get('web_path') . '/admin/catalog.php?action=show_customize_catalog&catalog_id=' . $this->id; + $this->f_link = '' . scrub_out($this->f_name) . ''; $this->f_update = $this->last_update ? date('d/m/Y h:i', $this->last_update) diff --git a/lib/class/graph.class.php b/lib/class/graph.class.php index 7a3124b6..911b72bc 100644 --- a/lib/class/graph.class.php +++ b/lib/class/graph.class.php @@ -489,12 +489,8 @@ class Graph if (Core::is_library_item($object_type)) { $libitem = new $object_type($object_id); $libitem->format(); - if (isset($libitem->f_name_link)) { - $blink = $libitem->f_name_link; - } else { - if (isset($libitem->f_link)) { - $blink = $libitem->f_link; - } + if (isset($libitem->f_link)) { + $blink = $libitem->f_link; } } } else if ($user_id) { diff --git a/lib/class/library_item.interface.php b/lib/class/library_item.interface.php index 51edaf1e..9ab85bcd 100644 --- a/lib/class/library_item.interface.php +++ b/lib/class/library_item.interface.php @@ -34,6 +34,10 @@ interface library_item extends playable_item public function get_default_art_kind(); + public function get_description(); + + public function display_art($thumb); + public function update(array $data); public static function gc(); diff --git a/lib/class/live_stream.class.php b/lib/class/live_stream.class.php index 0d0aa057..cdbfeefe 100644 --- a/lib/class/live_stream.class.php +++ b/lib/class/live_stream.class.php @@ -95,9 +95,9 @@ class Live_Stream extends database_object implements media, library_item public function format($details = true) { // Default link used on the rightbar - $this->f_link = "url\">$this->name"; - $this->f_name_link = "site_url\">$this->name"; - $this->f_url_link = "url\">$this->url"; + $this->f_link = "url . "\">" . $this->name . ""; + $this->f_name_link = "site_url . "\">" . $this->name . ""; + $this->f_url_link = "url . "\">" . $this->url . ""; return true; diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index 11dd5948..3285b4ce 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -33,8 +33,8 @@ class Playlist extends playlist_object public $genre; public $date; + public $link; public $f_link; - public $f_name_link; /* Generated Elements */ public $items = array(); @@ -121,8 +121,8 @@ class Playlist extends playlist_object public function format($details = true) { parent::format($details); - $this->f_link = AmpConfig::get('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $this->id; - $this->f_name_link = '' . $this->f_name . ''; + $this->link = AmpConfig::get('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $this->id; + $this->f_link = '' . $this->f_name . ''; } // format diff --git a/lib/class/playlist_object.abstract.php b/lib/class/playlist_object.abstract.php index 51b045c7..01447d1e 100644 --- a/lib/class/playlist_object.abstract.php +++ b/lib/class/playlist_object.abstract.php @@ -148,6 +148,16 @@ abstract class playlist_object extends database_object implements library_item return 'default'; } + public function get_description() + { + return null; + } + + public function display_art($thumb = 2) + { + // no art + } + /** * get_catalogs * diff --git a/lib/class/search.class.php b/lib/class/search.class.php index c8199dd6..5c1a8804 100644 --- a/lib/class/search.class.php +++ b/lib/class/search.class.php @@ -37,8 +37,8 @@ class Search extends playlist_object public $basetypes; public $types; + public $link; public $f_link; - public $f_name_link; /** * constructor @@ -650,8 +650,8 @@ class Search extends playlist_object { parent::format(); - $this->f_link = AmpConfig::get('web_path') . '/smartplaylist.php?action=show_playlist&playlist_id=' . $this->id; - $this->f_name_link = '' . $this->f_name . ''; + $this->link = AmpConfig::get('web_path') . '/smartplaylist.php?action=show_playlist&playlist_id=' . $this->id; + $this->f_link = '' . $this->f_name . ''; } /** diff --git a/lib/class/shoutbox.class.php b/lib/class/shoutbox.class.php index 1c0a52c5..7ac70b10 100644 --- a/lib/class/shoutbox.class.php +++ b/lib/class/shoutbox.class.php @@ -241,7 +241,7 @@ class Shoutbox } $html .= "