function GetSignupsOfSize($connection, $tournamentKey, $maxSize, $signupKey) { $signups = array(); $paidSignups = GetSignups($connection, $tournamentKey, ' AND `Payment` >= `PaymentDue` ORDER BY `SubmitKey` DESC'); for ($i = 0; $i < count($paidSignups); ++$i) { if ($signupKey != $paidSignups[$i]->SignUpKey) { $playersSignedUp = GetPlayersForSignUp($connection, $paidSignups[$i]->SignUpKey); if (count($playersSignedUp) <= $maxSize) { $playerNames = null; for ($p = 0; $p < count($playersSignedUp); ++$p) { if (!empty($playerNames)) { $playerNames = $playerNames . " --- "; } $playerNames = $playerNames . " " . $playersSignedUp[$p]->LastName; } $m = new MergeSignUpClass(); $m->SignUpKey = $paidSignups[$i]->SignUpKey; $m->PlayerNames = ' ' . $playerNames . ' '; // add spaces for listbox $signups[] = $m; } } } return $signups; }
<?php require_once realpath($_SERVER["DOCUMENT_ROOT"]) . '/login.php'; require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/signup functions.php'; require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/tournament_functions.php'; date_default_timezone_set('America/Los_Angeles'); $tournamentKey = $_POST['tournament']; if (!$tournamentKey) { die("Which tournament?"); } $connection = new mysqli('p:' . $db_hostname, $db_username, $db_password, $db_database); if ($connection->connect_error) { die($connection->connect_error); } $tournament = GetTournament($connection, $tournamentKey); $signUpArray = GetSignups($connection, $tournamentKey, 'ORDER BY `SubmitKey` ASC'); //var_dump($signUpArray); for ($i = 0; $i < count($signUpArray); ++$i) { $playersSignedUp = GetPlayersForSignUp($connection, $signUpArray[$i]->SignUpKey); $players = null; for ($p = 0; $p < count($playersSignedUp); ++$p) { if (!empty($players)) { $players = $players . ","; } $extra = $playersSignedUp[$p]->Extra; if (strlen($extra) == 0 && $playersSignedUp[$p]->GHIN === 0) { $extra = "N"; } if ($extra === "G" && $tournament->MemberGuest) { $extra = $playersSignedUp[$p]->GHIN; }
function ShowSignups($connection, $tournamentKey) { $t = GetTournament($connection, $tournamentKey); echo '<h2 style="text-align:center">' . $t->Name . ' Signups</h2>' . PHP_EOL; echo '<table style="border: none; margin-left:auto;margin-right:auto;">' . PHP_EOL; echo '<tbody>' . PHP_EOL; if ($t->SrClubChampionship) { echo '<tr><td style="border: none">' . PHP_EOL; echo 'F1 = Flight 1 (under 55)<br>' . PHP_EOL; echo 'F2 = Flight 2 (55-59)<br>' . PHP_EOL; echo 'F3 = Flight 3 (60-69)<br>' . PHP_EOL; echo 'F4 = Flight 4 (70 and older)<br>' . PHP_EOL; echo 'CH = Championship Flight (55 and older)<br><br>' . PHP_EOL; echo '</td></tr>' . PHP_EOL; } $signUpArray = GetSignups($connection, $tournamentKey, ' AND `Payment` < `PaymentDue` ORDER BY `SubmitKey` DESC'); if (!empty($signUpArray)) { echo '<tr><td style="border: none">'; echo 'These players have not paid their tournament fee. You are not in the tournament until your fee has been paid. '; echo '</td></tr>' . PHP_EOL; echo '<tr><td style="border: none">'; echo 'If you have completed payment, but it is not yet recorded, be patient as PayPal may not have notified us yet. '; echo 'Notify the tournament director if payment is not recorded after 24 hours.'; echo '</td></tr>' . PHP_EOL; echo '<tr><td style="border: none">' . PHP_EOL; ShowSignupsTable($connection, $tournamentKey, $signUpArray, $t); echo '</td></tr>' . PHP_EOL; } $signUpArray = GetSignups($connection, $tournamentKey, ' AND `Payment` >= `PaymentDue` ORDER BY `SubmitKey` DESC'); if (!empty($signUpArray)) { if ($t->RequirePayment) { echo '<tr><td style="border: none">These players have signed up and have paid.</td></tr>'; } else { echo '<tr><td style="border: none">These players have signed up.</td></tr>'; } echo '<tr><td style="border: none">' . PHP_EOL; ShowSignupsTable($connection, $tournamentKey, $signUpArray, $t); echo '</td></tr>' . PHP_EOL; } echo '</tbody></table>' . PHP_EOL; }