Esempio n. 1
0
 public function actionIndex()
 {
     $type = CHtml::encode(Yii::app()->request->getParam('type', 'HOT'));
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberSongPerPage'];
     if ($this->layout == 'application.views.wap.layouts.main') {
         $limit = Yii::app()->params['numberSongPerPageWap'];
     }
     $count_hot = WapSongModel::countListByCollection('SONG_HOT');
     $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
     $pager = new CPagination($count_hot);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $count_new = WapSongModel::countListByCollection('SONG_NEW');
     $songs_new = WapSongModel::getListByCollection('SONG_NEW', $page, $limit);
     $arr_songs = array(array('headerText' => yii::t('wap', 'BÀI HÁT HOT'), 'song' => $songs, 'link' => 'song/list?type=HOT'), array('headerText' => yii::t('wap', 'BÀI HÁT MỚI'), 'song' => $songs_new, 'link' => 'song/list?type=NEW'));
     $callBackLink = Yii::app()->createUrl("song/index", array('type' => $type));
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('songs', 'pager', 'callBackLink', 'options'));
     } else {
         $userPlaylist = array();
         if ($this->userPhone) {
             $userPlaylist = WapPlaylistModel::model()->getPlaylistByPhone($this->userPhone, $limit, $page);
         }
         $this->render("index", compact('arr_songs', 'pager', 'callBackLink', 'userPlaylist'));
     }
 }
Esempio n. 2
0
 public function run()
 {
     if (!empty($this->phone)) {
         $playlist = WapPlaylistModel::model()->getPlaylistByPhone($this->phone);
     } else {
         $playlist = array();
     }
     $this->render('addSongPlaylist', array('phone' => $this->phone, 'popupId' => $this->popupId, 'playlist' => $playlist));
 }
 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));
 }
Esempio n. 4
0
 public function actionIndex()
 {
     $this->forward("/site/error", true);
     $countNews = WapNewsModel::model()->countTopNews();
     $limit = Yii::app()->params['numberPerPage'];
     $page = (int) Yii::app()->request->getParam('page', 0);
     $pager = new CPagination($countNews);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $callBackLink = Yii::app()->createUrl("news/index");
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $news = WapNewsModel::model()->getTopNews($page * $limit, $limit);
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('news', 'pager', 'callBackLink'));
     } else {
         $userPlaylist = array();
         if ($this->userPhone) {
             $userPlaylist = WapPlaylistModel::model()->getPlaylistByPhone($this->userPhone);
         }
         $this->render("index", compact('news', 'pager', 'callBackLink'));
     }
 }
Esempio n. 5
0
<?php 
if ($playlist->id) {
    $avatarImage = CHtml::image(WapPlaylistModel::model()->getThumbnailUrl(100, $playlist->id), 'avatar', array('class' => 'avatar'));
} else {
    $avatarImage = CHtml::image('/images/icon/clip-50.png', 'avatar', array('class' => 'avatar'));
}
//$artist_name = WapArtistModel::model()->findByPk($playlist->artist_id)->name;
?>
<div class="vg_album">
	<?php 
echo $avatarImage;
?>
	<h3 class="name"><?php 
echo Formatter::smartCut(CHtml::encode($playlist->name), 10, 0);
?>
</h3>
	<p class="artist"><?php 
echo CHtml::encode($user_msisdn);
?>
</p>
</div>

<?php 
$this->widget('application.widgets.touch.player.ListPlayer', array('album' => $playlist, 'songs' => $songsOfPlaylist, 'type' => 'playlist'));
?>

<ul class="orther clb">
	<li style="width: 100%"><a class="same active"><?php 
echo Yii::t("wap", "Playlist same creator");
?>
Esempio n. 6
0
 public function actionGetPopupPlaylist()
 {
     $this->layout = false;
     $phone = Yii::app()->request->getParam('phone', '');
     $songId = Yii::app()->request->getParam('song_id', 0);
     $playlist = array();
     /* if(!empty($phone))
     			$playlist = WapPlaylistModel::model()->getPlaylistByPhone($phone); */
     $user = UserModel::model()->find("phone=" . $phone);
     if ($user) {
         $userId = $user->id;
         $playlist = WapPlaylistModel::model()->getPlaylistByUser($userId, $phone, 100, 0);
     } else {
         $userId = null;
         $playlist = WapPlaylistModel::model()->getPlaylistByPhone($phone, 100, 0);
     }
     $this->render('playlist', array('playlist' => $playlist, 'songId' => $songId, 'phone' => $phone));
 }
Esempio n. 7
0
<?php

if (!empty($playlists)) {
    ?>
<div class="box-content clear">
	<ul class="album_list items-list">
		<?php 
    $i = 0;
    foreach ($playlists as $key => $playlist) {
        $user = isset($playlist->msisdn) ? $playlist->msisdn : $playlist->username;
        $i++;
        $playlistLink = yii::app()->createUrl('playlist/view', array('id' => $playlist->id, 'url_key' => Common::makeFriendlyUrl($playlist->name)));
        if ($playlist->id) {
            $avatarImage = CHtml::image(WapPlaylistModel::model()->getThumbnailUrl(100, $playlist->id), '', array('class' => 'avatar'));
            if (!file_exists(WapPlaylistModel::model()->getThumbnailUrl(100, $playlist->id))) {
                $avatarImage = CHtml::image('/touch/images/playlist_default.png', '', array('class' => 'avatar'));
            }
        } else {
            $avatarImage = CHtml::image('/touch/images/playlist_default.png', '', array('class' => 'avatar'));
        }
        ?>
		<li class="item" id="idpl-<?php 
        echo $playlist->id;
        ?>
">
			<a href="<?php 
        echo $playlistLink;
        ?>
">
				<?php 
        echo $avatarImage;