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)); }
/** * lay Genre cha, Genre hot * @return type */ public static function getGenre($hot = 1) { if ($hot == 1) { $cri = new CDbCriteria(); $cri->condition = "status = 1"; $cri->order = "sorder ASC"; $cri->limit = 10; $genres = GenreModel::model()->findAll($cri); } else { $cri = new CDbCriteria(); $cri->condition = "parent_id = 0 AND status = 1"; $cri->order = "sorder ASC"; $genres = GenreModel::model()->findAll($cri); } return $genres; }
public function actionIndex() { $url_key = Yii::app()->request->getParam('url_key'); $url_key = trim($url_key); $this->activemenu = $url_key; $c = array('conditions' => array('url_key' => array('==' => $url_key)), 'limit' => 1); $genre = GenreModel::model()->find($c); if (empty($genre)) { throw new CHttpException(404); } $genreCode = $genre->code; $limit = 10; $offset = 0; $c = array('conditions' => array('genre' => array('==' => $genreCode)), 'sort' => array('_id' => EMongoCriteria::SORT_DESC), 'limit' => $limit, 'offset' => $offset); $articles = FeedModel::model()->findAll($c); $this->render('index', compact('articles', 'genre')); }
public function actionViewlog() { $isAll = Yii::app()->request->getParam('all', 0); $date = array(); if (!$isAll) { $date['to'] = date("Y-m-d 23:59:59"); $date['from'] = date("Y-m-d 00:00:00", time() - 30 * 24 * 60 * 60); } $this->layout = false; $ip = $_SERVER['REMOTE_ADDR']; $blackList = $this->_whilelistIP(); if (!in_array($ip, $blackList) && false) { echo '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>'; echo "IP của bạn <b>{$ip}</b> không được cấp quyền truy cập nội dung này!"; Yii::app()->end(); } //Yii::app()->user->setState('pageSize',5); $phone = Yii::app()->request->getParam('phone', null); //$isAll = Yii::app()->request->getParam('all',0); //$isFull = Yii::app()->request->getParam('full',0); //$channel = Yii::app()->request->getParam('channel',0); $subscribe = null; $smsMo = $smsMt = $model = $modelDK = null; $params = array(); $phone = Formatter::formatPhone($phone); if ($phone) { //log đăng ký và hủy $modelDK = new AdminUserTransactionModel('search'); $modelDK->unsetAttributes(); // clear any default values $phone = Formatter::formatPhone($phone); $modelDK->setAttribute('user_phone', $phone); $modelDK->_dkhuy = true; //vinaphone /* $modelDKViNA = new LogApiVinaphoneModel('search'); $modelDKViNA->unsetAttributes(); // clear any default values $phone = Formatter::formatPhone($phone); $modelDKViNA->setAttribute('msisdn_a', $phone); //$modelDKViNA->setAttribute('error_id', 0); $modelDKViNA->_dkhuy=true; $params['modelDKViNA']=$modelDKViNA; */ //gia hạn $modelRenew = new AdminUserTransactionModel('search'); $modelRenew->unsetAttributes(); // clear any default values $phone = Formatter::formatPhone($phone); $modelRenew->setAttribute('user_phone', $phone); $modelRenew->setAttribute('transaction', 'extend_subscribe'); if (!$isAll) { $modelRenew->setAttribute('created_time', $date); } $params['modelRenew'] = $modelRenew; //log content $genre = GenreModel::model()->findAll(); foreach ($genre as $gen) { $genreArr[$gen->id] = $gen->name; } Yii::app()->session['genre'] = $genreArr; //echo '<pre>';print_r($genreArr); $modelContent = new AdminUserTransactionModel('search'); $modelContent->unsetAttributes(); // clear any default values $phone = Formatter::formatPhone($phone); $modelContent->setAttribute('user_phone', $phone); $modelContent->_content = true; if (!$isAll) { $modelContent->setAttribute('created_time', $date); } $params['modelContent'] = $modelContent; $subscribe = AdminUserSubscribeModel::model()->findByAttributes(array('user_phone' => $phone)); //MO $smsMo = new AdminLogSmsMoModel('search'); $smsMo->setAttribute('sender_phone', "=" . $phone); if (!$isAll) { $date['toTime'] = date("Y-m-d 23:59:59"); $date['fromTime'] = date("Y-m-d 00:00:00", time() - 30 * 24 * 60 * 60); $smsMo->setAttribute('receive_time', $date); } $params['smsMo'] = $smsMo; //MT $smsMt = new AdminLogSmsMtModel('search'); $smsMt->setAttribute('receive_phone', "=" . $phone); if (!$isAll) { $smsMt->setAttribute('send_datetime', $date); } $params['smsMt'] = $smsMt; } $this->render('viewlog', CMap::mergeArray(array('isAll' => $isAll, 'phone' => $phone, 'subscribe' => $subscribe, 'modelDK' => $modelDK), $params)); }
public static function model($className = __CLASS__) { return parent::model($className); }