コード例 #1
0
ファイル: player.php プロジェクト: jamuraa/gatherling
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>";
}
コード例 #2
0
ファイル: deck.php プロジェクト: OldVig/gatherling
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";
    #	echo "<tr><td><b>Round</td><td><b>Result</td><td><b>Opponent</td>";
    #	echo "<td><b>Deck</td></tr>\n";
    #	echo "<tr><td><b>MATCHUPS</td></tr>\n";
    if (count($matches) == 0) {
        echo "<tr><td colspan=4><i>No matches were found for this deck</td></tr>";
    }
    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->playerWon($deck->playername)) {
            $color = "#009900";
            $res = "Win";
        }
        if ($match->playerLost($deck->playername)) {
            $color = "#FF0000";
            $res = "Loss";
        }
        $resStr = "<b><font color=\"{$color}\">{$res}</font></b>";
        $opp = new Player($match->otherPlayer($deck->playername));
        $deckcell = "No Deck Found";
        $oppdeck = $opp->getDeckEvent($deck->eventname);
        if ($oppdeck != NULL) {
            $deckcell = "<a href=\"deck.php?id={$oppdeck->id}&mode=view\">" . $oppdeck->name . "</a>";
        }
        #		echo "<tr><td align=\"center\">$rnd</td>\n";
        #		echo "<td><b><font color=\"$color\">$res</font></td>\n";
        #		echo "<td>$opp</td>\n";
        #		echo "<td>$deckcell</td></tr>\n";
        #		echo "<tr><td>{$rnd}: $resStr vs. $opp, $deckcell</td></tr>";
        echo "<tr><td align=\"right\">{$rnd}:&nbsp;</td>\n";
        echo "<td align=\"left\"><b><font color=\"{$color}\">{$res}</font>&nbsp;</td>\n";
        echo "<td>vs.&nbsp;</td>\n";
        echo "<td align=\"left\"><a href=\"profile.php?player={$opp->name}\">{$opp->name}</a>&nbsp;</td>\n";
        echo "<td align=\"right\">{$deckcell}&nbsp;</td></tr>\n";
    }
    echo "<tr><td>&nbsp;</td></tr>";
    echo "</table>\n";
}
コード例 #3
0
ファイル: deck.php プロジェクト: jamuraa/gatherling
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}:&nbsp;</td>\n";
                echo "<td align=\"left\"><b><font color=\"{$color}\">{$res}</font>:&nbsp;</td>\n";
                echo "<td width=30>{$match->getPlayerWins($deck->playername)} - {$match->getPlayerLosses($deck->playername)}</td>";
                echo "<td>vs.&nbsp;</td>\n";
                echo "<td align=\"left\">" . $opp->linkTo() . "&nbsp;</td>\n";
                echo "<td align=\"right\">{$deckcell}&nbsp;</td></tr>\n";
            } else {
                echo "<tr><td align=\"right\">{$rnd}:&nbsp;</td>\n";
                echo "<td align=\"left\"><b>{$res}:&nbsp;</td>\n";
                echo "<td width=30> Bye </td>";
                echo "<td>vs.&nbsp;</td>\n";
                echo "<td align=\"left\"> No Opponent&nbsp;</td>\n";
                echo "<td align=\"right\">No Deck Found&nbsp;</td></tr>\n";
            }
        }
    }
    echo "<tr><td>&nbsp;</td></tr>";
    echo "</table>\n";
}
コード例 #4
0
ファイル: player.php プロジェクト: OldVig/gatherling
function 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']);
    $hc = headerColor();
    echo "<table style=\"border-width: 0px\" width=600>\n";
    echo "<tr style=\"background-color: {$hc};\"><td><b>Event</td><td align=\"center\"><b>Round</td>";
    echo "<td><b>Opponent</td>\n";
    echo "<td><b>Deck</td>\n";
    echo "<td align=\"center\"><b>Rating</td>\n";
    echo "<td align=\"center\"><b>Result</td></tr>\n";
    $oldname = "";
    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 = "Draw";
        $color = "#FF9900";
        if ($match->playerWon($player->name)) {
            $res = "Win";
            $color = "#009900";
        }
        if ($match->playerLost($player->name)) {
            $res = "Loss";
            $color = "#FF0000";
        }
        $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 = "<a href=\"deck.php?mode=view&id={$oppDeck->id}\">" . "{$oppDeck->name}</a>";
        }
        if ($oldname != $event->name) {
            $bg = rowColor();
            echo "<tr style=\"background-color: {$bg}\"><td>{$event->name}</td>";
        } else {
            echo "<tr style=\"background-color: {$bg};\"><td></td>\n";
        }
        $oldname = $event->name;
        echo "<td align=\"center\">{$rnd}</td>\n";
        echo "<td><a href=\"profile.php?player={$opp}\">{$opp}</a></td>\n";
        echo "<td>{$deckStr}</td>\n";
        echo "<td align=\"center\">{$oppRating}</td>\n";
        echo "<td align=\"center\"><b><font color=\"{$color}\">{$res}</font>";
        echo "</td></tr>\n";
    }
    echo "</table>";
}