Example #1
0
\t\t\t\t<li><input type="submit" name="start" value="Start Game" /></li>
\t\t\t</ul>

\t\t</div></form>
EOT;
    }
    // invitation form
    // grab our current player id list
    $players_joined = array_keys($game_players);
    // grab the full list of players
    $players_full = GamePlayer::get_list();
    $invite_players = array_shrink($players_full, 'player_id');
    // grab the players who's max game count has been reached
    $players_maxed = GamePlayer::get_maxed();
    // grab the players who have opted out of the invite list
    $players_opt_out = GamePlayer::get_opt_out();
    // remove the joined and maxed players from the invite list
    $players = array_diff($invite_players, array_merge($players_joined, $players_maxed, $players_opt_out));
    // create the form
    $invitation_form = '
		<form action="' . $_SERVER['REQUEST_URI'] . '" method="post"><div class="formdiv">
			<p>Invite other players to this game:</p>
			<input type="hidden" name="token" value="' . $_SESSION['token'] . '" />
			<input type="hidden" name="game_id" value="' . $_GET['id'] . '" />
			<div><label for="player_ids">Players</label><select name="player_ids[]" id="player_ids" multiple="multiple" size="5">';
    foreach ($players_full as $player) {
        if (in_array($player['player_id'], $players)) {
            $invitation_form .= '
				<option value="' . $player['player_id'] . '">' . $player['username'] . '</option>';
        }
    }