/** * 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)); } }