<?php require_once 'PlayList.class.php'; $pl = new PlayList(); $pl->genPls();
$path = pathinfo($item['location']); if (strtolower($item['extension']) == "mp3") { $aResult[] = $item; } } return $aResult; } } class rmvbPlayListDelegation { function getPlayList($songs) { $aResult = array(); foreach ($songs as $key => $item) { $path = pathinfo($item['location']); if (strtolower($item['extension']) == "rmvb") { $aResult[] = $item; } } return $aResult; } } echo '<pre>'; $oMP3PlayList = new PlayList("mp3"); $oMP3PlayList->addSong('usa', 'to be loved', 'mp3'); $oMP3PlayList->addSong('usa', 'to be', 'mp3'); var_dump($oMP3PlayList->getPlayList()); $oRMVBPlayList = new PlayList("rmvb"); $oRMVBPlayList->addSong('cn', 'moon', 'rmvb'); $oRMVBPlayList->addSong('cn', 'ccc', 'rmvb'); var_dump($oRMVBPlayList->getPlayList());
/** ----- GETPLAYLIST **/ function getPlaylist($id) { $result = array(); $sql = " SELECT SQL_NO_CACHE * FROM playlist WHERE IDPlaylist = :id "; $params = array(":id" => $id); $sth = $this->db->prepare($sql); $sth->execute($params); if ($sth->rowCount() == 1) { $unePlayList = $sth->fetch(PDO::FETCH_OBJ); $playlist = new PlayList($unePlayList->IDPlaylist, $unePlayList->Title, $unePlayList->Cover, $unePlayList->Create_time, $unePlayList->UpdateDate); $playlist->setTracks(null); array_push($result, $playlist); } return $result; }