本文整理汇总了PHP中Player::linkTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::linkTo方法的具体用法?PHP Player::linkTo怎么用?PHP Player::linkTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::linkTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showReport
function showReport($series, $season)
{
$seasonevents = $series->getSeasonEventNames($season);
$points = $series->seasonPointsTable($season);
$cutoff = $series->getSeasonCutoff($season);
uasort($points, 'reverse_total_sort');
echo "<h3><center>Scoreboard for {$series->name} season {$season}</center></h3>";
echo "<table class=\"scoreboard\">";
echo "<tr class=\"top\"> <th> Place </th> <th> Player </th> <th> Total </th>";
foreach ($seasonevents as $evname) {
$shortname = preg_replace("/^{$series->name} /", '', $evname);
$reportlink = "eventreport.php?event=" . urlencode($evname);
echo "<th> <a href=\"{$reportlink}\">{$shortname}</a> </th>";
}
echo "</tr>";
$count = 0;
foreach ($points as $playername => $pointar) {
$player = new Player($playername);
$count++;
$classes = "";
if ($count % 2 != 0) {
$classes .= "odd";
}
if ($count == $cutoff) {
$classes .= " cutoff";
}
echo "<tr class=\"{$classes}\"> ";
echo "<td> {$count} </td> <td class=\"playername\"> {$player->linkTo()} </td> <td> {$pointar['.total']} </td> ";
foreach ($seasonevents as $evname) {
if (isset($pointar[$evname])) {
if (is_array($pointar[$evname])) {
echo "<td> <span title=\"{$pointar[$evname]['why']}\"> {$pointar[$evname]['points']} </span> </td>";
} else {
echo "<td> {$pointar[$evname]} </td>";
}
} else {
echo "<td> </td> ";
}
}
echo "</tr> ";
}
echo "</table>";
}
示例2: ratingsTable
function ratingsTable($format, $min = 20)
{
$db = Database::getConnection();
$stmt = $db->prepare("SELECT p.name AS player, r.rating, r.wins, r.losses\n FROM ratings r, players p,\n (SELECT qr.player AS qplayer, MAX(qr.updated) AS qmax\n FROM ratings AS qr\n WHERE qr.format = ?\n GROUP BY qr.player) AS q\n WHERE r.format = ?\n AND p.name=r.player\n AND q.qplayer=r.player\n AND q.qmax=r.updated\n AND q.qmax > DATE_SUB(NOW(), INTERVAL 90 DAY)\n AND r.wins + r.losses >= ?\n ORDER BY r.rating DESC");
$stmt->bind_param("ssd", $format, $format, $min);
$stmt->execute() or die($stmt->error);
$stmt->bind_result($playername, $rating, $wins, $losses);
$rank = 0;
$ratings_data = array();
while ($stmt->fetch()) {
$rank++;
$ratings_data[] = array('rank' => $rank, 'playername' => $playername, 'rating' => $rating, 'wins' => $wins, 'losses' => $losses);
}
$stmt->close();
echo "<table align=\"center\" style=\"border-width: 0px;\" ";
echo "width=\"500px\">\n";
echo "<tr><td colspan=6 align=\"center\">";
echo "<i>Only players with {$min} or more matches and active within the last 90 days are listed.";
echo "</td></tr>";
echo "<tr><td> </td></tr>\n";
echo "<tr><td align=\"center\"><b>Rank</td>";
echo "<td><b>Player</td><td align=\"center\">";
echo "<b>Rating</td>";
echo "<td align=\"center\" colspan=\"3\"><b>Record</td></tr>\n";
foreach ($ratings_data as $vals) {
echo "<tr><td align=\"center\">{$vals['rank']}</td><td>";
$player = new Player($vals['playername']);
echo $player->linkTo();
echo "</td>\n";
echo "<td align=\"center\">{$vals['rating']}</td>\n";
echo "<td align=\"right\" width=35>{$vals['wins']} </td>\n";
echo "<td align=\"center\">-</td><td width=35 align=\"left\"> {$vals['losses']}</td></tr>";
}
echo "</table>";
}
示例3: print_matchTable
function print_matchTable($player, $limit = 0)
{
if (!isset($_POST['format'])) {
$_POST['format'] = "%";
}
if (!isset($_POST['series'])) {
$_POST['series'] = "%";
}
if (!isset($_POST['season'])) {
$_POST['season'] = "%";
}
if (!isset($_POST['opp'])) {
$_POST['opp'] = "%";
}
$matches = $player->getFilteredMatches($_POST['format'], $_POST['series'], $_POST['season'], $_POST['opp']);
echo "<table class=\"scoreboard\">";
echo "<tr class=\"top\"><th>Event</th><th>Round</th><th>Opponent</th><th>Deck</th><th>Rating</th><th>Result</th></tr>";
$oldname = "";
$rowcolor = "even";
$Count = 1;
foreach ($matches as $match) {
$rnd = $match->round;
if ($match->timing == 2 && $match->type == "Single Elimination") {
$rnd = "T" . pow(2, $match->rounds + 1 - $match->round);
}
$opp = $match->otherPlayer($player->name);
$res = "D";
if ($match->playerWon($player->name)) {
$res = "W";
}
if ($match->playerLost($player->name)) {
$res = "L";
}
$opponent = new Player($opp);
$event = $match->getEvent();
$oppRating = $opponent->getRating("Composite", $event->start);
$oppDeck = $opponent->getDeckEvent($event->name);
$deckStr = "No Deck Found";
if (!is_null($oppDeck)) {
$deckStr = $oppDeck->linkTo();
}
if ($oldname != $event->name) {
if ($Count % 2 != 0) {
$rowcolor = "odd";
$Count++;
} else {
$rowcolor = "even";
$Count++;
}
echo "<tr class=\"{$rowcolor}\"><td>{$event->name}</td>";
} else {
echo "<tr class=\"{$rowcolor}\"><td></td>\n";
}
$oldname = $event->name;
echo "<td>{$rnd}</td>\n";
echo "<td>" . $opponent->linkTo() . "</td>\n";
echo "<td>{$deckStr}</td>\n";
echo "<td>{$oppRating}</td>\n";
echo "<td>{$res} {$match->getPlayerWins($player->name)} - {$match->getPlayerLosses($player->name)} </td>";
echo "</tr>\n";
}
echo "</table>";
}
示例4: matchupTable
function matchupTable($deck)
{
$matches = $deck->getMatches();
echo "<table style=\"border-width: 0px\" cellpadding=1 align=\"right\">\n";
echo "<tr><td colspan=4 align=\"left\"><b>MATCHUPS</td></tr>\n";
if (count($matches) == 0) {
echo "<tr><td colspan=4><i>No matches were found for this deck</td></tr>";
}
$event = new Event($deck->eventname);
if ($event->finalized == '0') {
echo "<tr><td>Matchups are anonymous for deck privacy until event is finalized.</td><tr>";
} else {
foreach ($matches as $match) {
$rnd = 'R' . $match->round;
if ($match->timing > 1 && $match->type == 'Single Elimination') {
$rnd = 'T' . pow(2, $match->rounds - $match->round + 1);
}
$color = "#FF9900";
$res = "Draw";
if ($match->playerMatchInProgress($deck->playername)) {
$res = "In Progress";
}
if ($match->playerWon($deck->playername)) {
$color = "#009900";
$res = "Win";
}
if ($match->playerLost($deck->playername)) {
$color = "#FF0000";
$res = "Loss";
}
if ($match->playerBye($deck->playername)) {
$res = "Bye";
}
$resStr = "<b><font color=\"color\">{$res}</font></b>";
if ($res != 'Bye') {
$opp = new Player($match->otherPlayer($deck->playername));
$deckcell = "No Deck Found";
$oppdeck = $opp->getDeckEvent($deck->eventname);
if ($oppdeck != NULL) {
$deckcell = $oppdeck->linkTo();
}
echo "<tr><td align=\"right\">{$rnd}: </td>\n";
echo "<td align=\"left\"><b><font color=\"{$color}\">{$res}</font>: </td>\n";
echo "<td width=30>{$match->getPlayerWins($deck->playername)} - {$match->getPlayerLosses($deck->playername)}</td>";
echo "<td>vs. </td>\n";
echo "<td align=\"left\">" . $opp->linkTo() . " </td>\n";
echo "<td align=\"right\">{$deckcell} </td></tr>\n";
} else {
echo "<tr><td align=\"right\">{$rnd}: </td>\n";
echo "<td align=\"left\"><b>{$res}: </td>\n";
echo "<td width=30> Bye </td>";
echo "<td>vs. </td>\n";
echo "<td align=\"left\"> No Opponent </td>\n";
echo "<td align=\"right\">No Deck Found </td></tr>\n";
}
}
}
echo "<tr><td> </td></tr>";
echo "</table>\n";
}
示例5: trophyCell
function trophyCell($event)
{
if ($event->hastrophy) {
echo Event::trophy_image_tag($event->name) . "<br />\n";
} else {
echo image_tag("notrophy.png");
}
$deck = $event->getPlaceDeck('1st');
$player = $event->getPlacePlayer('1st');
if (!$player) {
echo "No winner yet!";
} else {
$playerwin = new Player($player);
echo $playerwin->linkTo();
$info = deckInfo($deck);
echo image_tag("colors/{$info[1]}.png");
echo $deck->linkTo();
echo "<br />\n";
}
}
示例6: content
function content()
{
if (!empty($_GET['deck']) || !empty($_GET['card'])) {
$db = Database::getConnection();
$decknamesearch = "%" . $db->escape_string($_GET['deck']) . "%";
$cardsearch_wild = "%" . $db->escape_string($_GET['card']) . "%";
// TODO: I need a better way of doing this
if (empty($_GET['card']) && !empty($_GET['deck'])) {
$stmt = $db->prepare("SELECT id FROM decks WHERE name LIKE ? LIMIT 20");
$stmt->bind_param("s", $decknamesearch);
} else {
if (!empty($_GET['card']) && !empty($_GET['deck'])) {
$stmt = $db->prepare("SELECT id FROM decks WHERE name LIKE ? AND deck_contents_cache LIKE ? LIMIT 20");
$stmt->bind_param("ss", $decknamesearch, $cardsearch);
} else {
if (!empty($_GET['card']) && empty($_GET['deck'])) {
$stmt = $db->prepare("SELECT id FROM decks WHERE deck_contents_cache LIKE ? LIMIT 20");
$stmt->bind_param("s", $cardsearch_wild);
}
}
}
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id);
$search_desc = "";
if (!empty($_GET['card'])) {
$search_desc .= " with {$_GET['card']} in them";
}
if (!empty($_GET['deck'])) {
if (!empty($search_desc)) {
$search_desc .= " AND ";
}
$search_desc .= " with '{$_GET['deck']}' in the deck name";
}
if ($stmt->num_rows() == 0) {
echo "<center>No decks {$search_desc}! Try again!</center>\n";
} else {
if ($stmt->num_rows() == 20) {
echo "<center>More than 20 decks {$search_desc}</center>\n";
} else {
echo "<center>{$stmt->num_rows()} decks {$search_desc}</center>\n";
}
$deck_ids = array();
while ($stmt->fetch()) {
$deck_ids[] = $id;
}
$stmt->close();
echo "<table align=\"center\" style=\"border-width: 0px;\" cellpadding=3>";
echo "<tr><th>Deck Name</th><th>Played by</th><th>Event</th> </tr>";
foreach ($deck_ids as $deck_id) {
$deck = new Deck($deck_id);
echo "<tr><td>" . medalImgStr($deck->medal) . "\n";
echo $deck->linkTo();
echo "</td>";
if ($deck->playername != NULL) {
$aplay = new Player($deck->playername);
echo "<td>{$aplay->linkTo()}</td>";
} else {
echo "<td>???</td>";
}
if ($deck->eventname != NULL) {
echo "<td><a href=\"eventreport.php?event={$deck->eventname}\">{$deck->eventname}</a></td>";
} else {
echo "<td>???</td>";
}
echo "</tr>\n";
}
echo "</table>";
}
} else {
echo "<form method=\"get\" action=\"{$_SERVER['REQUEST_URI']}\"><table class=\"form\">";
echo "<tr><th>Deck name contains</th> <td>";
echo "<input type=\"text\" name=\"deck\"></td></tr>";
echo "<tr><th>Deck contains card</th><td>";
echo "<input type=\"text\" name=\"card\"></td></tr>";
echo "<tr><td colspan=2 class=\"buttons\">";
echo "<input type=\"submit\" value=\"Gimme some decks!\"></td></tr>";
echo "</table></form>";
echo "<table><tr><th colspan=2><b>MOST PLAYED DECKS</b></th></tr>";
echo "<tr><th>Deck Name</th><th>Played</th></tr>";
$db = Database::getConnection();
$stmt = $db->prepare("SELECT count(d.deck_hash) as cnt, d.name, d.id FROM decks d, entries n where n.deck = d.id AND 5 < (SELECT count(*) from deckcontents where deck = d.id group by deck) group by d.deck_hash order by cnt desc limit 20");
$stmt->execute();
$stmt->bind_result($count, $name, $deckid);
while ($stmt->fetch()) {
echo "<tr><td><a href=\"deck.php?mode=view&id={$deckid}\">{$name}</a></td>";
echo "<td>{$count} times</td></tr>";
}
echo "</table>";
}
}