当前位置: 首页>>代码示例>>PHP>>正文


PHP Playlist::delete_track方法代码示例

本文整理汇总了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;
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:playlist.php

示例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
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:playlist.ajax.php


注:本文中的Playlist::delete_track方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。