public function actionView() { $radioId = Yii::app()->request->getParam("id", 0); $radioName = WapRadioModel::model()->findByPk($radioId)->name; $albumId = WapRadioModel::model()->getAlbumByRadio($radioId, "c2.id"); $radioAvatar = RadioModel::model()->getAvatarUrl($radioId, 's1'); $album = WapAlbumModel::model()->published()->findByPk($albumId); if (!$album) { $this->forward("/site/error", true); } $songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($albumId); $artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId); $phone = yii::app()->user->getState('msisdn'); $errorCode = 'success'; $errorDescription = ''; $registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT'); ///meta tag $AlbumDetail = AlbumModel::model()->findByPk($albumId); $artistId = !empty($artists) ? $artists[0]->artist_id : $AlbumDetail->artist_id; $ArtistInfo = ArtistModel::model()->findByPk($artistId); $this->itemName = $AlbumDetail->name; $this->artist = $ArtistInfo->name; $this->thumb = AlbumModel::model()->getAvatarUrl($albumId, 's1'); $this->url = URLHelper::buildFriendlyURL("album", $albumId, Common::makeFriendlyUrl($ArtistInfo->name)); $this->description = strip_tags($AlbumDetail->description); //get other radio $parent_id = Yii::app()->params['horoscope']['parent_id']; $radioListOther = WapRadioModel::model()->getHoroscopes($parent_id); $this->render('detail', array('album' => $album, 'songsOfAlbum' => $songsOfAlbum, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'registerText' => $registerText, 'radioListOther' => $radioListOther, 'radioAvatar' => $radioAvatar)); }
public static function ArtistsByAlbumForWapDetail($id) { $artists = AlbumArtistModel::model()->getArtistsByAlbum($id); $i = 0; $html = ""; foreach ($artists as $artist) { $html .= $i > 0 ? " - " : ""; $html .= '<a href="' . URLHelper::buildFriendlyURL("artist", $artist->artist_id, Common::makeFriendlyUrl($artist->artist_name)) . '">' . $artist->artist_name . '</a>'; $i++; } return $html; }
public function actionDetail() { $this->forward("/site/error", true); $new_id = (int) Yii::app()->request->getParam('id'); $from = Yii::app()->request->getParam('from', ''); $news = $detailnew = NewsModel::model()->findByPk($new_id); if (empty($news)) { $this->forward("/site/error", true); } $this->itemName = htmlspecialchars($detailnew->title); $this->keyword = $detailnew->title; $this->thumb = NewsModel::model()->getAvatarUrl($new_id, 's1'); $this->url = URLHelper::buildFriendlyURL("news", $detailnew ? $new_id : 0, Common::makeFriendlyUrl($detailnew->title ? $detailnew->title : " ")); $this->description = ""; if ($from == 'api') { $this->layout = false; } $this->render('detail', compact('news', 'from')); }
public function actionView() { $playlistId = Yii::app()->request->getParam('id'); $playlist = WapPlaylistModel::model()->published()->findByPk($playlistId); $user_msisdn = $playlist->msisdn; if (!$playlist) { $this->forward("/site/error", true); } $songsOfPlaylist = WapPlaylistModel::model()->getSongs($playlistId); //samge user $countPlSameUser = WapPlaylistModel::model()->countPlaylistByPhone($this->userPhone); $playlistPages = new CPagination($countPlSameUser); $pageSize = Yii::app()->params['pageSize']; $playlistPages->setPageSize($pageSize); $currentPage = $playlistPages->getCurrentPage(); $playlistsSameUser = WapPlaylistModel::model()->getSamePlaylistByPhone($playlist->id, $this->userPhone, $currentPage * $pageSize, $pageSize); $errorCode = 'success'; $errorDescription = ''; //for show price $checkPlay = WapUserTransactionModel::model()->checkCharging24h($this->userPhone, $this->userPhone, $playlistId, 'play_album'); $userSub = $this->userSub; //WapUserSubscribeModel::model()->getUserSubscribe($phone); if ($checkPlay) { $playPrice = 0; } else { if ($userSub) { $playPrice = 0; } } if ($checkPlay) { $playPrice = 0; } // $registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT'); $this->itemName = $playlist->name; $this->artist = "Chacha"; //$playlist->username; $this->thumb = UserModel::model()->getThumbnailUrl('s1', $playlist->user_id); $this->url = URLHelper::buildFriendlyURL("playlist", $playlist->id, Common::makeFriendlyUrl($playlist->name)); $this->description = $playlist->name; $this->render('view', array('playlist' => $playlist, 'songsOfPlaylist' => $songsOfPlaylist, 'playlistsSameUser' => $playlistsSameUser, 'playlistPages' => $playlistPages, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'userSub' => $userSub, 'user_msisdn' => $user_msisdn)); }
public function actionViewType() { $artistId = Yii::app()->request->getParam('id'); $artist = ArtistModel::model()->findByPk($artistId); $this->artist = $artist->name; $this->thumb = ArtistModel::model()->getAvatarUrl($artist->id, 150); $this->url = URLHelper::buildFriendlyURL("artist", $artist->id, $artist->url_key); if (!$artist) { $this->forward("/site/error", true); } $listType = Yii::app()->request->getParam('list', 'song'); $countSongsOfArtist = $artist->song_count; $countClipsOfArtist = $artist->video_count; $countAlbumsOfArtist = $artist->album_count; $pageSize = Yii::app()->params['numberSongsPerPage']; if ($listType == 'song') { // in case that list songs of artist $songPages = new CPagination($countSongsOfArtist); $songPages->setPageSize($pageSize); $currentPage = $songPages->getCurrentPage(); $songsOfArtist = WapSongModel::model()->getSongsSameSinger(0, $artist->id, $currentPage * $pageSize, $pageSize); $this->render('viewtype', array('artist' => $artist, 'listType' => $listType, 'countSongsOfArtist' => $countSongsOfArtist, 'countClipsOfArtist' => $countClipsOfArtist, 'countAlbumsOfArtist' => $countAlbumsOfArtist, 'songsOfArtist' => $songsOfArtist, 'songPages' => $songPages)); } elseif ($listType == 'clip') { // in case that list clips of artist $clipPages = new CPagination($countClipsOfArtist); $clipPages->setPageSize($pageSize); $currentPage = $clipPages->getCurrentPage(); $clipsOfArtist = WapVideoModel::model()->getVideosSameArtist(0, $artist->id, $currentPage * $pageSize, $pageSize); $this->render('viewtype', array('artist' => $artist, 'listType' => $listType, 'countSongsOfArtist' => $countSongsOfArtist, 'countClipsOfArtist' => $countClipsOfArtist, 'countAlbumsOfArtist' => $countAlbumsOfArtist, 'clipsOfArtist' => $clipsOfArtist, 'clipPages' => $clipPages)); } else { // in case that list albums of artist $albumPages = new CPagination($countAlbumsOfArtist); $albumPages->setPageSize($pageSize); $currentPage = $albumPages->getCurrentPage(); $albumsOfArtist = WapAlbumModel::model()->getAlbumsSameArtist(0, $artist->id, $currentPage * $pageSize, $pageSize); $this->render('viewtype', array('artist' => $artist, 'listType' => $listType, 'countSongsOfArtist' => $countSongsOfArtist, 'countClipsOfArtist' => $countClipsOfArtist, 'countAlbumsOfArtist' => $countAlbumsOfArtist, 'albumsOfArtist' => $albumsOfArtist, 'albumPages' => $albumPages)); } }
public function actionView() { $id = (int) Yii::app()->request->getParam('id', 0); $playUrl = Yii::app()->request->getParam('url', null); $lyric = (int) Yii::app()->request->getParam('lyric', 0); $song = WapSongModel::model()->available()->findByPk($id); $isDeactive = false; if (!$song || $song->status == SongModel::DELETED) { $this->forward("/site/error", true); } elseif ($song->status == SongModel::DEACTIVE) { $isDeactive = true; } $artistId = SongArtistModel::model()->getArtistBySong($id, 'id'); if ($artistId) { $artistId = $artistId[0]; } else { $artistId = 0; } $genreId = SongGenreModel::model()->getCatBySong($song->id, false, true); if ($genreId) { $genreId = $genreId[0]; } else { $genreId = 0; } //--- Check quyền nghe bài hát này $userType = "GUEST"; if (Yii::app()->user->getState('msisdn')) { $userType = "MEMBER"; } if (!empty($this->userSub)) { if (isset($this->userSub->package) && !empty($this->userSub->package)) { $package = $this->userSub->package->code; } $package = strtoupper($package); $userType = "SUB_" . $package; } $per = ContentLimitModel::getPermision($song->id, "song", $userType, "WAP"); //---End check quyền nghe bài hát này $count = WapSongModel::model()->countSongsSameSinger($song->id, $artistId); $pager = new CPagination($count); $limit = Yii::app()->params['numberPerPage']; if ($this->layout == 'application.views.wap.layouts.main') { $limit = Yii::app()->params['numberSongPerPageWap']; } $pager->setPageSize($limit); $songArtist = WapSongModel::model()->getSongsSameSinger($song->id, $artistId, $pager->getOffset(), $pager->getLimit()); $callBackLink = Yii::app()->createUrl("song/artist", array('song_id' => $song->id, 'artist_id' => $artistId)); // check like $like = null; $favourite = Yii::app()->request->getParam('favourite', null); $user_id = Yii::app()->user->id; $phone = yii::app()->user->getState('msisdn'); $artist_name = Common::makeFriendlyUrl($song->artist_name); $back_url = Yii::app()->params['base_url'] . Yii::app()->createUrl('song/view', array('id' => $song->id, 'url_key' => Common::makeFriendlyUrl($song->name), 'artist' => $artist_name)); if (isset($favourite) && $favourite == 1) { //yeu thich video if (!empty($phone)) { $fav = WapFavouriteSongModel::model()->favouriteSong($id, $phone, $phone); } else { $this->redirect($this->createUrl("/account/login", array('back_url' => $back_url))); } } elseif (isset($favourite) && $favourite == 0) { if (!empty($user_id)) { $res = WapFavouriteSongModel::model()->deleteAll("song_id={$id} AND msisdn={$phone}"); } else { $this->redirect($this->createUrl("/account/login", array('back_url' => $back_url))); } } if ($phone) { $like = WapFavouriteSongModel::model()->findByAttributes(array('song_id' => $song->id, 'msisdn' => $phone)); } // Get Song Meta Data $Artist = ArtistModel::model()->findByPk($song->song_artist[0]->artist_id); $this->url = URLHelper::buildFriendlyURL("song", $song->id, $song->url_key); $this->itemName = $song->name; $this->artist = $Artist ? $Artist->name : 'Music'; $this->thumb = ArtistModel::model()->getAvatarUrl($song->song_artist[0]->artist_id, 's1'); $userSub = $this->userSub; $this->render('view', compact('song', 'songArtist', 'pager', 'callBackLink', 'artistId', 'genreId', 'like', 'per', 'lyric', 'playUrl', 'isDeactive')); }
/** * function actionView * call to render detail album page */ public function actionView() { $albumId = (int) Yii::app()->request->getParam('id'); $album = WapAlbumModel::model()->available()->findByPk($albumId); if (!$album) { $this->forward("/site/error", true); } else { if ($album->status == 0) { $deactive = true; } } $songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($albumId); //samge artist $countAlbumsSameArtist = WapAlbumModel::model()->countAlbumsSameArtist($album->id, $album->artist_id); $albumPages = new CPagination($countAlbumsSameArtist); $pageSize = Yii::app()->params['pageSize']; $albumPages->setPageSize($pageSize); $currentPage = $albumPages->getCurrentPage(); /* NEW */ $artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId); $artistIds = ''; if ($artists) { foreach ($artists as $artist) { $artistIds .= ',' . $artist->artist_id; } } $artistIds = $artistIds != '' ? substr($artistIds, 1) : ''; $albumsSameArtist = WapAlbumModel::model()->getAlbumbyArtists($artistIds, $pageSize, $currentPage * $pageSize); /* END */ $phone = yii::app()->user->getState('msisdn'); $errorCode = 'success'; $errorDescription = ''; //for show price $favourite = Yii::app()->request->getParam('favourite', null); $phone = yii::app()->user->getState('msisdn'); $user_id = Yii::app()->user->id; if (isset($favourite) && $favourite == 0) { if (!empty($user_id)) { $res = WapFavouriteAlbumModel::model()->deleteAllByAttributes(array('msisdn' => $phone, 'album_id' => $albumId)); } else { $this->redirect($this->createUrl("/account/login")); } } if (isset($favourite) && $favourite == 1) { if (!empty($phone)) { $res = WapFavouriteAlbumModel::model()->favouriteAlbum($phone, $albumId); } else { $this->redirect($this->createUrl("/account/login")); } } $like = null; if ($phone) { $like = FavouriteAlbumModel::model()->findByAttributes(array('album_id' => $albumId, 'msisdn' => $phone)); } $userType = "GUEST"; $phone = Yii::app()->user->getState('phone'); if ($phone) { $userType = "MEMBER"; } $userSub = Yii::app()->user->getState('userSub'); $packageCode = Yii::app()->user->getState('packageCode'); if ($userSub) { $userType = "SUB_" . $packageCode; } $perLimit = ContentLimitModel::getPermision($albumId, "album", $userType, "WAP"); ///meta tag $AlbumDetail = AlbumModel::model()->findByPk($albumId); $artistId = !empty($artists) ? $artists[0]->artist_id : $AlbumDetail->artist_id; $ArtistInfo = ArtistModel::model()->findByPk($artistId); $this->itemName = $AlbumDetail->name; $this->artist = $ArtistInfo->name; $this->thumb = AlbumModel::model()->getAvatarUrl($albumId, 's1'); $this->url = URLHelper::buildFriendlyURL("album", $albumId, Common::makeFriendlyUrl($ArtistInfo->name)); $this->description = strip_tags($AlbumDetail->description); $this->render('view', array('album' => $album, 'songsOfAlbum' => $songsOfAlbum, 'albumsSameArtist' => $albumsSameArtist, 'albumPages' => $albumPages, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'userSub' => $userSub, 'like' => $like, 'perLimit' => $perLimit, 'deactive' => $deactive)); }
public function actionView() { $id = (int) Yii::app()->request->getParam('id', 0); $playUrl = Yii::app()->request->getParam('url', null); $video = WapVideoModel::model()->available()->findByPk($id); $deactive = false; if (!$video || $video->status == VideoModel::DELETED) { $this->forward("/site/error", true); } else { if ($video->status == VideoModel::DEACTIVE) { $deactive = true; } } $genreId = $video->genre_id; $artistId = VideoArtistModel::model()->getArtistByVideo($video->id, 'id'); $genreId = isset($genreId[0]) ? $genreId[0] : 0; $artistId = isset($artistId[0]) ? $artistId[0] : 0; $count = WapVideoModel::model()->countVideosSameArtist($id, $artistId); $pager = new CPagination($count); $pager->setPageSize(Yii::app()->params['numberPerPage']); $videoSameArtist = WapVideoModel::model()->getVideosSameArtist($id, $artistId, $pager->getOffset(), $pager->getLimit()); $callBackLink = Yii::app()->createUrl("video/loadAjax", array('s' => 'artist', 'artist_id' => $artistId)); //--- Check quyền nghe bài hát này $userType = "GUEST"; if (Yii::app()->user->getState('msisdn')) { $userType = "MEMBER"; } if (!empty($this->userSub)) { if (isset($this->userSub->package) && !empty($this->userSub->package)) { $package = $this->userSub->package->code; } $package = strtoupper($package); $userType = "SUB_" . $package; } $per = ContentLimitModel::getPermision($video->id, "video", $userType, "WAP"); //---End check quyền nghe bài hát này // check like $like = null; $favourite = Yii::app()->request->getParam('favourite', null); $user_id = Yii::app()->user->id; $phone = yii::app()->user->getState('msisdn'); $back_url = Yii::app()->params['base_url'] . Yii::app()->createUrl('video/view', array('id' => $id, 'url_key' => Common::makeFriendlyUrl($video->name))); if (isset($favourite) && $favourite == 1) { //yeu thich video if (!empty($user_id)) { $fav = WapFavouriteVideoModel::model()->favouriteVideo($id, $phone); } else { $this->redirect($this->createUrl("/account/login", array('back_url' => $back_url))); } } elseif (isset($favourite) && $favourite == 0) { if (!empty($user_id)) { $res = WapFavouriteVideoModel::model()->deleteAllByAttributes(array('msisdn' => $phone, 'video_id' => $id)); } else { $this->redirect($this->createUrl("/account/login", array('back_url' => $back_url))); } } if ($phone) { $like = WapFavouriteVideoModel::model()->findByAttributes(array('video_id' => $video->id, 'msisdn' => $phone)); } //meta data $this->itemName = $video->name; $this->artist = $video->artist_name; $this->thumb = VideoModel::model()->getAvatarUrl($video->id, 's1'); $this->lyric = ""; $videourl = URLHelper::buildFriendlyURL("video/view", $video->id, Common::makeFriendlyUrl($video->name)); $this->url = $videourl; $this->render('view', compact('video', 'genreId', 'artistId', 'videoSameArtist', 'pager', 'callBackLink', 'like', 'collectionCode', 'per', 'playUrl', 'deactive')); }