public static function sortArray($array) { $games = gameService::getAllGames(); foreach ($games as $game) { if ($game->id == $array[0]->gameid) { $grootte = $game->grootte; } } $arrNew = array(); for ($i = 1; $i <= $grootte; $i++) { for ($j = 1; $j <= $grootte; $j++) { $org = organismeservice::checkPositionInArray($j, $i, $array); if ($org != null) { array_push($arrNew, $org); } } } return $arrNew; }
<?php $games = gameService::getAllGames(); $soorten = soortService::getAllSoorten(); foreach ($games as $game) { if ($game->id == $_GET["game"]) { $grootte = $game->grootte; } } print "<div class='matrix grootte" . $grootte . " clearFix'>"; for ($rij = 1; $rij <= $grootte; $rij++) { for ($kol = 1; $kol <= $grootte; $kol++) { $positie = organismeservice::checkPosition($kol, $rij, $_GET["game"]); if (isset($positie)) { $posSoort = $positie->soort; foreach ($soorten as $soort) { if ($soort->id == $posSoort) { $imgtitle = $soort->soort; $imgsrc = $soort->image; } } if ($posSoort == "1") { $kracht = ""; } else { $kracht = "Kracht:" . $positie->kracht; } print "<div class='cell'><div class='innercell'><img src='" . $imgsrc . "' alt='" . $imgtitle . "'><span class='tooltip'>" . $imgtitle . " " . $kracht . "</span></div></div>"; } else { print "<div class='cell'><div class='innercell'></div></div>"; } }
require_once "business/soortservice.php"; require_once "business/rasterservice.php"; require_once "business/playservice.php"; session_start(); // DELETE GAME if (isset($_GET['deletegame'])) { $game = GameDAO::deleteGame($_GET['deletegame']); } // CHECK FOR POST if (isset($_POST["grootte"])) { gameService::initNewGame($_POST["grootte"]); header('Location:index.php'); die; } // MAAK GAMELIJST AAN $gamelijst = gameService::getAllGames(); if (!isset($_GET['page']) && !isset($_GET['game'])) { include 'presentation/homepage.php'; } if (isset($_GET['nextstep']) && isset($_GET['game'])) { if (isset($_SESSION['nextStep'])) { $game = GameDAO::getGameFromId($_GET['game']); playservice::play($game, $_SESSION['nextStep']); } } if (isset($_GET['game'])) { $game = GameDAO::getGameFromId($_GET['game']); if (isset($game)) { $arrGameOrganismen = organismeservice::getAllOrganismen($_GET['game']); include 'presentation/game.php'; }