Beispiel #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>";
}
Beispiel #2
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>";
}