mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Add video support to playlist (fix #675)
This commit is contained in:
parent
9d9f7a2711
commit
aa19993358
23 changed files with 284 additions and 135 deletions
156
lib/class/bookmark.class.php
Normal file
156
lib/class/bookmark.class.php
Normal file
|
@ -0,0 +1,156 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Bookmark class
|
||||
*
|
||||
* This manage bookmark on playable items
|
||||
*
|
||||
*/
|
||||
class Bookmark extends database_object
|
||||
{
|
||||
// Public variables
|
||||
public $id;
|
||||
public $user;
|
||||
public $object_id;
|
||||
public $object_type;
|
||||
public $position;
|
||||
public $comment;
|
||||
public $creation_date;
|
||||
public $update_date;
|
||||
|
||||
public $f_user;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* This is run every time a new object is created, and requires
|
||||
* the id and type of object that we need to pull for
|
||||
*/
|
||||
public function __construct ($object_id, $object_type = null, $user_id = null)
|
||||
{
|
||||
if (!$object_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$object_type) {
|
||||
$info = $this->get_info($object_id);
|
||||
} else {
|
||||
if ($user_id == null) {
|
||||
$user_id = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `bookmark` WHERE `object_type` = ? AND `object_id` = ? AND `user` = ?";
|
||||
$db_results = Dba::read($sql, array($object_type, $object_id, $user_id));
|
||||
|
||||
if (!$db_results) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$info = Dba::fetch_assoc($db_results);
|
||||
}
|
||||
|
||||
// Foreach what we've got
|
||||
foreach ($info as $key=>$value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* gc
|
||||
*
|
||||
* Remove bookmark for items that no longer exist.
|
||||
*/
|
||||
public static function gc($object_type = null, $object_id = null)
|
||||
{
|
||||
$types = array('song', 'video', 'podcast_episode');
|
||||
|
||||
if ($object_type != null) {
|
||||
if (in_array($object_type, $types)) {
|
||||
$sql = "DELETE FROM `bookmark` WHERE `object_type` = ? AND `object_id` = ?";
|
||||
Dba::write($sql, array($object_type, $object_id));
|
||||
} else {
|
||||
debug_event('bookmark', 'Garbage collect on type `' . $object_type . '` is not supported.', 1);
|
||||
}
|
||||
} else {
|
||||
foreach ($types as $type) {
|
||||
Dba::write("DELETE FROM `bookmark` USING `bookmark` LEFT JOIN `$type` ON `$type`.`id` = `bookmark`.`object_id` WHERE `bookmark`.`object_type` = '$type' AND `$type`.`id` IS NULL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get_bookmarks_ids($user = null)
|
||||
{
|
||||
$ids = array();
|
||||
if ($user == null) {
|
||||
$user = $GLOBALS['user'];
|
||||
}
|
||||
|
||||
$sql = "SELECT `id` FROM `bookmark` WHERE `user` = ?";
|
||||
$db_results = Dba::read($sql, array($user->id));
|
||||
while ($results = Dba::fetch_assoc($db_results)) {
|
||||
$ids[] = $results['id'];
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
public static function get_bookmarks($user = null)
|
||||
{
|
||||
$bookmarks = array();
|
||||
$ids = self::get_bookmarks_ids($user);
|
||||
foreach ($ids as $id) {
|
||||
$bookmarks[] = new Bookmark($id);
|
||||
}
|
||||
return $bookmarks;
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$user = $data['user'] ?: $GLOBALS['user']->id;
|
||||
$position = $data['position'] ?: 0;
|
||||
$comment = scrub_in($data['comment']);
|
||||
|
||||
$sql = "INSERT INTO `bookmark` (`user`, `position`, `comment`, `object_type`, `object_id`, `creation_date`, `update_date`) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
return Dba::write($sql, array($user, $position, $comment, $data['object_type'], $data['object_id'], time(), time()));
|
||||
}
|
||||
|
||||
public function update($position)
|
||||
{
|
||||
$sql = "UPDATE `bookmark` SET `position` = ?, `update_date` = ? WHERE `id` = ?";
|
||||
return Dba::write($sql, array($position, time(), $this->id));
|
||||
}
|
||||
|
||||
public function remove()
|
||||
{
|
||||
$sql = "DELETE FROM `bookmark` WHERE `id` = ?";
|
||||
return Dba::write($sql, array($this->id));
|
||||
}
|
||||
|
||||
public function format()
|
||||
{
|
||||
$user = new User($this->user);
|
||||
$f_user = $user->username;
|
||||
}
|
||||
} //end bookmark class
|
||||
|
|
@ -237,9 +237,9 @@ class Browse extends Query
|
|||
$box_title = T_('Playlists') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_playlists.inc.php');
|
||||
break;
|
||||
case 'playlist_song':
|
||||
$box_title = T_('Playlist Songs') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_playlist_songs.inc.php');
|
||||
case 'playlist_media':
|
||||
$box_title = T_('Playlist Medias') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_playlist_medias.inc.php');
|
||||
break;
|
||||
case 'playlist_localplay':
|
||||
$box_title = T_('Current Playlist');
|
||||
|
|
|
@ -217,19 +217,24 @@ class Playlist extends playlist_object
|
|||
} // get_songs
|
||||
|
||||
/**
|
||||
* get_song_count
|
||||
* This simply returns a int of how many song elements exist in this playlist
|
||||
* For now let's consider a dyn_song a single entry
|
||||
* get_media_count
|
||||
* This simply returns a int of how many media elements exist in this playlist
|
||||
* For now let's consider a dyn_media a single entry
|
||||
*/
|
||||
public function get_song_count()
|
||||
public function get_media_count($type = '')
|
||||
{
|
||||
$params = array($this->id);
|
||||
$sql = "SELECT COUNT(`id`) FROM `playlist_data` WHERE `playlist` = ?";
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
if (!empty($type)) {
|
||||
$sql .= " AND `object_type` = ?";
|
||||
$params[] = $type;
|
||||
}
|
||||
$db_results = Dba::read($sql, $params);
|
||||
|
||||
$results = Dba::fetch_row($db_results);
|
||||
|
||||
return $results['0'];
|
||||
} // get_song_count
|
||||
} // get_media_count
|
||||
|
||||
/**
|
||||
* get_total_duration
|
||||
|
@ -369,7 +374,7 @@ class Playlist extends playlist_object
|
|||
$sql = "SELECT `track` FROM `playlist_data` WHERE `playlist` = ? ORDER BY `track` DESC LIMIT 1";
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
$data = Dba::fetch_assoc($db_results);
|
||||
$base_track = $data['track'];
|
||||
$base_track = $data['track'] ?: 0;
|
||||
debug_event('add_medias', 'Track number: ' . $base_track, '5');
|
||||
|
||||
$i = 0;
|
||||
|
|
|
@ -1314,7 +1314,7 @@ class Plex_XML_Data
|
|||
//$xpl->addAttribute('composite', '');
|
||||
$xpl->addAttribute('playlistType', 'audio');
|
||||
$xpl->addAttribute('duration', $playlist->get_total_duration() * 1000);
|
||||
$xpl->addAttribute('leafCount', $playlist->get_song_count());
|
||||
$xpl->addAttribute('leafCount', $playlist->get_media_count('song'));
|
||||
$xpl->addAttribute('addedAt', '');
|
||||
$xpl->addAttribute('updatedAt', '');
|
||||
}
|
||||
|
@ -1322,7 +1322,7 @@ class Plex_XML_Data
|
|||
public static function setPlaylistItems(SimpleXMLElement $xml, $playlist)
|
||||
{
|
||||
$xml->addAttribute('duration', $playlist->get_total_duration() * 1000);
|
||||
$xml->addAttribute('leafCount', $playlist->get_song_count());
|
||||
$xml->addAttribute('leafCount', $playlist->get_media_count('song'));
|
||||
$items = $playlist->get_items();
|
||||
self::addPlaylistsItems($xml, $items);
|
||||
}
|
||||
|
|
|
@ -250,14 +250,6 @@ class Query
|
|||
}
|
||||
|
||||
self::$allowed_sorts = array(
|
||||
'playlist_song' => array(
|
||||
'title',
|
||||
'year',
|
||||
'track',
|
||||
'time',
|
||||
'album',
|
||||
'artist'
|
||||
),
|
||||
'song' => array(
|
||||
'title',
|
||||
'year',
|
||||
|
@ -711,7 +703,7 @@ class Query
|
|||
case 'user':
|
||||
case 'video':
|
||||
case 'playlist':
|
||||
case 'playlist_song':
|
||||
case 'playlist_media':
|
||||
case 'smartplaylist':
|
||||
case 'song':
|
||||
case 'catalog':
|
||||
|
@ -1093,7 +1085,8 @@ class Query
|
|||
$this->set_select("`podcast_episode`.`id`");
|
||||
$sql = "SELECT %%SELECT%% FROM `podcast_episode` ";
|
||||
break;
|
||||
case 'playlist_song':
|
||||
case 'playlist_media':
|
||||
break;
|
||||
case 'song':
|
||||
default:
|
||||
$this->set_select("DISTINCT(`song`.`id`)");
|
||||
|
|
|
@ -625,7 +625,7 @@ class Subsonic_XML_Data
|
|||
$xplaylist->addAttribute('owner', $user->username);
|
||||
$xplaylist->addAttribute('public', ($playlist->type != "private") ? "true" : "false");
|
||||
$xplaylist->addAttribute('created', date("c", $playlist->date));
|
||||
$xplaylist->addAttribute('songCount', $playlist->get_song_count());
|
||||
$xplaylist->addAttribute('songCount', $playlist->get_media_count('song'));
|
||||
$xplaylist->addAttribute('duration', $playlist->get_total_duration());
|
||||
|
||||
if ($songs) {
|
||||
|
|
|
@ -281,6 +281,7 @@ class WebPlayer
|
|||
$js['replaygain_album_peak'] = $media->replaygain_album_peak;
|
||||
}
|
||||
$js['media_id'] = $media->id;
|
||||
$js['media_type'] = $urlinfo['type'];
|
||||
|
||||
if ($media->type != $types['real']) {
|
||||
$url .= '&transcode_to=' . $types['real'];
|
||||
|
|
|
@ -401,7 +401,7 @@ class XML_Data
|
|||
foreach ($playlists as $playlist_id) {
|
||||
$playlist = new Playlist($playlist_id);
|
||||
$playlist->format();
|
||||
$item_total = $playlist->get_song_count();
|
||||
$item_total = $playlist->get_media_count('song');
|
||||
|
||||
// Build this element
|
||||
$string .= "<playlist id=\"$playlist->id\">\n" .
|
||||
|
|
|
@ -42,7 +42,7 @@ switch ($_REQUEST['action']) {
|
|||
$object_ids = $playlist->get_items();
|
||||
ob_start();
|
||||
$browse = new Browse();
|
||||
$browse->set_type('playlist_song');
|
||||
$browse->set_type('playlist_media');
|
||||
$browse->add_supplemental_object('playlist',$playlist->id);
|
||||
$browse->save_objects($object_ids);
|
||||
$browse->show_objects($object_ids);
|
||||
|
@ -78,67 +78,26 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
|
||||
$songs = array();
|
||||
$medias = array();
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$item_type = $_REQUEST['item_type'];
|
||||
|
||||
switch ($_REQUEST['item_type']) {
|
||||
case 'search':
|
||||
debug_event('playlist', 'Adding all songs of smartplaylist {' . $item_id . '}...', 5);
|
||||
$smartplaylist = new Search($item_id, 'song');
|
||||
$items = $smartplaylist->get_items();
|
||||
foreach ($items as $item) {
|
||||
$songs[] = $item['object_id'];
|
||||
if (!empty($item_type) && Core::is_playable_item($item_type)) {
|
||||
debug_event('playlist', 'Adding all medias of ' . $item_type . '(s) {' . $item_id . '}...', 5);
|
||||
$item_ids = explode(',', $item_id);
|
||||
foreach ($item_ids as $iid) {
|
||||
$libitem = new $item_type($iid);
|
||||
$medias = array_merge($medias, $libitem->get_medias());
|
||||
}
|
||||
break;
|
||||
case 'album':
|
||||
debug_event('playlist', 'Adding all songs of album(s) {' . $item_id . '}...', 5);
|
||||
$albums_array = explode(',', $item_id);
|
||||
foreach ($albums_array as $a) {
|
||||
$album = new Album($a);
|
||||
$asongs = $album->get_songs();
|
||||
foreach ($asongs as $song_id) {
|
||||
$songs[] = $song_id;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'artist':
|
||||
debug_event('playlist', 'Adding all songs of artist {' . $item_id . '}...', 5);
|
||||
$artist = new Artist($item_id);
|
||||
$songs[] = $artist->get_songs();
|
||||
break;
|
||||
case 'song_preview':
|
||||
case 'song':
|
||||
debug_event('playlist', 'Adding song {' . $item_id . '}...', 5);
|
||||
$songs = explode(',', $item_id);
|
||||
break;
|
||||
case 'playlist':
|
||||
debug_event('playlist', 'Adding all songs of playlist {' . $item_id . '}...', 5);
|
||||
$pl = new Playlist($item_id);
|
||||
$songs = $pl->get_songs();
|
||||
break;
|
||||
default:
|
||||
debug_event('playlist', 'Adding all songs of current playlist...', 5);
|
||||
$objects = $GLOBALS['user']->playlist->get_items();
|
||||
|
||||
foreach ($objects as $object_data) {
|
||||
$type = array_shift($object_data);
|
||||
if ($type == 'song') {
|
||||
$songs[] = array_shift($object_data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
debug_event('playlist', 'Adding all medias of current playlist...', 5);
|
||||
$medias = $GLOBALS['user']->playlist->get_items();
|
||||
}
|
||||
|
||||
if (count($songs) > 0) {
|
||||
if (count($medias) > 0) {
|
||||
Ajax::set_include_override(true);
|
||||
$playlist->add_songs($songs, true);
|
||||
$playlist->add_medias($medias, true);
|
||||
|
||||
/*$playlist->format();
|
||||
$object_ids = $playlist->get_items();
|
||||
ob_start();
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_playlist.inc.php');
|
||||
$results['content'] = ob_get_contents();
|
||||
ob_end_clean();*/
|
||||
debug_event('playlist', 'Items added successfully!', '5');
|
||||
ob_start();
|
||||
display_notification(T_('Added to playlist'));
|
||||
|
|
|
@ -28,12 +28,12 @@ debug_event('refresh_reordered.server.php', 'Called for action: {' . $_REQUEST['
|
|||
|
||||
/* Switch on the action passed in */
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'refresh_playlist_songs':
|
||||
case 'refresh_playlist_medias':
|
||||
$playlist = new Playlist($_REQUEST['id']);
|
||||
$playlist->format();
|
||||
$object_ids = $playlist->get_items();
|
||||
$browse = new Browse();
|
||||
$browse->set_type('playlist_song');
|
||||
$browse->set_type('playlist_media');
|
||||
$browse->add_supplemental_object('playlist', $playlist->id);
|
||||
$browse->set_static_content(true);
|
||||
$browse->show_objects($object_ids);
|
||||
|
|
|
@ -70,6 +70,7 @@ function convertMediaToJPMedia(media)
|
|||
jpmedia['artist_id'] = media['artist_id'];
|
||||
jpmedia['album_id'] = media['album_id'];
|
||||
jpmedia['media_id'] = media['media_id'];
|
||||
jpmedia['media_type'] = media['media_type'];
|
||||
jpmedia['replaygain_track_gain'] = media['replaygain_track_gain'];
|
||||
jpmedia['replaygain_track_peak'] = media['replaygain_track_peak'];
|
||||
jpmedia['replaygain_album_gain'] = media['replaygain_album_gain'];
|
||||
|
@ -246,21 +247,24 @@ function ShowEqualizer()
|
|||
|
||||
function SavePlaylist()
|
||||
{
|
||||
var url = "<?php echo AmpConfig::get('ajax_url');
|
||||
?>?page=playlist&action=append_item&item_type=song&item_id=";
|
||||
if (jplaylist['playlist'].length > 0) {
|
||||
var url = "<?php echo AmpConfig::get('ajax_url') ?>?page=playlist&action=append_item&item_type=" + jplaylist['playlist'][0]["media_type"] + "&item_id=";
|
||||
for (var i = 0; i < jplaylist['playlist'].length; i++) {
|
||||
url += "," + jplaylist['playlist'][i]["media_id"];
|
||||
}
|
||||
handlePlaylistAction(url, 'rb_append_dplaylist_new');
|
||||
}
|
||||
}
|
||||
|
||||
function SaveToExistingPlaylist(event)
|
||||
{
|
||||
if (jplaylist['playlist'].length > 0) {
|
||||
var item_ids = "";
|
||||
for (var i = 0; i < jplaylist['playlist'].length; i++) {
|
||||
item_ids += "," + jplaylist['playlist'][i]["media_id"];
|
||||
}
|
||||
showPlaylistDialog(event, 'song', item_ids);
|
||||
showPlaylistDialog(event, jplaylist['playlist'][0]["media_type"], item_ids);
|
||||
}
|
||||
}
|
||||
|
||||
var audioContext = null;
|
||||
|
|
|
@ -66,7 +66,7 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
|
|||
?>', 'reorder_playlist_table', 'track_',
|
||||
'<?php echo AmpConfig::get('web_path');
|
||||
?>/playlist.php?action=set_track_numbers&playlist_id=<?php echo $playlist->id;
|
||||
?>', 'refresh_playlist_songs')">
|
||||
?>', 'refresh_playlist_medias')">
|
||||
<?php echo UI::get_icon('save', T_('Save Tracks Order'));
|
||||
?>
|
||||
<?php echo T_('Save Tracks Order');
|
||||
|
@ -168,7 +168,7 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
|
|||
<div id='reordered_list_<?php echo $playlist->id; ?>'>
|
||||
<?php
|
||||
$browse = new Browse();
|
||||
$browse->set_type('playlist_song');
|
||||
$browse->set_type('playlist_media');
|
||||
$browse->add_supplemental_object('playlist', $playlist->id);
|
||||
$browse->set_static_content(true);
|
||||
$browse->show_objects($object_ids, true);
|
||||
|
|
|
@ -20,29 +20,29 @@
|
|||
*
|
||||
*/
|
||||
|
||||
// Don't show disabled songs to normal users
|
||||
if ($libitem->enabled || Access::check('interface','50')) {
|
||||
// Don't show disabled medias to normal users
|
||||
if (!isset($libitem->enabled) || $libitem->enabled || Access::check('interface','50')) {
|
||||
?>
|
||||
<td class="cel_play">
|
||||
<span class="cel_play_content"><?php echo '<b>' . $playlist_track . '</b>' ?></span>
|
||||
<div class="cel_play_hover">
|
||||
<?php
|
||||
if (AmpConfig::get('directplay')) {
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id, 'play', T_('Play'),'play_playlist_song_' . $libitem->id);
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $libitem->id, 'play', T_('Play'),'play_playlist_' . $object_type . '_' . $libitem->id);
|
||||
if (Stream_Playlist::check_autoplay_append()) {
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $libitem->id);
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_' . $object_type . '_' . $libitem->id);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cel_song"><?php echo $libitem->f_link ?></td>
|
||||
<td class="cel_title"><?php echo $libitem->f_link ?></td>
|
||||
<td class="cel_add">
|
||||
<span class="cel_item_add">
|
||||
<?php echo Ajax::button('?action=basket&type=song&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'playlist_add_' . $libitem->id);
|
||||
<?php echo Ajax::button('?action=basket&type=' . $object_type . '&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'playlist_add_' . $libitem->id);
|
||||
if (Access::check('interface', '25')) {
|
||||
?>
|
||||
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, 'song', '<?php echo $libitem->id ?>')">
|
||||
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, '<?php echo $object_type ?>', '<?php echo $libitem->id ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')) ?>
|
||||
</a>
|
||||
<?php
|
||||
|
@ -50,19 +50,16 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="cel_artist"><?php echo $libitem->f_artist_link ?></td>
|
||||
<td class="cel_album"><?php echo $libitem->f_album_link ?></td>
|
||||
<td class="cel_tags"><?php echo $libitem->f_tags ?></td>
|
||||
<td class="cel_time"><?php echo $libitem->f_time ?></td>
|
||||
<?php if (User::is_registered()) {
|
||||
if (AmpConfig::get('ratings')) {
|
||||
?>
|
||||
<td class="cel_rating" id="rating_<?php echo $libitem->id ?>_song"><?php Rating::show($libitem->id,'song') ?></td>
|
||||
<td class="cel_rating" id="rating_<?php echo $libitem->id ?>_<?php echo $object_type ?>"><?php Rating::show($libitem->id,$object_type) ?></td>
|
||||
<?php
|
||||
}
|
||||
if (AmpConfig::get('userflags')) {
|
||||
?>
|
||||
<td class="cel_userflag" id="userflag_<?php echo $libitem->id ?>_song"><?php Userflag::show($libitem->id,'song') ?></td>
|
||||
<td class="cel_userflag" id="userflag_<?php echo $libitem->id ?>_<?php echo $object_type ?>"><?php Userflag::show($libitem->id,$object_type) ?></td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +67,14 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<td class="cel_action">
|
||||
<?php if (AmpConfig::get('download')) {
|
||||
?>
|
||||
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path') ?>/stream.php?action=download&song_id=<?php echo $libitem->id ?>">
|
||||
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path') ?>/stream.php?action=download&<?php echo $object_type ?>_id=<?php echo $libitem->id ?>">
|
||||
<?php echo UI::get_icon('download', T_('Download')) ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
if (Access::check('interface', '25')) {
|
||||
if (AmpConfig::get('share')) {
|
||||
Share::display_ui('song', $libitem->id, false);
|
||||
Share::display_ui($object_type, $libitem->id, false);
|
||||
}
|
||||
}
|
||||
if (get_class($playlist) == "Playlist" && $playlist->has_access()) {
|
|
@ -30,16 +30,13 @@ $web_path = AmpConfig::get('web_path');
|
|||
<thead>
|
||||
<tr class="th-top">
|
||||
<th class="cel_play essential"></th>
|
||||
<th class="cel_song essential persist"><?php echo T_('Song Title'); ?></th>
|
||||
<th class="cel_title essential persist"><?php echo T_('Title'); ?></th>
|
||||
<th class="cel_add essential"></th>
|
||||
<th class="cel_artist essential"><?php echo T_('Artist'); ?></th>
|
||||
<th class="cel_album optional"><?php echo T_('Album'); ?></th>
|
||||
<th class="cel_tags optional"><?php echo T_('Tags'); ?></th>
|
||||
<th class="cel_time optional"><?php echo T_('Time'); ?></th>
|
||||
<?php if (User::is_registered()) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('ratings')) {
|
||||
Rating::build_cache('song', array_map(create_function('$i', '$i=(array) $i; return $i[\'object_id\'];'), $object_ids));
|
||||
;
|
||||
?>
|
||||
<th class="cel_rating"><?php echo T_('Rating');
|
||||
?></th>
|
||||
|
@ -47,7 +44,6 @@ $web_path = AmpConfig::get('web_path');
|
|||
}
|
||||
?>
|
||||
<?php if (AmpConfig::get('userflags')) {
|
||||
Userflag::build_cache('song', array_map(create_function('$i', '$i=(array) $i; return $i[\'object_id\'];'), $object_ids));
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
|
@ -65,27 +61,26 @@ $web_path = AmpConfig::get('web_path');
|
|||
if (!is_array($object)) {
|
||||
$object = (array) $object;
|
||||
}
|
||||
$libitem = new Song($object['object_id']);
|
||||
$object_type = $object['object_type'];
|
||||
if (Core::is_library_item($object_type)) {
|
||||
$libitem = new $object_type($object['object_id']);
|
||||
$libitem->format();
|
||||
$playlist_track = $object['track'];
|
||||
?>
|
||||
<tr class="<?php echo UI::flip_class();
|
||||
?>" id="track_<?php echo $object['track_id'];
|
||||
?>">
|
||||
<?php require AmpConfig::get('prefix') . UI::find_template('show_playlist_song_row.inc.php');
|
||||
<tr class="<?php echo UI::flip_class() ?>" id="track_<?php echo $object['track_id'] ?>">
|
||||
<?php require AmpConfig::get('prefix') . UI::find_template('show_playlist_media_row.inc.php');
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
} ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="th-bottom">
|
||||
<th class="cel_play"><?php echo T_('Play'); ?></th>
|
||||
<th class="cel_song"><?php echo T_('Song Title'); ?></th>
|
||||
<th class="cel_title"><?php echo T_('Title'); ?></th>
|
||||
<th class="cel_add"></th>
|
||||
<th class="cel_artist"><?php echo T_('Artist'); ?></th>
|
||||
<th class="cel_album"><?php echo T_('Album'); ?></th>
|
||||
<th class="cel_tags"><?php echo T_('Tags'); ?></th>
|
||||
<th class="cel_time"><?php echo T_('Time'); ?></th>
|
||||
<?php if (User::is_registered()) {
|
||||
?>
|
|
@ -54,7 +54,7 @@
|
|||
</span>
|
||||
</td>
|
||||
<td class="cel_type"><?php echo $libitem->f_type; ?></td>
|
||||
<td class="cel_songs"><?php echo $libitem->get_song_count(); ?></td>
|
||||
<td class="cel_medias"><?php echo $libitem->get_media_count(); ?></td>
|
||||
<td class="cel_owner"><?php echo scrub_out($libitem->f_user); ?></td>
|
||||
<?php
|
||||
if (User::is_registered()) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<th class="cel_playlist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=name', T_('Playlist Name'),'playlist_sort_name'); ?></th>
|
||||
<th class="cel_add essential"></th>
|
||||
<th class="cel_type optional"><?php echo T_('Type'); ?></th>
|
||||
<th class="cel_songs optional"><?php echo T_('# Songs'); ?></th>
|
||||
<th class="cel_medias optional"><?php echo T_('# Medias'); ?></th>
|
||||
<th class="cel_owner optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=user', T_('Owner'),'playlist_sort_owner'); ?></th>
|
||||
<?php if (User::is_registered()) {
|
||||
?>
|
||||
|
@ -83,7 +83,7 @@
|
|||
<th class="cel_playlist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=name', T_('Playlist Name'),'playlist_sort_name'); ?></th>
|
||||
<th class="cel_add essential"></th>
|
||||
<th class="cel_type optional"><?php echo T_('Type'); ?></th>
|
||||
<th class="cel_songs optional"><?php echo T_('# Songs'); ?></th>
|
||||
<th class="cel_medias optional"><?php echo T_('# Medias'); ?></th>
|
||||
<th class="cel_owner optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=user', T_('Owner'),'playlist_sort_owner_bottom'); ?></th>
|
||||
<?php if (User::is_registered()) {
|
||||
?>
|
||||
|
|
|
@ -93,6 +93,8 @@
|
|||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php echo Ajax::button('?action=basket&type=podcast_episode&id=' . $episode->id,'add', T_('Add to temporary playlist'),'add_podcast_episode_' . $episode->id);
|
||||
?>
|
||||
<?php
|
||||
} ?>
|
||||
|
|
|
@ -37,6 +37,22 @@
|
|||
</div>
|
||||
</td>
|
||||
<td class="cel_title"><?php echo $libitem->f_link; ?></td>
|
||||
<td class="cel_add">
|
||||
<span class="cel_item_add">
|
||||
<?php
|
||||
echo Ajax::button('?action=basket&type=podcast_episode&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_' . $libitem->id);
|
||||
if (Access::check('interface', '25')) {
|
||||
?>
|
||||
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, 'podcast_episode', '<?php echo $libitem->id ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist'));
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="cel_podcast"><?php echo $libitem->f_podcast_link; ?></td>
|
||||
<td class="cel_time"><?php echo $libitem->f_time; ?></td>
|
||||
<td class="cel_pubdate"><?php echo $libitem->f_pubdate; ?></td>
|
||||
|
|
|
@ -29,6 +29,7 @@ $thcount = 7;
|
|||
<tr class="th-top">
|
||||
<th class="cel_play essential"></th>
|
||||
<th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', T_('Title'),'podcast_episode_sort_title'); ?></th>
|
||||
<th class="cel_add essential"></th>
|
||||
<th class="cel_podcast optional"><?php echo T_('Podcast'); ?></th>
|
||||
<th class="cel_time optional"><?php echo T_('Time'); ?></th>
|
||||
<th class="cel_pubdate optional"><?php echo T_('Publication Date'); ?></th>
|
||||
|
@ -98,6 +99,7 @@ $thcount = 7;
|
|||
<?php
|
||||
} ?>
|
||||
<th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', T_('Title'),'podcast_episode_sort_title_bottom'); ?></th>
|
||||
<th class="cel_add"></th>
|
||||
<th class="cel_podcast"><?php echo T_('Podcast'); ?></th>
|
||||
<th class="cel_time"><?php echo T_('Time'); ?></th>
|
||||
<th class="cel_pubdate"><?php echo T_('Publication Date'); ?></th>
|
||||
|
|
|
@ -74,7 +74,7 @@ UI::show_box_top('<div id="smartplaylist_row_' . $playlist->id . '">' . $title .
|
|||
<div>
|
||||
<?php
|
||||
$browse = new Browse();
|
||||
$browse->set_type('playlist_song');
|
||||
$browse->set_type('playlist_media');
|
||||
$browse->add_supplemental_object('search', $playlist->id);
|
||||
$browse->set_static_content(false);
|
||||
$browse->show_objects($object_ids);
|
||||
|
|
|
@ -112,6 +112,7 @@ $subtitles = $video->get_subtitles();
|
|||
?>
|
||||
<?php
|
||||
} ?>
|
||||
<?php echo Ajax::button('?action=basket&type=video&id=' . $video->id,'add', T_('Add to temporary playlist'),'add_video_' . $video->id); ?>
|
||||
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('sociable')) {
|
||||
|
|
|
@ -59,6 +59,22 @@ if (Art::is_enabled()) {
|
|||
<?php
|
||||
} ?>
|
||||
<td class="cel_title"><?php echo $libitem->f_link; ?></td>
|
||||
<td class="cel_add">
|
||||
<span class="cel_item_add">
|
||||
<?php
|
||||
echo Ajax::button('?action=basket&type=video&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_' . $libitem->id);
|
||||
if (Access::check('interface', '25')) {
|
||||
?>
|
||||
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, 'video', '<?php echo $libitem->id ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist'));
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
<?php
|
||||
if ($video_type != 'video') {
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_partial_' . $video_type . '_row.inc.php');
|
||||
|
|
|
@ -36,6 +36,7 @@ if ($browse->get_show_header()) {
|
|||
<?php
|
||||
} ?>
|
||||
<th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th>
|
||||
<th class="cel_add essential"></th>
|
||||
<?php
|
||||
if (isset($video_type) && $video_type != 'video') {
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_partial_' . $video_type . 's.inc.php');
|
||||
|
@ -112,6 +113,7 @@ if (isset($video_type) && $video_type != 'video') {
|
|||
<?php
|
||||
} ?>
|
||||
<th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th>
|
||||
<th class="cel_add"></th>
|
||||
<?php
|
||||
if (isset($video_type) && $video_type != 'video') {
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_partial_' . $video_type . 's.inc.php');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue