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 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>";
}
Beispiel #3
0
function printPointsRule($rule, $key, $rules, $formtype = 'text', $size = 4)
{
    echo "<tr> <th> {$rule} </th>";
    if ($formtype == 'text') {
        echo "<td> <input type=\"text\" value=\"{$rules[$key]}\" name=\"new_rules[{$key}]\" size=\"{$size}\" /> </td> </tr> ";
    } else {
        if ($formtype == 'checkbox') {
            echo "<td> <input type=\"checkbox\" value=\"1\" name=\"new_rules[{$key}]\" ";
            if ($rules[$key] == 1) {
                echo "checked ";
            }
            echo " /> </td> </tr>";
        } else {
            if ($formtype == 'format') {
                echo "<td> ";
                formatDropMenu($rules[$key], 0, "new_rules[{$key}]");
                echo "</td> </tr>";
            }
        }
    }
}
Beispiel #4
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>";
}