예제 #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()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberPerPage'];
     $c = CHtml::encode(Yii::app()->request->getParam('id', '0'));
     $s = CHtml::encode(Yii::app()->request->getParam('type', '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;
     $callBackLink = Yii::app()->createUrl("video/list", array('c' => $c, 's' => $s));
     $options = array();
     if ($c == 0) {
         if (strtoupper($s) == 'NEW') {
             $count = WapVideoModel::countListByCollection('VIDEO_NEW');
             $videos = WapVideoModel::getListByCollection('VIDEO_NEW', $page, $limit);
             $options['col'] = 'VIDEO_NEW';
             $options['headerText'] = 'VIDEO MỚI';
         } else {
             $count = WapVideoModel::countListByCollection('VIDEO_HOT');
             $videos = WapVideoModel::getListByCollection('VIDEO_HOT', $page, $limit);
             $options['col'] = 'VIDEO_HOT';
             $options['headerText'] = 'VIDEO HOT';
         }
         $pager = new CPagination($count);
         $pager->setPageSize($limit);
     } else {
         if (strtoupper($s) == 'NEW') {
             $count = WapVideoModel::model()->countVideosByGenre($c);
             $pager = new CPagination($count);
             $pager->setPageSize($limit);
             $videos = WapVideoModel::model()->getVideosByGenre($c, $pager->getOffset(), $pager->getLimit());
             $options['headerText'] = 'Video Mới';
         } else {
             $count = WapGenreModel::getCountVideosByGenreCollection($c);
             $pager = new CPagination($count);
             $pager->setPageSize($limit);
             $videos = WapGenreModel::getVideosByGenreCollection($c, 3, $pager->getOffset(), $pager->getLimit());
             $options['headerText'] = 'Video Hot';
         }
     }
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('videos', 'pager', 'callBackLink', 'options'));
     } else {
         $this->render('list', array('videos' => $videos, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options));
     }
 }
예제 #3
0
 public function actionVideo()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = self::_NUMBER_ITEM_VIEW;
     $count = WapVideoModel::countListByCollection('VIDEO_DOC_QUYEN');
     $videos = WapVideoModel::getListByCollection('VIDEO_DOC_QUYEN', $page, $limit);
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $callBackLink = Yii::app()->createUrl("/shell/video");
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajax_video_list", compact('videos', 'pager', 'callBackLink'));
     } else {
         $this->render('video', array('videos' => $videos, 'pager' => $pager, 'callBackLink' => $callBackLink));
     }
 }