public function actionStat() { $current_action = Yii::$app->controller->action->id; $fantasy_type = Yii::$app->request->get('type', 'all'); $current_filter_for = Yii::$app->request->get('for', 'players'); $current_filter_year = Yii::$app->request->get('year', 'all'); $current_filter_league = Yii::$app->request->get('league', 'all'); switch ($current_filter_for) { case 'players': $searchModel = new DotaMatchHistoryPlayersSearch(); $roles_ratios = DotaPlayerRole::getRolesListRatios(); break; case 'heroes': $searchModel = new DotaMatchHistoryHeroesSearch(); $roles_ratios = DotaHeroRole::getRolesListRatios(); break; default: throw new BadRequestHttpException('Bad Request'); break; } $sort = $searchModel->getSort($current_filter_for); $dataProvider = $searchModel->searchStatRows($current_filter_for, $current_filter_year, $current_filter_league, $sort); $params = DotaParams::loadParams(); //echo'<pre>'; print_r($roles_ratios);echo'</pre>';die; /* foreach($dataProvider->models as $model) { switch($current_filter_for) { case 'players': $scores = ($model['level'] * $roles_ratios[$model['role_id']]) + ($model['kills'] * $params['ratio_kills']) + ($model['deaths'] * $params['ratio_deaths']) + ($model['assists'] * $params['ratio_assists']) + ($model['gold_per_min'] * $params['ratio_gold_per_min']) + ($model['xp_per_min'] * $params['ratio_xp_per_min']); break; case 'heroes': $scores = ($model['level'] * $roles_ratios[$model['role_id']]) + ($model['kills'] * $params['ratio_kills']) + ($model['deaths'] * $params['ratio_deaths']) + ($model['assists'] * $params['ratio_assists']) + ($model['gold_per_min'] * $params['ratio_gold_per_min']) + ($model['xp_per_min'] * $params['ratio_xp_per_min']); break; } //echo'<pre>'; print_r($scores);echo'</pre>';//die; $model['scores'] = $scores; } */ return $this->render('stat', ['current_action' => $current_action, 'fantasy_type' => $fantasy_type, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'sort' => $sort, 'current_filter_for' => $current_filter_for, 'current_filter_year' => $current_filter_year, 'current_filter_league' => $current_filter_league, 'roles_ratios' => $roles_ratios, 'params' => $params]); }