public function actionIndex() { Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/enjoy.css'); Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/lanrenzhijia.css'); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery.roundabout.js'); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/lanrenzhijia.js'); $house_image_list = House::model()->findAll(array('select' => 'id, addr, image_list', 'condition' => 'lp_dol>3000000', 'order' => 'id DESC', 'limit' => 1)); $city_houses = array(); $subject_list = Subject::model()->findAll(array('order' => 'id DESC')); foreach ($subject_list as $obj) { $criteria = new CDbCriteria(); $criteria->addCondition('city_id=' . $obj->city_id); $criteria->addCondition('lp_dol>3000000'); $criteria->order = 'id DESC'; $criteria->limit = 4; $house_list = House::model()->findAll($criteria); $city_houses[$obj->city_id] = $house_list; } $matches = Match::model()->findAll(); $data = array('house_image_list' => $house_image_list[0], 'subject_list' => $subject_list, 'city_houses' => $city_houses, 'matches' => $matches); $this->render('index', $data); }
public function updateMatchesFromChallonge() { $c = new ChallongeAPI(Yii::app()->params['challonge_api']); $params = array(); $matches = $c->getMatches($this->challonge_id, $params); foreach ($matches as $k => $match) { $_match = Match::model()->findByAttributes(array('tournament_id' => $this->id, 'challonge_match_id' => $match->match->id)); if ($_match) { $_match->team_1 = strlen($match->match->player1_id) ? $match->match->player1_id : ''; $_match->team_2 = strlen($match->match->player2_id) ? $match->match->player2_id : ''; $_match->identifier = $match->match->identifier; $_match->round = $match->match->round; $_match->state = $match->match->state; $_match->winner = $match->match->winner_id; $_match->loser = $match->match->loser_id; $_match->save(); } } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Match the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Match::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionCompare() { $this->layout = ' '; Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/compare.css'); $data = Yii::app()->request->getQuery('id'); $ids = explode(',', $data); $criteria = new CDbCriteria(); $criteria->addInCondition('id', $ids); $house_list = House::model()->findAll($criteria); $link_list = Link::model()->findAll(); $matches = Match::model()->findAll(); $this->render('compare', array('house_list' => $house_list, 'link_list' => $link_list, 'matches' => $matches)); }
/** * 取用户组列表 * @param $type */ protected function _groupList($type = 'user') { switch ($type) { case 'user': return AdminGroup::model()->findAll(); break; case 'subject': return Subject::model()->findAll(); break; case 'city': return City::model()->findAll(); break; case 'district': return District::model()->findAll(); break; case 'investType': return InvestType::model()->findAll(); break; case 'propertyType': return PropertyType::model()->findAll(); break; case 'house': return House::model()->findAll(); break; case 'match': return Match::model()->findAll(); break; } }