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


PHP Track::getTrackList方法代码示例

本文整理汇总了PHP中Track::getTrackList方法的典型用法代码示例。如果您正苦于以下问题:PHP Track::getTrackList方法的具体用法?PHP Track::getTrackList怎么用?PHP Track::getTrackList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Track的用法示例。


在下文中一共展示了Track::getTrackList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Exception

 public function &getTracks($userid, $start = 0, $display = 30)
 {
     if ($this->id == NULL) {
         throw new Exception("Missing playlist ID when getting playlist's tracks");
     }
     if ($this->tracks == NULL) {
         $this->load->static_model('Track');
         $query = "SELECT SQL_CALC_FOUND_ROWS a.name AS `album_name`, a.id AS `album_id`, t.*, art.id AS `artist_id`, art.name AS `artist_name`, ut.bought\n\t    FROM `track` t, `artist` art,`album` a, `album_track` at, `playlist_track` pt\n\t    LEFT JOIN `user_track` ut ON(ut.trackid = pt.trackid AND ut.userid = " . $this->db->escape($userid) . ")\n\t    WHERE pt.playlistid = " . $this->db->escape($this->id) . " AND pt.albumid = a.id AND pt.trackid = t.id   \n\t    AND t.main_artistid = art.id AND t.id = at.`trackid` AND a.id = at.`albumid` ORDER BY pt.`play_order`";
         if ($display > 0) {
             $query .= " LIMIT {$start}, {$display}";
         }
         $this->tracks = Track::getTrackList($query);
     }
     $result = array("tracks" => NULL, "rows" => NULL);
     $result["tracks"] = $this->tracks;
     $res = $this->db->query("SELECT FOUND_ROWS() AS num_rows")->first_row();
     $result["rows"] = $res->num_rows;
     return $result;
 }
开发者ID:bennetimo,项目名称:comp3013,代码行数:19,代码来源:playlist.php

示例2: getTracks

 /**
  * get the tracks where this
  * artist is the main
  * @return array of Track
  */
 public function getTracks()
 {
     if ($this->artistid == NULL) {
         throw new Exception("Missing track ID when requesting artist' track");
     }
     //find the track id
     $query = "SELECT trackid FROM artist_track WHERE artistid = " . $this->db->escape($this->artistid);
     $tids = $this->db->query($query)->result();
     if (count($tids) > 0) {
         $track_ids = "";
         foreach ($tids as $tid) {
             $track_ids .= $tid->trackid . ",";
         }
         //remove the last comma
         $track_ids = substr($track_ids, 0, -1);
         $query = "SELECT a.`year`, a.name AS `album_name`, a.id AS `album_id`, t.*, art.id AS `artist_id`, art.name AS `artist_name`\n    FROM `album_track` at, `track` t, `artist` art,`album` a, `track_genre` tg, `genre` g\n     \n    WHERE t.main_artistid = art.id AND t.id in ({$track_ids}) \n    AND t.id = at.`trackid` AND a.id = at.`albumid` AND g.id = tg.genreid AND t.id = tg.trackid \n    ORDER BY a.`year`";
         return Track::getTrackList($query);
     }
     return array();
 }
开发者ID:bennetimo,项目名称:comp3013,代码行数:25,代码来源:artist.php


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