/** * Get playlist entry rss link. */ private function showPlaylistLinkItem(PlaylistLink $link) { $itemLink = 'index.php?action=' . ViewPlaylistWebPageAction::getActionName() . URL_AMP . 'subaction=' . ViewPlaylistWebPageAction::SUBACTION_PLAYLIST_LINK . URL_AMP . 'link=' . base64_encode($link->getKey()) . URL_AMP . 'PHPSESID=' . session_id(); $deleteLink = 'index.php?action=' . ViewPlaylistWebPageAction::getActionName() . URL_AMP . 'subaction=' . ViewPlaylistWebPageAction::SUBACTION_PLAYLIST_LINK_DELETE . URL_AMP . 'link=' . base64_encode($link->getKey()) . URL_AMP . 'PHPSESID=' . session_id(); echo ' <td width="42px"><img width="42px" height="56px" src="' . $link->getThumbnail() . '" style="border:0px;" /></td>' . "\n"; echo ' <td><p><a href="' . $itemLink . '">' . htmlentities($link->getTitle()) . '</a></p><p>' . htmlentities(utf8_decode($link->getLanguage())) . ', ' . htmlentities(utf8_decode($link->getFormat())) . ', ' . htmlentities(utf8_decode($link->getTypeDescription())) . '</p></td>' . "\n"; echo ' <td width="24px"><a href="' . $itemLink . '"><img width="22px" height="22px" src="../resources/playlist/view.png" style="border:0px;" /></a></td>' . "\n"; echo ' <td width="24px"><img width="22px" height="22px" src="../resources/playlist/edit.png" style="border:0px;" /></td>' . "\n"; echo ' <td width="24px"><a href="' . $deleteLink . '" onclick="return confirm(\'Are you sure to delete link ' . htmlentities(utf8_decode($link->getTitle())) . '?\');"><img width="22px" height="22px" src="../resources/playlist/remove.png" style="border:0px;" /></a></td>' . "\n"; }
/** * Get playlist entry rss link. */ private function getPlaylistLinkItem(PlaylistLink $link, $itemid) { $itemLink = SERVER_HOST_AND_PATH . 'php/index.php?action=' . ViewPlaylistPageAction::getActionName() . URL_AMP . 'subaction=' . ViewPlaylistPageAction::SUBACTION_PLAYLIST_LINK . URL_AMP . 'link=' . base64_encode($link->getKey()) . URL_AMP . 'PHPSESID=' . session_id(); $itemTitle = ($link->getTitle() != null ? $link->getTitle() : $link->getFilename()) . " (" . $link->getType() . ")"; return '<item>' . "\n" . ' <title><![CDATA[' . $itemTitle . ']]></title>' . "\n" . ' <description><![CDATA[' . $link->getDescription() . ']]></description>' . "\n" . ' <link>' . $itemLink . '</link>' . "\n" . ' <media:thumbnail url="' . $link->getThumbnail() . '" />' . "\n" . ' <image>' . $link->getThumbnail() . '</image>' . "\n" . ' <itemid>' . $itemid . '</itemid>' . "\n" . ' <name>' . strtoupper($link->getTitle() != null ? $link->getTitle() : $link->getFilename()) . '</name>' . "\n" . ' <type>' . $link->getTypeDescription() . '</type>' . "\n" . ' <format>' . $link->getFormat() . '</format>' . "\n" . '</item>' . "\n"; }
/** * Open playlist by full path, including filename. * @param String $fullPath * @return Playlist */ private function openPlaylist($fullPath) { $playlist = new Playlist(); if ($fullPath) { $xml = @simplexml_load_file($fullPath, 'SimpleXMLElement', LIBXML_NOCDATA); if (!$xml) { throw new Exception("Error loading Playlist on '" . $fullPath . "'."); } $attributes = $xml->attributes(); $playlist->setFilename((string) basename($fullPath)); $playlist->setPath((string) dirname($fullPath)); if ($attributes['name']) { $playlist->setName((string) $attributes['name']); } if ($attributes['description']) { $playlist->setDescription((string) $attributes['description']); } //Get playlist links foreach ($xml->children() as $second_gen) { $playlistLink = new PlaylistLink(); //Get node attributes $attributes = $second_gen->attributes(); $playlistLink->setKey((string) $attributes['key']); if ($attributes['type']) { $playlistLink->setType((string) $attributes['type']); } if ($attributes['thumbnail']) { $playlistLink->setThumbnail((string) $attributes['thumbnail']); } //Get child nodes if ($second_gen->title) { $playlistLink->setTitle((string) $second_gen->title); } if ($second_gen->description) { $playlistLink->setDescription((string) $second_gen->description); } if ($second_gen->format) { $playlistLink->setFormat((string) $second_gen->format); } if ($second_gen->filename) { $playlistLink->setFilename((string) $second_gen->filename); } if ($second_gen->link) { $playlistLink->setLink((string) $second_gen->link); } if ($second_gen->language) { $playlistLink->setLanguage((string) $second_gen->language); } //Get ids $order = 1; $second_gen = $second_gen->part; foreach ($second_gen->children() as $third_gen) { $attributes = $third_gen->attributes(); if ($attributes['order']) { $playlistLink->addId((int) $attributes['order'], (string) $third_gen); } else { ++$order; $playlistLink->addId((int) $order, (string) $third_gen); } } //Add link to playlist $playlist->addPlaylistLink($playlistLink); } } return $playlist; }
public function addPlaylistLink(PlaylistLink $link) { $this->playlistLinks[$link->getKey()] = $link; }