Пример #1
0
 public function actionIndex()
 {
     $limit = self::_NUMBER_ITEM;
     $albums = WapAlbumModel::getListHot(1, $limit);
     $videos = WapVideoModel::getListByCollection('VIDEO_HOT', 1, $limit);
     $songs = WapSongModel::getListByCollection('SONG_HOT', 1, 5);
     $news = WapNewsModel::getTopNews(0, 5);
     $video_playlist = WapVideoPlaylistModel::getListByCollection('VIDEO_PLAYLIST_HOT', 1, $limit);
     $this->render("index", compact('albums', 'videos', 'songs', 'news', 'video_playlist'));
 }
Пример #2
0
 public function actionList()
 {
     $limit = Yii::app()->params['numberPerPage'];
     $c = CHtml::encode(Yii::app()->request->getParam('id', '0'));
     $c = (int) (!empty($c)) ? $c : '0';
     $s = CHtml::encode(Yii::app()->request->getParam('type'));
     $s = !empty($s) ? $s : Yii::t('wap', 'Hot');
     $s = strtoupper($s);
     $cTitle = $c == 0 ? Yii::t('wap', 'All genres') : WapGenreModel::model()->findByPk($c)->name;
     $sTitle = $s == 'NEW' ? Yii::t('wap', 'New') : $s;
     $page = (int) Yii::app()->request->getParam('page', 1);
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $callBackLink = Yii::app()->createUrl("album/list", array('type' => $c, 's' => $s, 'c' => $c));
     $options = array();
     if ($c == 0) {
         if ($s == 'NEW') {
             $count = WapAlbumModel::countListByCollection('ALBUM_NEW');
             $albums = WapAlbumModel::getListNew($page, $limit);
             $options = array('col' => 'ALBUM_NEW', 'headerText' => "ALBUM MỚI");
         } else {
             $options = array('col' => 'ALBUM_HOT', 'headerText' => "ALBUM HOT");
             $albums = WapAlbumModel::getListHot($page, $limit);
             $count = WapAlbumModel::countListByCollection('ALBUM_HOT');
         }
         $pager = new CPagination($count);
         $pager->setPageSize($limit);
     } else {
         if ($s == 'NEW') {
             $count = WapAlbumModel::model()->countAlbumsByGenre($c);
             $pager = new CPagination($count);
             $pager->setPageSize($limit);
             $albums = WapAlbumModel::model()->getAlbumsByGenre($c, $pager->getOffset(), $pager->getLimit());
         } else {
             $count = WapGenreModel::getCountAlbumsByGenreCollection($c);
             $pager = new CPagination($count);
             $pager->setPageSize($limit);
             $id_album_hot = 6;
             $albums = WapGenreModel::getAlbumsByGenreCollection($c, $id_album_hot, $page, $limit);
         }
     }
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('albums', 'pager', 'callBackLink', 'options'));
     } else {
         $this->render('list', array('albums' => $albums, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options));
     }
 }