Ejemplo n.º 1
0
function matchList($event)
{
    $matches = $event->getMatches();
    echo "<tr><td align=\"center\" colspan=\"2\">";
    echo "<table align=\"center\" style=\"border-width: 0px;\">";
    echo "<tr><td align=\"center\" colspan=\"5\">";
    echo "<b>Match List</td></tr>";
    echo "<tr><td align=\"center\" colspan=\"5\">";
    echo "<i>* denotes a playoff/finals match.</td></tr>";
    echo "<input type=\"hidden\" name=\"view\" value=\"match\">";
    echo "<tr><td>&nbsp;</td></tr>";
    if (count($matches) > 0) {
        echo "<tr><td align=\"center\"><b>Round</td><td><b>Player A</td>";
        echo "<td><b>Player B</td>";
        echo "<td><b>Winner</td><td align=\"center\"><b>Delete</td></tr>";
    } else {
        echo "<tr><td align=\"center\" colspan=\"5\"><i>";
        echo "There are no matches listed for this event.</td></tr>";
    }
    $first = 1;
    $rndadd = 0;
    foreach ($matches as $match) {
        if ($first && $match->timing == 1) {
            $rndadd = $match->rounds;
        }
        $first = 0;
        $printrnd = $match->timing == 2 ? $match->round + $rndadd : $match->round;
        $printplr = $match->getWinner();
        if (is_null($printplr)) {
            $printplr = "* Draw *";
        }
        $star = $match->timing > 1 ? "*" : "";
        echo "<tr><td align=\"center\">{$printrnd}{$star}</td>";
        echo "<td>{$match->playera}</td>";
        echo "<td>{$match->playerb}</td><td>{$printplr}</td>";
        echo "<td align=\"center\">";
        echo "<input type=\"checkbox\" name=\"matchdelete[]\" ";
        echo "value=\"{$match->id}\"></td></tr>";
    }
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td align=\"center\" colspan=\"5\">";
    echo "<b>Add a Match</b></td></tr>";
    echo "<tr><td align=\"center\" colspan=\"5\">";
    roundDropMenu($event);
    playerDropMenu($event, "A");
    playerDropMenu($event, "B");
    resultDropMenu();
    echo "</td></tr>";
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td align=\"center\" colspan=\"5\">";
    echo "<input type=\"submit\" name=\"mode\" ";
    echo "value=\"Update Match Listing\"></td></tr>";
    echo "</table>";
    echo "</td></tr>";
}
Ejemplo n.º 2
0
function matchList($event)
{
    global $drop_icon;
    $matches = $event->getMatches();
    // Prevent warnings in php output.  TODO: make this not needed.
    if (!isset($_POST['newmatchround'])) {
        $_POST['newmatchround'] = '';
    }
    echo "<p style=\"text-align: center\"><b>Match List</b><br />";
    echo "<i>* denotes a playoff/finals match.</i><br />";
    echo "<i>To drop a player while entering match results, select the";
    echo " check box next to the players name.</i></p>";
    // Quick links to rounds
    echo "<p style=\"text-align: center\">";
    for ($r = 1; $r <= $event->current_round; $r++) {
        echo "<a href=\"event.php?view=match&name=" . urlencode($event->name) . "#round-{$r}\">Round {$r}</a> ";
    }
    echo "</p>";
    // Start a new form
    echo "<form action=\"event.php\" method=\"post\" enctype=\"multipart/form-data\">";
    echo "<input type=\"hidden\" name=\"name\" value=\"" . htmlentities($event->name) . "\">";
    echo "<input type=\"hidden\" name=\"eventname\" value=\"" . htmlentities($event->name) . "\">";
    echo "<input type=\"hidden\" name=\"view\" value=\"match\">";
    echo "<table align=\"center\" style=\"border-width: 0px;\">";
    if (count($matches) > 0) {
        echo "<tr class=\"lefted\"><th style=\"text-align: center; padding-right: 10px;\">Round</th><th>Player A</th>";
        echo "<th>Result</th>";
        echo "<th>Player B</th>";
        echo "<th style=\"text-align: center;\"><b>Delete</th></tr>";
    } else {
        echo "<tr><td align=\"center\" colspan=\"5\"><i>";
        echo "There are no matches listed for this event.</td></tr>";
    }
    $first = 1;
    $rndadd = 0;
    $thisround = 0;
    $ezypaste = "";
    $playersInMatches = array();
    foreach ($matches as $match) {
        if ($first && $match->timing == 1) {
            $rndadd = $match->rounds;
        }
        $first = 0;
        if ($match->timing == 2) {
            $printrnd = $match->round + $rndadd;
        } else {
            $printrnd = $match->round;
        }
        $printplr = $match->getWinner();
        if (is_null($printplr)) {
            $printplr = 'Database Error';
        }
        // TODO: will need to add some code here for byes.
        $star = $match->timing > 1 ? "*" : "";
        if ($printrnd != $thisround) {
            $thisround = $printrnd;
            $playersInMatches = array();
            $extraRoundTitle = "";
            if ($match->timing > 1) {
                $extraRoundTitle = "(Finals Round {$match->round})";
            }
            echo "<tr><td align=\"center\" colspan=\"7\" style=\"background-color: PaleGreen;\"> <a name=\"round-{$thisround}\"></a>ROUND {$thisround} {$extraRoundTitle} </td></tr>";
        }
        echo "<tr><td align=\"center\">{$printrnd}{$star}</td>";
        $playersInMatches[] = $match->playera;
        $playersInMatches[] = $match->playerb;
        if (strcasecmp($match->verification, 'verified') != 0 && $event->finalized == 0) {
            printUnverifiedPlayerCell($match, $match->playera);
            echo "<td>";
            echo "<input type=\"hidden\" name=\"hostupdatesmatches[]\" value=\"{$match->id}\">";
            resultDropMenu("matchresult[]");
            echo "</td>";
            printUnverifiedPlayerCell($match, $match->playerb);
        } else {
            $playerawins = $match->getPlayerWins($match->playera);
            $playerbwins = $match->getPlayerWins($match->playerb);
            $playeradropflag = $match->playerDropped($match->playera) ? $drop_icon : "";
            $playerbdropflag = $match->playerDropped($match->playerb) ? $drop_icon : "";
            echo "<td class=\"match_{$match->verification}\">{$match->playera}</td>";
            if ($match->playera == $match->playerb) {
                echo "<td>BYE</td>";
                echo "<td></td>";
            } else {
                echo "<td>{$playeradropflag} {$playerawins}-{$playerbwins} {$playerbdropflag}</td>";
                echo "<td class=\"match_{$match->verification}\">{$match->playerb}</td>";
            }
        }
        echo "<td align=\"center\">";
        echo "<input type=\"checkbox\" name=\"matchdelete[]\" ";
        echo "value=\"{$match->id}\"></td></tr>";
    }
    $ezypaste .= "/me Good luck everyone!<br />";
    echo "<tr><td>&nbsp;</td></tr>";
    if ($event->active) {
        echo "<tr><td align=\"right\" colspan=\"3\"><b>Add Pairing</b></td>";
        echo "<input type=\"hidden\" name=\"newmatchround\" value=\"{$event->current_round}\">";
        echo "<input type=\"hidden\" name=\"newmatchresult\" value=\"P\">";
        echo "<td colspan=\"4\">";
        playerDropMenu($event, "A", "\n", $playersInMatches);
        echo " vs ";
        playerDropMenu($event, "B", "\n", $playersInMatches);
        echo "</td></tr>";
        echo "<tr><td align=\"right\" colspan=\"3\"><b>Award Bye</b></td>";
        echo "<td colspan=\"4\">";
        playerByeMenu($event, "\n", $playersInMatches);
        echo "</td></tr>";
    } else {
        echo "<tr><td align=\"center\" colspan=\"7\">";
        echo "<b>Add a Match</b></td></tr>";
        echo "<tr><td align=\"center\" colspan=\"7\">";
        roundDropMenu($event, $_POST['newmatchround']);
        playerDropMenu($event, "A");
        resultDropMenu("newmatchresult", array("P" => "In Progress", "BYE" => "BYE"));
        playerDropMenu($event, "B");
        echo "</td></tr>";
    }
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td align=\"center\" colspan=\"7\">";
    echo "<input type=\"submit\" name=\"mode\" ";
    echo "value=\"Update Match Listing\"></td></tr>";
    echo "</form>";
    echo "</table>";
    echo "<p>Paste stuff:<br />";
    echo "<code>";
    echo "/me Pairings for Round {$thisround}<br />";
    foreach ($event->unfinishedMatches() as $match) {
        echo "/me {$match->playera} vs. {$match->playerb}<br />";
    }
    echo "/me Good luck everyone!<br />";
    echo "<br />";
    echo "/me [sLizard] Results for ROUND {$thisround} [sSpellS]<br />";
    foreach ($event->finishedMatches() as $match) {
        if ($match->isBYE()) {
            echo "/me {$match->playera} has the BYE<br />";
        } else {
            $playerawins = $match->getPlayerWins($match->playera);
            $playerbwins = $match->getPlayerWins($match->playerb);
            echo "/me {$match->playera} {$playerawins}-{$playerbwins} {$match->playerb}<br />";
        }
    }
    echo "/me [sLizard] Please check your results for errors!  The next round starts in 2 minutes! [sSpellI]<br />";
    echo "</code>";
}