public function vs() { // auth Util\Auth::isAuthorized($this->signedUser, 'member', false, '/profile/sign-in'); $matchId = Util\Converter::toInt('matchId', 'get', 0); $options = []; $options['clearSelect'] = true; $options['select'][] = \Own\Bus\Match\Data::getList(['id', 'player_match1_id', 'player_match2_id', 'surface', 'current_set', 'best_of_sets', 'type', 'winner_id', 'position', 'tournament_id', 'league_id', 'status', 'scheduled']); $options['select'][] = \Own\Bus\PlayerMatch\Data::getList(['id', 'player_id'], 'match_player_match'); $options['join'][] = 'bus_player_match match_player_match'; $options['where'][] = 'match_player_match.id = match.player_match1_id OR match_player_match.id = match.player_match2_id'; $options['where'][] = ['match.id = ?', $matchId]; $options['where'][] = ['match.status IN (?)', [1, 2, 3, 4]]; $match = \Own\Bus\Match\Data::load($options); if (!isset($match)) { Util\Session::siteError('noMatch', null, '/match/schedule'); } if (in_array($match->getStatus(), [MatchStatus::PLAYING, MatchStatus::FINISHED])) { Util\Session::siteSuccess('matchStarted', '/match/view?id=' . $match->getId() . '&live=true'); } $stats1 = \Own\Bus\Match\Data::loadStatsByPlayerId($this->player->getId()); $stats2 = \Own\Bus\Match\Data::loadStatsByPlayerId($match->getPlayerMatch2()->getPlayerId(), false); // view $this->setTpl(); // main $tplMain = new Util\Template(Util\Template::SITE, ['www']); $tplMain->set('match', $match); $tplMain->set('stats1', $stats1); $tplMain->set('stats2', $stats2); // layout $this->tplLayout->set('column1', $tplMain->render('match-vs')); // template $this->tplMaster->set('layout', $this->tplLayout->render('layout-center')); return $this->tplMaster->render('tpl-default'); }