Ejemplo n.º 1
0
 public function actionSong()
 {
     $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 = self::_NUMBER_ITEM_VIEW;
     $count = WapSongModel::countListByCollection('SONG_DOC_QUYEN');
     $songs = WapSongModel::getListByCollection('SONG_DOC_QUYEN', $page, $limit);
     $options = array('col' => 'SONG_DOC_QUYEN');
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $callBackLink = Yii::app()->createUrl("/shell/song", array('type' => $type));
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajax_song_list", compact('songs', 'pager', 'callBackLink', 'options'));
     } else {
         $this->render("song", compact('options', 'songs', 'pager', 'callBackLink'));
     }
 }
Ejemplo n.º 2
0
 public function actionCollection()
 {
     $arr_item = array('song' => array('widget' => 'song.SongList'), 'video' => array('widget' => 'video.VideoList'), 'album' => array('widget' => 'album.AlbumList'), 'videoPlaylist' => array('widget' => 'video_playlist.Video_playlistList'));
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberPerPage'];
     $id = Yii::app()->request->getParam('id', '');
     $collection = CollectionModel::model()->findByPk($id);
     $callBackLink = Yii::app()->createUrl("genre/collection", array('id' => $id));
     $colection_code = $collection->code;
     $count = WapSongModel::countListByCollection($colection_code, $page, $limit);
     $videos = WapSongModel::getListByCollection($colection_code, $page, $limit);
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('videos', 'pager', 'callBackLink'));
     } else {
         $this->render('collection', array('videos' => $videos, 'pager' => $pager, 'callBackLink' => $callBackLink, 'collection' => $collection, 'arr_item' => $arr_item, 'options' => array('col' => $collection->id, 'display_type' => $collection->code == 'VIDEO_COLLECTION' ? 'VIDEO_COLLECTION' : '')));
     }
 }
Ejemplo n.º 3
0
 public function actionIndex()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberPerPage'];
     $pageSize = Yii::app()->params['pageSize'];
     $c = CHtml::encode(Yii::app()->request->getParam('genre', 'VN'));
     $s = CHtml::encode(Yii::app()->request->getParam('type', 'SONG'));
     $s = strtoupper($s);
     $callBackLink = Yii::app()->createUrl("bxh/index", array('type' => $c, 's' => $s));
     if ($c == 'VN' || $c == 0) {
         $cTitle = Yii::t("wap", "Việt Nam");
     }
     if ($c == 'EUR') {
         $cTitle = Yii::t("wap", "Âu Mỹ");
     }
     if ($c == 'KOR') {
         $cTitle = Yii::t("wap", "Châu Á");
     }
     $sTitle = $s == 'SONG' ? Yii::t("wap", "Song") : $s;
     $options = array();
     $ccType = 'bxh';
     $collection = CollectionModel::model()->getCollectionByType($s, $ccType, $c, 0);
     $contentCode = $collection[0]->code;
     $count = WapSongModel::countListByCollection($contentCode);
     $topWeek = MainContentModel::getListByCollection($contentCode, $page, $limit);
     $options['col'] = $contentCode;
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $type_name = strtolower($s);
     $ajaxview = "_ajax" . $type_name . "List";
     if ($callBack) {
         $this->layout = false;
         $this->render($ajaxview, compact('topWeek', 'pager', 'callBackLink', 'limit', 'options'));
     } else {
         $this->render('index', array('topWeek' => $topWeek, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options));
     }
 }
Ejemplo n.º 4
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' => ''));
     }
 }