示例#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 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'));
     }
 }
示例#3
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' : '')));
     }
 }
示例#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' => ''));
     }
 }
示例#5
0
 public function init()
 {
     if (empty($this->songs) && isset($this->options['songType'])) {
         $this->songs = WapSongModel::getListByCollection($this->options['songType']);
     }
 }