Ejemplo n.º 1
0
 public function actionGetPopup()
 {
     $this->layout = false;
     $view = 'default';
     $type = Yii::app()->request->getParam('type', 'genre');
     $route = Yii::app()->request->getParam('route', '/song/list');
     $name = CHtml::encode(Yii::app()->request->getParam('name', Yii::t('wap', 'Tất cả thể loại')));
     if ($type == 'genre') {
         $genres = MainActiveRecord::getGenre();
         $genresAll = WapGenreModel::model()->cache(1000, null)->findAll('status=1');
         $genreRoot = array();
         foreach ($genresAll as $key => $value) {
             if ($value->parent_id == 0) {
                 $genreRoot[] = $value;
             }
         }
         $view = 'genre';
         $params = array('genreRoot' => $genreRoot, 'genresAll' => $genresAll, 'genres' => $genres, 'route' => $route);
     } elseif ($type == 'status') {
         $view = 'status';
         $c = Yii::app()->request->getParam('c', 0);
         $params = array('route' => $route, 'c' => $c, 'name' => $name);
     } elseif ($type == 'bxh') {
         $view = 'bxh';
         $c = Yii::app()->request->getParam('c', 0);
         $s = Yii::app()->request->getParam('s', 'Bài hát');
         $params = array('route' => $route, 'c' => $c, 's' => $s);
     } elseif ($type == 'bxh_status') {
         $view = 'bxh_status';
         $c = Yii::app()->request->getParam('c', 0);
         $s = Yii::app()->request->getParam('s', 'Mới');
         $params = array('route' => $route, 'c' => $c, 's' => $s);
     }
     $this->render($view, $params);
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 3
0
 public function run()
 {
     $params = array();
     if ($this->type == 'category') {
         $genres = MainActiveRecord::getGenre();
         $genresAll = WapGenreModel::model()->cache(1000, null)->findAll('status=1');
         $genreRoot = array();
         foreach ($genresAll as $key => $value) {
             if ($value->parent_id == 0) {
                 $genreRoot[] = $value;
             }
         }
         $params = array('genreRoot' => $genreRoot, 'genresAll' => $genresAll, 'genres' => $genres);
     }
     $this->render('default', CMap::mergeArray(array('title' => $this->title, 'type' => $this->type, 'title_actived' => $this->title_actived, 'route' => $this->route), $params));
 }
Ejemplo n.º 4
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));
     }
 }
 /**
  * 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));
     }
 }
Ejemplo n.º 6
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['numberSongPerPage'];
     $c = CHtml::encode(Yii::app()->request->getParam('id', '0'));
     $s = CHtml::encode(Yii::app()->request->getParam('type', 'NEW'));
     $s = strtoupper($s);
     $cTitle = $c == 0 ? 'Tất cả thể loại' : WapGenreModel::model()->findByPk($c)->name;
     $sTitle = $s == 'NEW' ? "Mới" : $s;
     $count = WapSongModel::countListByCollection('SONG_HOT');
     $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $callBackLink = Yii::app()->createUrl("song/list", array('c' => $c, 's' => $s));
     $options = array();
     if ($c == 0) {
         // danh sach song
         if ($s == 'NEW') {
             $count = WapSongModel::countListByCollection('SONG_NEW');
             $songs = WapSongModel::getListByCollection('SONG_NEW', $page, $limit);
             $options['col'] = 'BÀI HÁT MỚI';
         } else {
             $count = WapSongModel::countListByCollection('SONG_HOT');
             $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
             $options['col'] = 'BÀI HÁT HOT';
         }
         $pager = new CPagination($count);
         $pager->setPageSize($limit);
     } else {
         $arrPattern = array('-', '_', '\'', ' ');
         $cKey = strtoupper(str_replace($arrPattern, '', Common::strNormal($cTitle)));
         $colection_code = 'SONG_' . $s . '_' . $cKey;
         $check_key = CollectionModel::model()->findByAttributes(array('code' => $colection_code));
         if (isset($check_key)) {
             $count = WapSongModel::countListByCollection($colection_code, $page, $limit);
             $songs = WapSongModel::getListByCollection($colection_code, $page, $limit);
             $pager = new CPagination($count);
             $pager->setPageSize($limit);
         } else {
             if ($s == 'NEW') {
                 $count = WapSongModel::model()->countSongsByGenre($c);
                 $pager = new CPagination($count);
                 $pager->setPageSize($limit);
                 $songs = WapSongModel::model()->getSongsByGenre($c, $pager->getOffset(), $pager->getLimit());
                 $options['col'] = 'BÀI HÁT MỚI';
             } else {
                 //$count = WapSongModel::model()->countSongsByGenre($c);
                 $count = WapGenreModel::getCountSongsByGenreCollection($c, 1);
                 $pager = new CPagination($count);
                 $pager->setPageSize($limit);
                 $songs = WapGenreModel::getSongsByGenreCollection($c, 1, $pager->getOffset(), $pager->getLimit());
                 $options['col'] = 'BÀI HÁT HOT';
             }
         }
     }
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('songs', 'pager', 'callBackLink', 'options'));
     } else {
         $this->render('list', array('songs' => $songs, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options, 'type' => ''));
     }
 }