/** * (non-PHPdoc) * @see IModel::getTemplateParameters() */ public function getTemplateParameters() { $cupName = $this->_websoccer->getRequestParameter('cup'); $cupRound = $this->_websoccer->getRequestParameter('round'); // get cup round info $columns['C.logo'] = 'cup_logo'; $columns['R.id'] = 'round_id'; $columns['R.firstround_date'] = 'firstround_date'; $columns['R.secondround_date'] = 'secondround_date'; $columns['R.finalround'] = 'is_finalround'; $columns['R.groupmatches'] = 'is_groupround'; $columns['PREVWINNERS.name'] = 'prev_round_winners'; $columns['PREVLOOSERS.name'] = 'prev_round_loosers'; $fromTable = $this->_websoccer->getConfig('db_prefix') . '_cup_round AS R'; $fromTable .= ' INNER JOIN ' . $this->_websoccer->getConfig('db_prefix') . '_cup AS C ON C.id = R.cup_id'; $fromTable .= ' LEFT JOIN ' . $this->_websoccer->getConfig('db_prefix') . '_cup_round AS PREVWINNERS ON PREVWINNERS.id = R.from_winners_round_id'; $fromTable .= ' LEFT JOIN ' . $this->_websoccer->getConfig('db_prefix') . '_cup_round AS PREVLOOSERS ON PREVLOOSERS.id = R.from_loosers_round_id'; $result = $this->_db->querySelect($columns, $fromTable, 'C.name = \'%s\' AND R.name = \'%s\'', array($cupName, $cupRound), 1); $round = $result->fetch_array(); $result->free(); $groups = array(); $preSelectedGroup = ''; if ($round['is_groupround']) { $userTeamId = $this->_websoccer->getUser()->getClubId($this->_websoccer, $this->_db); $result = $this->_db->querySelect('name,team_id', $this->_websoccer->getConfig('db_prefix') . '_cup_round_group', 'cup_round_id = %d ORDER BY name ASC', array($round['round_id'])); while ($group = $result->fetch_array()) { if (!isset($groups[$group['name']])) { $groups[$group['name']] = $group['name']; } if ($group['team_id'] == $userTeamId) { $preSelectedGroup = $group['name']; } } $result->free(); $matches = array(); } else { $matches = MatchesDataService::getMatchesByCupRound($this->_websoccer, $this->_db, $cupName, $cupRound); } return array('matches' => $matches, 'round' => $round, 'groups' => $groups, 'preSelectedGroup' => $preSelectedGroup); }