Example #1
0
function selectSeason()
{
    echo "<form action=\"seriesreport.php\" method=\"get\">";
    echo "<table class=\"form\" style=\"border-width: 0px\" align=\"center\">";
    echo "<tr><th>Series</th><td>";
    Series::dropMenu($_GET['series'], 1);
    echo "</td></tr>";
    echo "<tr><th>Season</th><td>";
    seasonDropMenu($_GET['season'], 1);
    echo "</td></tr>";
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td colspan=\"2\" class=\"buttons\">";
    echo "<input type=\"submit\" value=\"Get Season Scoreboard\" />\n";
    echo "</td></tr></table></form>";
}
Example #2
0
function eventForm($event = NULL)
{
    $edit = $event != NULL;
    if (is_null($event)) {
        $event = new Event("");
    }
    echo "<form action=\"event.php\" method=\"post\" ";
    echo "enctype=\"multipart/form-data\">";
    echo "<table style=\"border-width: 0px\" align=\"center\">";
    if ($edit) {
        $date = $event->start;
        preg_match('/([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):.*/', $date, $datearr);
        $year = $datearr[1];
        $month = $datearr[2];
        $day = $datearr[3];
        $hour = $datearr[4];
        echo "<tr><td><b>Currently Editing</td>";
        echo "<td><i>{$event->name}</td>";
        echo "<input type=\"hidden\" name=\"name\" value=\"{$event->name}\">";
        echo "</tr><tr><td>&nbsp;</td></tr>";
    } else {
        echo "<tr><td valign=\"top\"><b>Event Name</td>";
        echo "<td><input type=\"radio\" name=\"naming\" value=\"auto\" checked>";
        echo "Automatically name this event based on Series, Season, and Number.";
        echo "<br><input type=\"radio\" name=\"naming\" value=\"custom\">";
        echo "Use a custom name: ";
        echo "<input type=\"text\" name=\"name\" value=\"{$event->name}\" ";
        echo "size=\"40\">";
        echo "</td></tr>";
        $year = strftime('Y', time());
    }
    echo "<tr><td><b>Date & Time</td><td>";
    numDropMenu("year", "- Year -", 2010, $year, 2005);
    monthDropMenu($month);
    numDropMenu("day", "- Day- ", 31, $day, 1);
    hourDropMenu($hour);
    echo "</td></tr>";
    echo "<tr><td><b>Series</td><td>";
    seriesDropMenu($event->series);
    echo "</td></tr>";
    echo "<tr><td><b>Season</td><td>";
    seasonDropMenu($event->season);
    echo "</td></tr>";
    echo "<tr><td><b>Number</td><td>";
    numDropMenu("number", "- Event Number -", 20, $event->number, 0, "Custom");
    echo "</td><tr>";
    echo "<tr><td><b>Format</td><td>";
    formatDropMenu($event->format);
    echo "</td></tr>";
    echo "<tr><td><b>K-Value:</td><td>";
    kValueDropMenu($event->kvalue);
    echo "</td></tr>";
    echo "<tr><td><b>Host/Cohost</td><td>";
    stringField("host", $event->host, 20);
    echo "&nbsp;/&nbsp;";
    stringField("cohost", $event->cohost, 20);
    echo "</td></tr>";
    echo "<tr><td><b>Event Thread URL</td><td>";
    stringField("threadurl", $event->threadurl, 60);
    echo "</td></tr>";
    echo "<tr><td><b>Metagame URL</td><td>";
    stringField("metaurl", $event->metaurl, 60);
    echo "</td></tr>";
    echo "<tr><td><b>Report URL</td><td>";
    stringField("reporturl", $event->reporturl, 60);
    echo "</td></tr>";
    echo "<tr><td><b>Main Event Structure</td><td>";
    numDropMenu("mainrounds", "- No. of Rounds -", 10, $event->mainrounds, 1);
    echo " rounds of ";
    structDropMenu("mainstruct", $event->mainstruct);
    echo "</td></tr>";
    echo "<tr><td><b>Finals Structure</td><td>";
    numDropMenu("finalrounds", "- No. of Rounds -", 10, $event->finalrounds, 0);
    echo " rounds of ";
    structDropMenu("finalstruct", $event->finalstruct);
    echo "</td></tr>";
    if ($edit == 0) {
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td colspan=\"2\" align=\"center\">";
        echo "<input type=\"submit\" name=\"mode\" value=\"Create New Event\">";
        echo "<input type=\"hidden\" name=\"insert\" value=\"1\">";
        echo "</td></tr>";
    } else {
        echo "<tr><td><b>Finalize Event</td>";
        echo "<td><input type=\"checkbox\" name=\"finalize\" value=\"1\" ";
        if ($event->finalized == 1) {
            echo "checked";
        }
        echo "></td></tr>";
        trophyField($event);
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td colspan=\"2\" align=\"center\">";
        echo "<input type=\"submit\" name=\"mode\" value=\"Update Event Info\">";
        echo "<input type=\"hidden\" name=\"update\" value=\"1\">";
        echo "</td></tr>";
        $view = "reg";
        $view = isset($_GET['view']) ? $_GET['view'] : $view;
        $view = isset($_POST['view']) ? $_POST['view'] : $view;
        echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
        controlPanel($event, $view);
        echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
        if (strcmp($view, "reg") == 0) {
            playerList($event);
        } elseif (strcmp($view, "match") == 0) {
            matchList($event);
        } elseif (strcmp($view, "medal") == 0) {
            medalList($event);
        } elseif (strcmp($view, "autoinput") == 0) {
            autoInputForm($event);
        } elseif (strcmp($view, "fileinput") == 0) {
            fileInputForm($event);
        }
    }
    echo "</table></form>";
}
Example #3
0
function eventList($series = "", $season = "")
{
    $db = Database::getConnection();
    $result = $db->query("SELECT e.name AS name, e.format AS format,\n        COUNT(DISTINCT n.player) AS players, e.host AS host, e.start AS start,\n        e.finalized, e.cohost, e.series, e.season\n        FROM events e\n        LEFT OUTER JOIN entries AS n ON n.event = e.name \n        WHERE 1=1 AND e.start < NOW() GROUP BY e.name ORDER BY e.start DESC");
    $onlyformat = false;
    if (isset($_POST['format']) && strcmp($_POST['format'], "") != 0) {
        $onlyformat = $_POST['format'];
    }
    $onlyseries = false;
    if (isset($_POST['series']) && strcmp($_POST['series'], "") != 0) {
        $onlyseries = $_POST['series'];
    }
    $onlyseason = false;
    if (isset($_POST['season']) && strcmp($_POST['season'], "") != 0) {
        $onlyseason = $_POST['season'];
    }
    echo "<form action=\"eventreport.php\" method=\"post\">";
    echo "<table style=\"border-width: 0px\" align=\"center\">";
    echo "<tr><td colspan=\"2\" align=\"center\"><b>Filters</td></tr>";
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td>Format</td><td>";
    formatDropMenu($_POST['format'], 1);
    echo "</td></tr>";
    echo "<tr><td>Series</td><td>";
    seriesDropMenu($_POST['series'], 1);
    echo "</td></tr>";
    echo "<tr><td>Season</td><td>";
    seasonDropMenu($_POST['season'], 1);
    echo "</td></tr>";
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td colspan=\"2\" align=\"center\">";
    echo "<input type=\"submit\" name=\"mode\" value=\"Filter Events\">";
    echo "</td></tr></table>";
    echo "<table style=\"border-width: 0px\" align=\"center\" cellpadding=\"3\">";
    echo "<tr><td colspan=\"5\">&nbsp;</td></tr>";
    echo "<tr><td><b>Event</td><td><b>Format</td>";
    echo "<td align=\"center\"><b>No. Players</td>";
    echo "<td><b>Host(s)</td></tr>";
    $count = 0;
    while ($count < 100 && ($thisEvent = $result->fetch_assoc())) {
        if ($onlyformat && strcmp($thisEvent['format'], $onlyformat) != 0 || $onlyseries && strcmp($thisEvent['series'], $onlyseries) != 0 || $onlyseason && strcmp($thisEvent['season'], $onlyseason) != 0) {
            continue;
        }
        $dateStr = $thisEvent['start'];
        $dateArr = split(" ", $dateStr);
        $date = $dateArr[0];
        echo "<tr><td>";
        echo "<a href=\"eventreport.php?event={$thisEvent['name']}\">";
        echo "{$thisEvent['name']}</a></td>";
        echo "<td>{$thisEvent['format']}</td>";
        echo "<td align=\"center\">{$thisEvent['players']}</td>";
        echo "<td>{$thisEvent['host']}";
        $ch = $thisEvent['cohost'];
        if (!is_null($ch) && strcmp($ch, "") != 0) {
            echo "/{$ch}";
        }
        echo "</td>";
        #echo "<td>$date</td>";
        # echo "<td align=\"center\"><input type=\"checkbox\" ";
        # if($thisEvent['finalized'] == 1) {echo "checked";}
        # echo "></td>";
        echo "</tr>";
        $count = $count + 1;
    }
    $result->close();
    if ($count == 100) {
        echo "<tr><td colspan=\"5\" width=\"500\">&nbsp;</td></tr>";
        echo "<tr><td colspan=\"5\" align=\"center\">";
        echo "<i>This list only shows the 100 most recent results. ";
        echo "Please use the filters at the top of this page to find older ";
        echo "results.</i></td></tr>";
    }
    echo "<tr><td colspan=\"5\" width=\"500\">&nbsp;</td></tr>";
    #   echo "<tr><td colspan=\"5\" align=\"center\">";
    #   echo "<input type=\"submit\" name=\"mode\" value=\"Create New Event\">";
    #   echo "</td></tr>";
    echo "</table></form>";
}
Example #4
0
function printPointsForm($series)
{
    global $_GET, $_POST;
    $chosen_season = $series->currentSeason();
    if (isset($_GET['season'])) {
        $chosen_season = $_GET['season'];
    }
    if (isset($_POST['season'])) {
        $chosen_season = $_POST['season'];
    }
    echo "<h3><center> Season Points Management </center> </h3>";
    echo "<p style=\"width:75%; text-align: left;\">Here you can edit the way that season points are calculated for each player.  Choose the season that you want your point rules to be active for, and then put in the number of season points for each type of event.  You can adjust the points a player gets for each event individually as well, to take away points for not posting a deck for example or giving extra points for a tiebreaker-miss of top eight.</p>";
    echo "<p style=\"width:75%; text-align: left;\">Points are cumulative, so if someone gets the first place, they will get points for first place, participation, each round they played (in the main event, not the finals), for each match they won, lost, and got a bye, as well as the points for posting a decklist if they do post.  However, The first place to top 8 points are NOT added together, you only get points for where you end up (calculated by the medals).  An event winner doesn't get points for the second place, top 4 or top 8.</p>";
    echo "<p style=\"width:75%; text-align: left;\"><strong>Points are NOT counted for events with the 'Custom' number!</strong></p>";
    echo "<center>";
    echo "<form action=\"seriescp.php\">";
    echo "<input type=\"hidden\" name=\"series\" value=\"{$series->name}\" />";
    seasonDropMenu($chosen_season);
    echo "<input type=\"submit\" value=\"Choose Season\" />";
    echo "</form>";
    echo "</center>";
    $seasonrules = $series->getSeasonRules($chosen_season);
    echo "<form action=\"seriescp.php\" method=\"post\">";
    echo "<input type=\"hidden\" name=\"series\" value=\"{$series->name}\" />";
    echo "<input type=\"hidden\" name=\"season\" value=\"{$chosen_season}\" />";
    echo "<table class=\"form\" style=\"border-width: 0px;\" align=\"center\">";
    echo "<tr> <th class=\"top\" colspan=\"2\"> Season {$chosen_season} Point Rules </th></tr>";
    printPointsRule("First Place", "first_pts", $seasonrules);
    printPointsRule("Second Place", "second_pts", $seasonrules);
    printPointsRule("Top 4", "semi_pts", $seasonrules);
    printPointsRule("Top 8", "quarter_pts", $seasonrules);
    printPointsRule("Participating", "participation_pts", $seasonrules);
    printPointsRule("Each round played", "rounds_pts", $seasonrules);
    printPointsRule("Match win", "win_pts", $seasonrules);
    printPointsRule("Match loss", "loss_pts", $seasonrules);
    printPointsRule("Round bye", "bye_pts", $seasonrules);
    printPointsRule("Posting a decklist", "decklist_pts", $seasonrules);
    printPointsRule("Require decklist for points", "must_decklist", $seasonrules, 'checkbox');
    printPointsRule("WORLDS Cutoff (players)", "cutoff_ord", $seasonrules);
    printPointsRule("Master Document Location", "master_link", $seasonrules, 'text', 50);
    printPointsRule("Season Format", "format", $seasonrules, 'format');
    echo "<tr> <td colspan=\"2\" class=\"buttons\">";
    echo "<input type=\"submit\" name=\"action\" value=\"Update Points Rules\" />";
    echo "</td> </table> </form>";
}
Example #5
0
function eventForm($event = NULL, $forcenew = false)
{
    if ($forcenew) {
        $edit = 0;
    } else {
        $edit = $event != NULL;
    }
    if (is_null($event)) {
        $event = new Event("");
    }
    echo "<form action=\"event.php\" method=\"post\" ";
    echo "enctype=\"multipart/form-data\">";
    echo "<table class=\"form\" style=\"border-width: 0px\" align=\"center\">";
    $current_year = strftime('%Y', time());
    if ($event->start != NULL) {
        $date = $event->start;
        preg_match('/([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):.*/', $date, $datearr);
        $year = $datearr[1];
        $month = $datearr[2];
        $day = $datearr[3];
        $hour = $datearr[4];
        $minutes = $datearr[5];
        echo "<tr><th>Currently Editing</th>";
        echo "<td><i>" . htmlentities($event->name) . "</i>";
        echo "<input type=\"hidden\" name=\"name\" value=\"" . htmlentities($event->name) . "\">";
        echo "</td>";
        echo "</tr><tr><td>&nbsp;</td><td>";
        $prevevent = $event->findPrev();
        if ($prevevent) {
            echo $prevevent->makeLink("&laquo; Previous");
        }
        $nextevent = $event->findNext();
        if ($nextevent) {
            if ($prevevent) {
                echo " | ";
            }
            echo $nextevent->makeLink("Next &raquo;");
        }
        echo "</td></tr>";
    } else {
        echo "<tr><th>Event Name</th>";
        echo "<td><input type=\"radio\" name=\"naming\" value=\"auto\" checked>";
        echo "Automatically name this event based on Series, Season, and Number.";
        echo "<br /><input type=\"radio\" name=\"naming\" value=\"custom\">";
        echo "Use a custom name: ";
        echo "<input type=\"text\" name=\"name\" value=\"" . htmlentities($event->name) . "\" ";
        echo "size=\"40\">";
        echo "</td></tr>";
        $year = strftime('%Y', time());
        $month = strftime('%B', time());
        $day = strftime('%e', time());
        $hour = strftime('%H', time());
        $minutes = strftime('%M', time());
    }
    echo "<tr><th>Date & Time</th><td>";
    numDropMenu("year", "- Year -", $current_year + 1, $year, 2005);
    monthDropMenu($month);
    numDropMenu("day", "- Day- ", 31, $day, 1);
    timeDropMenu($hour, $minutes);
    echo "</td></tr>";
    echo "<tr><th>Series</th><td>";
    $seriesList = Player::getSessionPlayer()->stewardsSeries();
    $seriesList[] = "Other";
    Series::dropMenu($event->series, 0, $seriesList);
    echo "</td></tr>";
    echo "<tr><th>Season</th><td>";
    seasonDropMenu($event->season);
    echo "</td></tr>";
    echo "<tr><th>Number</th><td>";
    numDropMenu("number", "- Event Number -", Event::largestEventNum() + 5, $event->number, 0, "Custom");
    echo "</td><tr>";
    echo "<tr><th>Format</th><td>";
    formatDropMenu($event->format);
    echo "</td></tr>";
    echo "<tr><th>K-Value</th><td>";
    kValueDropMenu($event->kvalue);
    echo "</td></tr>";
    echo "<tr><th>Host/Cohost</th><td>";
    stringField("host", $event->host, 20);
    echo "&nbsp;/&nbsp;";
    stringField("cohost", $event->cohost, 20);
    echo "</td></tr>";
    echo "<tr><th>Event Thread URL</th><td>";
    stringField("threadurl", $event->threadurl, 60);
    echo "</td></tr>";
    echo "<tr><th>Metagame URL</th><td>";
    stringField("metaurl", $event->metaurl, 60);
    echo "</td></tr>";
    echo "<tr><th>Report URL</th><td>";
    stringField("reporturl", $event->reporturl, 60);
    echo "</td></tr>";
    echo "<tr><th>Main Event Structure</th><td>";
    numDropMenu("mainrounds", "- No. of Rounds -", 10, $event->mainrounds, 1);
    echo " rounds of ";
    structDropMenu("mainstruct", $event->mainstruct);
    echo "</td></tr>";
    echo "<tr><th>Finals Structure</th><td>";
    numDropMenu("finalrounds", "- No. of Rounds -", 10, $event->finalrounds, 0);
    echo " rounds of ";
    structDropMenu("finalstruct", $event->finalstruct);
    echo "</td></tr>";
    echo "<tr><th>Allow Pre-Registration</th>";
    echo "<td><input type=\"checkbox\" name=\"prereg_allowed\" value=\"1\" ";
    if ($event->prereg_allowed == 1) {
        echo "checked=\"yes\" ";
    }
    echo "/></td></tr>";
    echo "<tr><th>Players Can Report Results</th>";
    echo "<td><input type=\"checkbox\" name=\"player_reportable\" value=\"1\" ";
    if ($event->player_reportable == 1) {
        echo "checked=\"yes\" ";
    }
    echo "/></td></tr>";
    if ($edit == 0) {
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td colspan=\"2\" class=\"buttons\">";
        echo "<input type=\"submit\" name=\"mode\" value=\"Create New Event\">";
        echo "<input type=\"hidden\" name=\"insert\" value=\"1\">";
        echo "</td></tr>";
    } else {
        echo "<tr><th>Players Can Update Decks</th>";
        echo "<td><input type=\"checkbox\" name=\"player_editdecks\" value=\"1\" ";
        if ($event->player_editdecks == 1) {
            echo "checked=\"yes\" ";
        }
        echo "/></td></tr>";
        echo "<tr><th>Finalize Event</th>";
        echo "<td><input type=\"checkbox\" name=\"finalized\" value=\"1\" ";
        if ($event->finalized == 1) {
            echo "checked=\"yes\" ";
        }
        echo "/></td></tr>";
        trophyField($event);
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td colspan=\"2\" class=\"buttons\">";
        echo " <input type=\"submit\" name=\"mode\" value=\"Update Event Info\" />";
        $nexteventname = sprintf("%s %d.%02d", $event->series, $event->season, $event->number + 1);
        if (!Event::exists($nexteventname)) {
            echo " <input type=\"submit\" name=\"mode\" value=\"Create Next Event\" />";
        }
        echo "<input type=\"hidden\" name=\"update\" value=\"1\" />";
        echo "</td></tr>";
        echo "</table>";
        echo "</form>";
        echo "<table style=\"border-width: 0px\" align=\"center\">";
        $view = "reg";
        $view = isset($_GET['view']) ? $_GET['view'] : $view;
        $view = isset($_POST['view']) ? $_POST['view'] : $view;
        echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
        controlPanel($event, $view);
        echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
        echo "</table>";
        if (strcmp($view, "reg") == 0) {
            playerList($event);
        } elseif (strcmp($view, "match") == 0) {
            matchList($event);
        } elseif (strcmp($view, "standings") == 0) {
            standingsList($event);
        } elseif (strcmp($view, "medal") == 0) {
            medalList($event);
        } elseif (strcmp($view, "autoinput") == 0) {
            autoInputForm($event);
        } elseif (strcmp($view, "fileinput") == 0) {
            fileInputForm($event);
            file3InputForm($event);
        } elseif (strcmp($view, "points_adj") == 0) {
            pointsAdjustmentForm($event);
        }
    }
    echo "</table>";
}