Beispiel #1
0
function GetGamesList()
{
    if (!gotConnection()) {
        return;
    }
    $games = '';
    $list = references();
    $players = '';
    foreach ($list as $reference) {
        if ($reference['valid']) {
            $games .= '<tr>';
            $games .= '<td>' . htmlspecialchars(ParseINI::parseValue('Title', $reference['data'])) . '</td>';
            $games .= '<td>' . htmlspecialchars(ParseINI::parseValue('State', $reference['data'])) . '</td>';
            $games .= '<td>' . date("Y-m-d H:i", $reference['start']) . '</td>';
            $players = '';
            $player_list = ParseINI::parseValuesByCategory('Name', 'Player', $reference['data']);
            foreach ($player_list as $player) {
                if (!empty($players)) {
                    $players .= ', ';
                }
                $players .= $player;
            }
            $games .= '<td>' . htmlspecialchars($players) . '</td>';
        }
    }
    $games = C4Network::cleanString($games);
    $result = "";
    if (!empty($games)) {
        $result .= '<table>';
        $result .= '<tr><th>Round</th><th>State</th><th>Begin</th><th>Players</th></tr>';
        $result .= $games;
        $result .= '</table>';
    } else {
        $result .= '<p style="color: gray;">No games are currently running.</p>';
    }
    return $result;
}