/** * (non-PHPdoc) * @see IModel::getTemplateParameters() */ public function getTemplateParameters() { $players = array(); $positions; // leagues $leagues = LeagueDataService::getLeaguesSortedByCountry($this->_websoccer, $this->_db); $leagueId = $this->_websoccer->getRequestParameter("leagueid"); // pre-select user's league in case no other league selected if (!$leagueId) { $clubId = $this->_websoccer->getUser()->getClubId($this->_websoccer, $this->_db); if ($clubId > 0) { $result = $this->_db->querySelect("liga_id", $this->_websoccer->getConfig("db_prefix") . "_verein", "id = %d", $clubId, 1); $club = $result->fetch_array(); $result->free(); $leagueId = $club["liga_id"]; } } // seasons $seasons = array(); $seasonId = $this->_websoccer->getRequestParameter("seasonid"); if ($leagueId) { $fromTable = $this->_websoccer->getConfig("db_prefix") . "_saison"; $whereCondition = "liga_id = %d ORDER BY name ASC"; $result = $this->_db->querySelect("id, name, beendet", $fromTable, $whereCondition, $leagueId); while ($season = $result->fetch_array()) { $seasons[] = $season; if (!$seasonId && !$season["beendet"]) { $seasonId = $season["id"]; } } $result->free(); } // get available match days $matchday = $this->_websoccer->getRequestParameter("matchday"); $maxMatchDay = 0; $openMatchesExist = FALSE; if ($seasonId) { $result = $this->_db->querySelect("MAX(spieltag) AS max_matchday", $this->_websoccer->getConfig("db_prefix") . "_spiel", "saison_id = %d AND berechnet = '1'", $seasonId); $matches = $result->fetch_array(); $result->free(); if ($matches) { $maxMatchDay = $matches["max_matchday"]; if (!$matchday) { $matchday = $maxMatchDay; } // check if there are still open matches $result = $this->_db->querySelect("COUNT(*) AS hits", $this->_websoccer->getConfig("db_prefix") . "_spiel", "saison_id = %d AND spieltag = %d AND berechnet != '1'", array($seasonId, $matchday)); $openmatches = $result->fetch_array(); $result->free(); if ($openmatches && $openmatches["hits"]) { $openMatchesExist = TRUE; } else { $this->getTeamOfTheDay($seasonId, $matchday, $players); } } } return array("leagues" => $leagues, "leagueId" => $leagueId, "seasons" => $seasons, "seasonId" => $seasonId, "maxMatchDay" => $maxMatchDay, "matchday" => $matchday, "openMatchesExist" => $openMatchesExist, "players" => $players); }
public function getTemplateParameters() { $league = null; $leagueId = (int) $this->_websoccer->getRequestParameter("id"); // pre-select user's league if ($leagueId == 0) { $clubId = $this->_websoccer->getUser()->getClubId($this->_websoccer, $this->_db); if ($clubId > 0) { $result = $this->_db->querySelect("liga_id", $this->_websoccer->getConfig("db_prefix") . "_verein", "id = %d", $clubId, 1); $club = $result->fetch_array(); $result->free(); $leagueId = $club["liga_id"]; } } if ($leagueId > 0) { $league = LeagueDataService::getLeagueById($this->_websoccer, $this->_db, $leagueId); if (!isset($league["league_id"])) { throw new Exception($this->_i18n->getMessage(MSG_KEY_ERROR_PAGENOTFOUND)); } } return array("league" => $league, "leagues" => LeagueDataService::getLeaguesSortedByCountry($this->_websoccer, $this->_db)); }
/** * (non-PHPdoc) * @see IModel::getTemplateParameters() */ public function getTemplateParameters() { return array('players' => PlayersDataService::getTopScorers($this->_websoccer, $this->_db, NUMBER_OF_PLAYERS, $this->_websoccer->getRequestParameter('leagueid')), 'leagues' => LeagueDataService::getLeaguesSortedByCountry($this->_websoccer, $this->_db)); }
public function getTemplateParameters() { return array("players" => PlayersDataService::getTopStrikers($this->_websoccer, $this->_db, NUMBER_OF_PLAYERS, $this->_websoccer->getRequestParameter("leagueid")), "leagues" => LeagueDataService::getLeaguesSortedByCountry($this->_websoccer, $this->_db)); }