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 __get($name)
 {
     if ($name == 'url_key') {
         $str = trim(parent::__get($name), "-");
         $str = str_replace("--", "-", $str);
         if (strrpos($str, "-") === false) {
             $str = Common::makeFriendlyUrl(trim($str));
         }
         return str_replace("'", "", $str);
     }
     return parent::__get($name);
 }
Ejemplo n.º 3
0
 public function actionIndex()
 {
     $type = Yii::app()->request->getParam('type', 'song');
     $parentGenres = MainActiveRecord::getGenre(0);
     $arrSubGenres = array();
     foreach ($parentGenres as $pgenre) {
         $pid = $pgenre->id;
         $cri = new CDbCriteria();
         $cri->condition = "parent_id = {$pid} AND status = 1";
         $cri->order = "sorder ASC";
         $subGenres = GenreModel::model()->findAll($cri);
         $arrSubGenres[$pid] = $subGenres;
     }
     $this->render('list', array('parentGenres' => $parentGenres, 'arrSubGenres' => $arrSubGenres, 'type' => $type));
 }
Ejemplo n.º 4
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.º 5
0
 public function init()
 {
     if (empty($this->genres)) {
         $this->genres = MainActiveRecord::getGenre();
     }
 }
 /**
  * Returns the static model of the specified AR class.
  * @return GameEventReportAll the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Ejemplo n.º 7
0
 /**
  * hien thi danh sach bai hat/video/album/playlist cua 1 the loai
  * @param type $genreModel
  * @param type $type
  */
 public function showList($genreModel, $type, $genre_id)
 {
     $arr = array('song' => array('modelClass' => 'WapSongModel', 'countGenreFunc' => 'countSongsByGenre', 'getGenreFunc' => 'getSongsByGenre', 'widget' => '', 'text' => 'Bài hát'), 'video' => array('modelClass' => 'WapVideoModel', 'countGenreFunc' => 'countVideosByGenre', 'getGenreFunc' => 'getVideosByGenre', 'widget' => '', 'text' => 'Video'), 'album' => array('modelClass' => 'WapAlbumModel', 'countGenreFunc' => 'countAlbumsByGenre', 'getGenreFunc' => 'getAlbumsByGenre', 'widget' => '', 'text' => 'Album'), 'videoPlaylist' => array('modelClass' => 'VideoPlaylistModel', 'countGenreFunc' => 'countVideoPlaylistByGenre', 'getGenreFunc' => 'getVideoPlaylistByGenre', 'widget' => '', 'text' => 'VideoPlaylist'));
     $page = Yii::app()->request->getParam('page', 1);
     $pageSize = Yii::app()->params['pageSize'];
     $headerText = $arr[$type]['text'] . " " . $genreModel->name;
     $genres_ = MainActiveRecord::getGenre();
     $countObject = $arr[$type]['modelClass']::$arr[$type]['countGenreFunc']($genreModel->id);
     $objectPages = new CPagination($countObject);
     $objectPages->setPageSize($pageSize);
     $currentPage = $objectPages->getCurrentPage();
     if (!$currentPage) {
         $currentPage = 1;
     }
     $objects = $arr[$type]['modelClass']::$arr[$type]['getGenreFunc']($genreModel->id, ($page - 1) * $pageSize, $pageSize);
     $options = array();
     $options['col'] = $headerText;
     $options['headerText'] = $headerText;
     $this->render('application.views.wap.' . $type . '.list', array($type . 's' => $objects, $type . 'Pages' => $objectPages, 'type' => 'list', 'options' => $options, 'link' => Yii::app()->createUrl('/genre'), 'genres' => $genres_, 'genre_id' => $genre_id, 'pager' => $objectPages, 'headerText' => $headerText));
 }