function printSeriesForm($series) { echo "<form action=\"seriescp.php\" method=\"post\">"; echo "<table class=\"form\" style=\"border-width: 0px\" align=\"center\">"; echo "<input type=\"hidden\" name=\"series\" value=\"{$series->name}\" />"; # Active echo "<tr><th> Series is Active </th> <td> "; if ($series->active == 1) { echo "<select name=\"isactive\"> <option value=\"1\" selected>Yes</option> <option value=\"0\">No</option></select>"; } else { echo "<select name=\"isactive\"> <option value=\"1\">Yes</option> <option value=\"0\" selected>No</option></select>"; } echo "</td></tr>"; # Start day echo "<tr><th> Normal start day </th> <td> "; echo "<select name=\"start_day\">"; $days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'); foreach ($days as $dayofweek) { if ($dayofweek == $series->start_day) { echo "<option selected>{$dayofweek}</option>"; } else { echo "<option>{$dayofweek}</option>"; } } echo "</select>"; echo "</td></tr>"; # Start time echo "<tr><th> Normal start time </th> <td> "; $time_parts = explode(":", $series->start_time); timeDropMenu($time_parts[0], $time_parts[1]); echo "</td> </tr>"; # Pre-registration on by default? echo "<tr><th>Pre-Registration Default</th>"; echo "<td><input type=\"checkbox\" value=\"1\" name=\"preregdefault\" "; if ($series->prereg_default == 1) { echo "checked "; } echo "/></td></tr>"; # Submit button echo "<tr><td colspan=\"2\" class=\"buttons\">"; echo "<input type=\"submit\" name=\"action\" value=\"Update Series\" /> </td> </tr>"; echo "</table> </form>"; }
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> </td><td>"; $prevevent = $event->findPrev(); if ($prevevent) { echo $prevevent->makeLink("« Previous"); } $nextevent = $event->findNext(); if ($nextevent) { if ($prevevent) { echo " | "; } echo $nextevent->makeLink("Next »"); } 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 " / "; 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> </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> </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\"> </td></tr>"; controlPanel($event, $view); echo "<tr><td colspan=\"2\"> </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>"; }