/** * Url: /match/protocol/{$id} * @param $id * @return mixed * @throws NotFoundHttpException */ public function actionMatchProtocol($id) { $match = Match::findOne($id); if (!isset($match)) { throw new NotFoundHttpException('The requested page does not exist.'); } $title = "Протокол матча " . $match->teamHome->name . " - " . $match->teamGuest->name; $matchEvents = MatchEvent::find()->where(['match_id' => $match->id])->all(); $teamPlayers = Composition::find()->where(['match_id' => $match->id])->all(); $teamPlayers = Composition::sortPlayers($teamPlayers); $teamHomePlayers = []; $teamGuestPlayers = []; foreach ($teamPlayers as $player) { if ($player->command_id == $match->command_home_id) { $teamHomePlayers[] = $player; } else { $teamGuestPlayers[] = $player; } } return $this->render('@frontend/views/site/index', ['templateType' => 'col2', 'title' => 'Dynamomania.com | ' . $title, 'columnFirst' => ['menu' => ['view' => '@frontend/views/translation/menu', 'data' => compact('match')], 'protocol' => ['view' => '@frontend/views/translation/protocol', 'data' => compact('match', 'matchEvents', 'teamHomePlayers', 'teamGuestPlayers')], 'comments' => Comment::getCommentsBlock($match->id, Comment::COMMENTABLE_MATCH)], 'columnSecond' => ['short_news' => SiteBlock::getshortNews(50)]]); }