示例#1
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>";
}
示例#2
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>";
}