public function executePlayerStat(sfWebRequest $request) { $this->id = $request->getParameter("id"); $this->forward404Unless($this->id); $this->stats = PlayersTable::getInstance()->createQuery()->where("steamid = ?", $this->id)->orderBy("id ASC")->execute(); $this->forward404Unless($this->stats->count() > 0); }
public function getPlayer() { return PlayersTable::getInstance()->createQuery()->where("map_id = ?", $this->getId())->orderBy("team")->execute(); }
public function executeExportRounds(sfWebRequest $request) { $this->match = $this->getRoute()->getObject(); $rounds = $this->match->getRoundSummaries(); $stats = array(); $side = $this->match->getMap()->getCurrentSide() == "ct" ? "t" : "ct"; $scoreCT = 0; $scoreT = 0; foreach ($rounds as $round) { $data = unserialize(utf8_decode($round->getBestActionParam())); $player = PlayersTable::getInstance()->find($data['player']); switch ($round->best_action_type) { case "1kill": $bestAction = array("type" => "kill", "nb" => 1, "player" => $player->getSteamid()); break; case "2kill": $bestAction = array("type" => "kill", "nb" => 2, "player" => $player->getSteamid()); break; case "3kill": $bestAction = array("type" => "kill", "nb" => 3, "player" => $player->getSteamid()); break; case "4kill": $bestAction = array("type" => "kill", "nb" => 4, "player" => $player->getSteamid()); break; case "5kill": $bestAction = array("type" => "kill", "nb" => 5, "player" => $player->getSteamid()); break; case "1v1": $bestAction = array("type" => "cluch", "situation" => 1, "player" => $player->getSteamid()); break; case "1v2": $bestAction = array("type" => "cluch", "situation" => 2, "player" => $player->getSteamid()); break; case "1v3": $bestAction = array("type" => "cluch", "situation" => 3, "player" => $player->getSteamid()); break; case "1v4": $bestAction = array("type" => "cluch", "situation" => 4, "player" => $player->getSteamid()); break; case "1v5": $bestAction = array("type" => "cluch", "situation" => 5, "player" => $player->getSteamid()); break; } if ($side == "ct") { $scoreA = $round->getScoreA(); $scoreB = $round->getScoreB(); } else { $scoreB = $round->getScoreA(); $scoreA = $round->getScoreB(); } if ($round->getRoundId() > 15) { if ($side == "t") { $scoreA = $round->getScoreA(); $scoreB = $round->getScoreB(); } else { $scoreB = $round->getScoreA(); $scoreA = $round->getScoreB(); } } if ($round->getCtWin()) { $scoreCT++; } else { $scoreT++; } $stats[$round->getRoundId()] = array("roundId" => (int) $round->getRoundId(), "bombPlanted" => $round->getBombPlanted(), "bombDefused" => $round->getBombDefused(), "bombExploded" => $round->getBombExploded(), "winType" => $round->getWinType(), "teamWin" => $round->getCtWin() ? "CT" : "TERRORIST", "ctWin" => $round->getCtWin(), "tWin" => $round->getTWin(), "scoreCT" => $scoreA, "scoreT" => $scoreB, "bestKiller" => array("player" => $round->getBestKiller()->getSteamid(), "nb" => (int) $round->getBestKillerNb(), "fk" => $round->getBestKillerFk()), "bestAction" => $bestAction); } return $this->renderText(json_encode($stats)); }
<?php $team1_flag = $match->getTeamA()->exists() ? "<i class='flag flag-" . strtolower($match->getTeamA()->getFlag()) . "'></i>" : "<i class='flag flag-" . strtolower($match->getTeamAFlag()) . "'></i>"; $team2_flag = $match->getTeamB()->exists() ? "<i class='flag flag-" . strtolower($match->getTeamB()->getFlag()) . "'></i>" : "<i class='flag flag-" . strtolower($match->getTeamBFlag()) . "'></i>"; $players = PlayersTable::getInstance()->createQuery()->where("match_id = ?", $match->getId())->andWhere("map_id = ?", $match->getMap()->getId())->orderBy("nb_kill DESC")->execute(); ?> <table class="table table-condensed"> <thead> <tr> <th><?php echo $team1_flag; ?> <?php echo $match->getTeamA()->exists() ? $match->getTeamA()->getName() : $match->getTeamAName(); ?> </th> <th width="25" style="border-left: 1px solid #DDDDDD;"><?php echo __("K"); ?> </th> <th width="25"><?php echo __("A"); ?> </th> <th width="25"><?php echo __("D"); ?> </th> <th width="30"><?php echo __("K/D");
public function getCurrentPlayers() { return PlayersTable::getInstance()->createQuery()->where("match_id = ?", $this->getId())->andWhere("map_id = ?", $this->getMap()->getId())->andWhere("team IN ?", array(array("a", "b")))->orderBy("pseudo ASC")->execute(); }