private function _getLatestMatchesByTeam($teamId) { $whereCondition = "M.berechnet = 1 AND (HOME.id = %d OR GUEST.id = %d)"; $parameters = array($teamId, $teamId); if ($this->_match['match_season_id']) { $whereCondition .= ' AND M.saison_id = %d'; $parameters[] = $this->_match['match_season_id']; } elseif (strlen($this->_match['match_cup_name'])) { $whereCondition .= ' AND M.pokalname = \'%s\''; $parameters[] = $this->_match['match_cup_name']; } else { $whereCondition .= ' AND M.spieltyp = \'Freundschaft\''; } $whereCondition .= " ORDER BY M.datum DESC"; return MatchesDataService::getMatchesByCondition($this->_websoccer, $this->_db, $whereCondition, $parameters, 5); }
/** * (non-PHPdoc) * @see IModel::getTemplateParameters() */ public function getTemplateParameters() { $matches = array(); $paginator = null; $clubId = $this->_websoccer->getUser()->getClubId($this->_websoccer, $this->_db); $whereCondition = '(home_verein = %d OR gast_verein = %d) AND berechnet != \'1\''; $parameters = array($clubId, $clubId); $result = $this->_db->querySelect('COUNT(*) AS hits', $this->_websoccer->getConfig('db_prefix') . '_spiel', $whereCondition, $parameters); $matchesCnt = $result->fetch_array(); $result->free(); if ($matchesCnt) { $count = $matchesCnt['hits']; } else { $count = 0; } if ($count) { $whereCondition .= ' ORDER BY M.datum ASC'; $eps = $this->_websoccer->getConfig("entries_per_page"); $paginator = new Paginator($count, $eps, $this->_websoccer); $matches = MatchesDataService::getMatchesByCondition($this->_websoccer, $this->_db, $whereCondition, $parameters, $paginator->getFirstIndex() . ',' . $eps); } return array("matches" => $matches, "paginator" => $paginator); }
/** * Provides simulated matches of specified team. * * @param WebSoccer $websoccer Application context. * @param DbConnection $db DB connection. * @param int $teamId ID of team. * @param int $startIndex fetch index start. * @param int $eps entries per page. * @return array list of found matches. */ public static function getSimulatedMatches(WebSoccer $websoccer, DbConnection $db, $teamId, $startIndex, $eps) { $whereCondition = "(home_verein = %d OR gast_verein = %d) AND berechnet = '1' ORDER BY datum DESC"; return MatchesDataService::getMatchesByCondition($websoccer, $db, $whereCondition, array($teamId, $teamId), $startIndex . "," . $eps); }