public function past() { $page = Converter::toInt('page', 'get', 1); $options = []; $options['where'][] = 'tournament.status IN (3,4)'; $options['where'][] = 'tournament.start_date < NOW()'; $count = \Own\Bus\Tournament\Data::count($options); $options['clearSelect'] = true; $options['select'][] = \Own\Bus\Tournament\Data::getList(['id', 'title', 'size', 'classification', 'start_date', 'end_date', 'surface', 'winner_id']); $options['select'][] = \Own\Bus\Player\Data::getList(['id', 'username', 'user_id', 'country', 'experience'], 'tournament_winner'); $options['select'][] = \Rebond\Core\User\Data::getList(['id', 'avatar_id'], 'tournament_winner_user'); $options['select'][] = \Rebond\Core\Media\Data::getList([], 'tournament_winner_user_avatar'); $options['join'][] = 'bus_player tournament_winner ON tournament_winner.id = tournament.winner_id'; $options['leftJoin'][] = 'core_user tournament_winner_user ON tournament_winner_user.id = tournament_winner.user_id'; $options['leftJoin'][] = 'core_media tournament_winner_user_avatar ON tournament_winner_user_avatar.id = tournament_winner_user.avatar_id'; $options['order'][] = 'tournament.start_date DESC'; $options['limit'][] = ($page - 1) * 20 . ', 20'; $past = \Own\Bus\Tournament\Data::loadAll($options); $registeredIds = \Own\Bus\TournamentPlayer\Data::loadRegistered($this->player->getId()); // view $this->setTpl(); // filter $tplFilter = new Template(Template::SITE, ['www']); $tplFilter->set('current', $page); $tplFilter->set('count', $count); $tplFilter->set('url', '/tournament/past?page='); // main $tplMain = new Template(Template::SITE, ['www']); $tplMain->set('past', $past); $tplMain->set('registeredIds', $registeredIds); // layout $this->tplLayout->set('column1', $tplFilter->render('tour-past-filter')); $this->tplLayout->add('column1', $tplMain->render('tour-past')); // template $this->tplMaster->set('layout', $this->tplLayout->render('layout-center')); return $this->tplMaster->render('tpl-default'); }