本文整理匯總了PHP中Playlist::delete_track方法的典型用法代碼示例。如果您正苦於以下問題:PHP Playlist::delete_track方法的具體用法?PHP Playlist::delete_track怎麽用?PHP Playlist::delete_track使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Playlist
的用法示例。
在下文中一共展示了Playlist::delete_track方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
}
$tracks_to_rm = array();
$map = array();
$items = $playlist->get_items();
foreach ($items as $item) {
if (!array_key_exists($item['object_type'], $map)) {
$map[$item['object_type']] = array();
}
if (!in_array($item['object_id'], $map[$item['object_type']])) {
$map[$item['object_type']][] = $item['object_id'];
} else {
$tracks_to_rm[] = $item['track_id'];
}
}
foreach ($tracks_to_rm as $track_id) {
$playlist->delete_track($track_id);
}
$object_ids = $playlist->get_items();
require_once AmpConfig::get('prefix') . UI::find_template('show_playlist.inc.php');
break;
case 'sort_tracks':
$playlist = new Playlist($_REQUEST['playlist_id']);
if (!$playlist->has_access()) {
access_denied();
break;
}
/* Sort the tracks */
$playlist->sort_tracks();
$object_ids = $playlist->get_items();
require_once AmpConfig::get('prefix') . UI::find_template('show_playlist.inc.php');
break;
示例2: array
*
*/
/**
* Sub-Ajax page, requires AJAX_INCLUDE
*/
if (!defined('AJAX_INCLUDE')) {
exit;
}
$results = array();
switch ($_REQUEST['action']) {
case 'delete_track':
// Create the object and remove the track
$playlist = new Playlist($_REQUEST['playlist_id']);
$playlist->format();
if ($playlist->has_access()) {
$playlist->delete_track($_REQUEST['track_id']);
// This could have performance issues
$playlist->regenerate_track_numbers();
}
$object_ids = $playlist->get_items();
ob_start();
$browse = new Browse();
$browse->set_type('playlist_song');
$browse->add_supplemental_object('playlist', $playlist->id);
$browse->save_objects($object_ids);
$browse->show_objects($object_ids);
$browse->store();
$results[$browse->get_content_div()] = ob_get_clean();
break;
case 'append_item':
// Only song item are supported with playlists