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)); }
/** * function actionIndex * call to render hot video playlist page */ public function actionIndex() { $limit = Yii::app()->params['numberPerPage']; $c = CHtml::encode(Yii::app()->request->getParam('c', '0')); $c = !empty($c) ? $c : '0'; $s = CHtml::encode(Yii::app()->request->getParam('s')); $s = !empty($s) ? $s : Yii::t('wap', 'Hot'); $cTitle = $c == 0 ? Yii::t('wap', 'All genres') : WapGenreModel::model()->findByPk($c)->name; $sTitle = 'HOT'; $page = (int) Yii::app()->request->getParam('page', 1); $callBack = (int) Yii::app()->request->getParam('call_back', 0); $callBackLink = Yii::app()->createUrl("videoPlaylist/index", array('type' => $c, 's' => $s, 'c' => $c)); $options = array(); if ($c == 0) { if ($s == 'NEW') { $sTitle = 'MỚI'; $count = WapVideoPlaylistModel::countListByCollection('VIDEO_PLAYLIST_NEW'); $videoPlaylists = WapVideoPlaylistModel::getLisNew($page, $limit); $options = array('col' => 'VIDEO_PLAYLIST_NEW'); } else { $count = WapVideoPlaylistModel::countListByCollection('VIDEO_PLAYLIST_HOT'); $videoPlaylists = WapVideoPlaylistModel::getListHot($page, $limit); $options = array('col' => 'VIDEO_PLAYLIST_HOT'); } $pager = new CPagination($count); $pager->setPageSize($limit); } else { $count = WapVideoPlaylistModel::model()->countByGenre($c); $pager = new CPagination($count); $pager->setPageSize($limit); if ($s == 'NEW') { $sTitle = 'MỚI'; $albums = WapAlbumModel::model()->getAlbumsByGenre($c, $pager->getOffset(), $pager->getLimit(), 'new'); } else { $albums = WapAlbumModel::model()->getAlbumsByGenre($c, $pager->getOffset(), $pager->getLimit(), 'hot'); } } $pager = new CPagination($count); $pager->setPageSize($limit); if ($callBack) { $this->layout = false; $this->render("_ajaxList", compact('videoPlaylists', 'pager', 'callBackLink', 'options')); } else { $this->render('index', array('videoPlaylists' => $videoPlaylists, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options)); } }
/** * bai hat yeu thich */ public function actionFavAlbum() { $phone = yii::app()->user->getState('msisdn'); $cri = new CDbCriteria(); $cri->condition = " phone = {$phone}"; $user = UserModel::model()->find($cri); $uid = $user->id; $limit = Yii::app()->params['pageSize']; $pageSize = Yii::app()->params['pageSize']; $page = Yii::app()->request->getParam('page', 1); $offset = ($page - 1) * $limit; $countAlbum = WapAlbumModel::model()->countFavAlbum($uid); $albumPages = new CPagination($countAlbum); $albumPages->setPageSize($pageSize); $favalbum = WapAlbumModel::model()->getFavAlbum($phone, $limit, $offset); $headerText = Yii::t('chachawap', 'Album yêu thích'); $link = $link = Yii::app()->createUrl("/account/favalbum"); $this->render('albumlist', array('albums' => $favalbum, 'link' => $link, 'type' => "list", 'headerText' => $headerText, 'albumPages' => $albumPages)); }
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)); } }
<?php if ($albums) { $i = 0; ?> <?php foreach ($albums as $value) { ?> <?php if ($i % 2 == 0) { ?> <div class="item_row"><?php } ?> <?php $albumLink = yii::app()->createUrl('album/view', array('id' => $value['id'], 'url_key' => Common::makeFriendlyUrl($value['name']), "artist" => Common::makeFriendlyUrl(trim($value['artist_name'])))); $avatarImage = WapAlbumModel::model()->getThumbnailUrl('s2', $value['id']); ?> <div class="item"> <a href="<?php echo $albumLink; ?> "> <div class="wrr-item-detail"> <img src="<?php echo $avatarImage; ?> " /> <div class="info-nav"> <p class="title subtext"><?php echo CHtml::encode($value['name']); ?>
<div class="page-404"> <?php $albums = MainContentModel::getListByCollection('ALBUM_HOT', 0, 4); ?> <p class="img-404"> <img src="/touch/images/404.png"/> </p> <ul class="album_list items-list pt30"> <?php $i = 0; foreach ($albums as $key => $album) { $artist_name = ArtistHelper::ArtistNamesByAlbum($album['id']); $i++; $albumLink = yii::app()->createUrl('album/view', array('id' => $album['id'], 'url_key' => Common::makeFriendlyUrl($album['name']), "artist" => Common::makeFriendlyUrl(trim($album['artist_name'])))); if ($album['id']) { $avatarImage = CHtml::image(WapAlbumModel::model()->getThumbnailUrl(100, $album['id']), 'avatar', array('class' => 'avatar')); } else { $avatarImage = CHtml::image('/images/icon/clip-50.png', '', array('class' => 'avatar')); } ?> <li class="item <?php if ($i == count($albums)) { echo 'last_item'; } ?> "> <a href="<?php echo $albumLink; ?> "> <?php
<?php if ($album->id) { $avatarImage = CHtml::image(WapAlbumModel::model()->getThumbnailUrl("s4", $album->id), $album->name, array('class' => 'avatar')); } else { $avatarImage = CHtml::image('/touch/css/wap/images/icon/clip-50.png', '', array('class' => 'avatar')); } $artist_name = $album->artist_name; ?> <div class="vg_album"> <?php echo $avatarImage; ?> <h3 class="name"><?php echo CHtml::encode($album->name); ?> </h3> <p class="artist subtext"><?php echo CHtml::encode($artist_name); ?> </p> </div> <?php if ($perLimit) { ?> <div class="limit_content"> <div class="msglimit"> <?php echo $perLimit->msg_warning; ?> <a class="underline" href="<?php
/** * 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); }
echo $pager->getCurrentPage() + 1; ?> "> <input type="hidden" class="curent-page" value="<?php echo $pager->getCurrentPage() + 1; ?> "> </li> <?php $i = $limit * $pager->getCurrentPage(); foreach ($topWeek as $album) { $i++; $link = Yii::app()->createUrl('album/view', array('id' => $album->id, 'url_key' => Common::makeFriendlyUrl($album->name), "artist" => Common::makeFriendlyUrl(trim($album->artist_name)))); $artist_name = WapArtistModel::model()->findByPk($album->artist_id)->name; $avatarImage = CHtml::image(WapAlbumModel::model()->getThumbnailUrl('s1', $album->id), 'avatar', array('class' => 'avatar')); ?> <li data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="d" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-d"> <div class="ui-btn-inner ui-li"> <div class="ui-btn-text"> <span class="xbh-count-album index"><?php echo $i; ?> </span> <a class="i-list ui-link-inherit" href="<?php echo $link; ?> "> <span
if (!empty($albums)) { ?> <div class="box-content clear"> <ul class="album_list"> <?php $i = 0; foreach ($albums as $key => $album) { //$artist_name = WapArtistModel::model()->findByPk($album->artist_id)->name; $i++; $albumLink = yii::app()->createUrl('album/view', array('id' => $album->id, 'url_key' => Common::makeFriendlyUrl($album->name))); if (isset($options['col']) && $options['col']) { $albumLink = yii::app()->createUrl('album/view', array('id' => $album->id, 'url_key' => Common::makeFriendlyUrl($album->name), 'src' => $options['col'])); } if ($album->id) { $avatarImage = CHtml::image(WapAlbumModel::model()->getThumbnailUrl('s4', $album->id), 'avatar', array('class' => 'avatar', 'width' => '85px', 'height' => '85px')); } else { $avatarImage = CHtml::image('/css/wap/images/icon/clip-50.png', 'avatar', array('class' => 'avatar')); } ?> <li class="item <?php if ($i == count($albums)) { echo 'last_item'; } ?> "> <div class="vg_number vg_number<?php echo $i; ?> fll"><?php echo $i;