Exemplo n.º 1
0
<?php

$id = intval($_GET["id"]);
$tournamentId = intval($_GET["tournament"]);
if ($id == -1) {
    $tournament = getTournamentList($tournamentId);
    $checkers = getCheckerListByGameId($tournament['game']);
    $rounds = getRoundList($tournamentId);
    ?>
<script>
        function submitForm()
        {
            var checkers = document.getElementById('checker');
            var checker = checkers.options[checkers.selectedIndex].value;
            var roundName = document.getElementById('name').value;
            //var previousRound = document.getElementById('previousRoundSelector').value;
            //var strategyData = getAcceptedUsersStrategy();
            var strategyData = [];
            var accepted = document.getElementById('acceptedUsers').options;
            for (var i = 0; i < accepted.length; ++i) 
            {
                strategyData.push(accepted[i].value);
            }
            var seed = document.getElementById('seed').value;

            if (roundName == '')
            {
                showModalAlert('Название раунда не может быть пустым.')
                return;
            }
            if (checker == -1)
Exemplo n.º 2
0
<?php

include_once 'procedures.php';
$_SESSION['adminPanelState'] = 'APtournament.php';
if (isAdmin()) {
    $tournamentId = -1;
    $gameId = -1;
    if (isset($_GET['tournament'])) {
        $tournamentId = intval($_GET['tournament']);
    }
    $_SESSION['adminTournamentId'] = $tournamentId;
    $tournamentList = getTournamentList();
    $currentTournament = getTournamentList($tournamentId);
    $gameList = getGameList();
    if ($tournamentId != -1) {
        $checkerList = getCheckerListByGameId($currentTournament['game']);
    }
    ?>

    <script>
        changeActiveAdminButton('tournamentButton');
    </script>

    <script>
        function loadTournamentData(tournamentId)
        {
            $('#dataContainer').load('APtournament.php?tournament=' + tournamentId);
        }
        
        function setSelectedIndexInSelector(selector, selectedData)
        {
Exemplo n.º 3
0
function createGameZip($gameId, $filename)
{
    $gameId = intval($gameId);
    $z = new ZipArchive();
    $z->open($filename, ZIPARCHIVE::CREATE);
    $checkers = getCheckerListByGameId($gameId);
    $game = getFromDB("games", "id={$gameId}");
    $meta = "NAME=" . getGameName($gameId) . "\nDESCRIPTION=" . getGameDescription($gameId) . "\nTL=" . $game[0]["timeLimit"] . "\nML=" . $game[0]["memoryLimit"];
    $i = 0;
    foreach ($checkers as $a) {
        $z->addFile(getcwd() . "./testers/" . $a["id"], ++$i . ".checker");
        $z->addFromString($i . ".checkermeta", "LANG=cpp\nname=" . $a["name"] . "\nSEED=" . $a["hasSeed"]);
    }
    $attachments = getAttachments($gameId);
    $i = 0;
    foreach ($attachments as $b) {
        $z->addFile("./attachments/" . $b["id"], ++$i . ".attachment");
        $z->addFromString($i . ".attachmentmeta", "NAME=" . $b["originalName"] . "\nDESCRIPTION=" . $b["description"]);
    }
    $z->addFromString("META", $meta);
    $z->close();
}
Exemplo n.º 4
0
<?php

include_once 'procedures.php';
$gameId = intval($_POST['gameId']);
echo json_encode(getCheckerListByGameId($gameId));