function getSubpageTitle($p, $subp, $subp2) { $games = getGameList($subp); if ($p == "games") { if ($subp == -1) { return "Создание игры"; } $game = $games[0]; return $game['name']; } if ($p == "news") { if ($subp == -1) { return "Новая новость"; } $news = getNewsData($subp); return $news['header']; } if ($p == "checkers") { $game = $games[0]; if ($subp == -1) { return "Новый чекер для '" . $game['name'] . "'"; } if ($subp == 0) { return "Чекеры для '" . $game['name'] . "'"; } $checkers = getCheckerList($subp); $checker = $checkers[0]; return $checker['name'] . " для '" . $game['name'] . "'"; } return ""; }
<?php $gameList = getGameList(); ?> <table class="table"> <thead> <tr> <td>ID</td> <td>Название</td> <td></td> </tr> </thead> <tbody> <?php foreach ($gameList as $game) { echo "<tr>"; echo "<td>" . $game['id'] . "</td>"; echo "<td>" . $game['name'] . "</td>"; echo "<td>"; echo '<div class="btn-group">'; echo '<a href="?page=checkers&subpage2=' . $game['id'] . '" role="button" class="btn btn-default">Чекеры</a>'; echo '<button class="btn btn-default">Файлы</button>'; echo '<a href="?page=game&id=' . $game['id'] . '" role="button" class="btn btn-default">Редактировать</a>'; echo '<button class="btn btn-danger" onclick="deleteGame(' . $game['id'] . ')">Удалить</button>'; echo "</div></td>"; echo "</tr>"; } ?> </tbody> </table>
<?php $id = intval($_GET["id"]) or -1; if ($id == -1) { $name = ""; $description = ""; $hasVisualizer = false; $timeLimit = 1000; $memoryLimit = 64000; } else { $games = getGameList($id); $game = $games[0]; $name = $game['name']; $description = $game['description']; $hasVisualizer = $game['hasVisualizer']; $timeLimit = $game['timeLimit']; $memoryLimit = $game['memoryLimit']; } ?> <script> function deleteGame(id) { id = id || <?php echo $id; ?> ; $.post ( "jqueryGame.php", {
<?php include_once 'procedures.php'; $_SESSION['adminPanelState'] = 'APgame.php'; if (isAdmin()) { $gameId = -1; if (isset($_GET['game'])) { $gameId = intval($_GET['game']); } $_SESSION['adminGameId'] = $gameId; $gameList = getGameList(); $currentGame = getGameList($gameId); $vizualize = @getVisualizerByGame($gameId); ?> <script> changeActiveAdminButton('gameButton'); </script> <script> function loadGameData(gameId) { $('#dataContainer').load('APgame.php?game=' + gameId); } function loadFormData() { var gameSelector = document.getElementById('gameSelector'); var gameSelectorValue = gameSelector.options[gameSelector.selectedIndex].value; var gameName = document.getElementById('gameName').value;