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; }
/** * Load same album via Ajax */ public function actionLoadAjax() { $s = CHtml::encode(Yii::app()->request->getParam('s')); $albumId = Yii::app()->request->getParam('id', 0); $artist_id = (int) Yii::app()->request->getParam('artist_id', 0); $genre_id = (int) Yii::app()->request->getParam('genre_id', 0); if ($s == 'genre') { $countAlbumsSameGenre = WapAlbumModel::model()->countAlbumsSameGenre($albumId, $genre_id); $albumPages = new CPagination($countAlbumsSameGenre); $pageSize = Yii::app()->params['pageSize']; $albumPages->setPageSize($pageSize); $currentPage = $albumPages->getCurrentPage(); $data = WapAlbumModel::model()->getAlbumsSameGenre($albumId, $genre_id, $currentPage * $pageSize, $pageSize); } else { $countAlbumsSameArtist = AlbumArtistModel::model()->countAlbumByArtist($artist_id); $albumPages = new CPagination($countAlbumsSameArtist); $pageSize = Yii::app()->params['pageSize']; $albumPages->setPageSize($pageSize); $currentPage = $albumPages->getCurrentPage(); // $data = WapAlbumModel::model()->getAlbumsSameArtist($albumId, $artist_id, $currentPage * $pageSize, $pageSize); /* NEW */ $artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId); $artistIds = ''; if ($artists) { foreach ($artists as $artist) { $artistIds .= ',' . $artist->artist_id; } } $artistIds = $artistIds != '' ? substr($artistIds, 1) : ''; $data = $albumsSameArtist = WapAlbumModel::model()->getAlbumbyArtists($artistIds, $pageSize, $currentPage * $pageSize); /* END */ } $this->renderPartial('_same', array('albums' => $data), false, true); }