Game::saveGame($l4d); $bf3Tour = new Tournament($bf3); $bf3Tour->addSchedule('Matin', new Schedule(1353567600, 1353582000)); //22.11.2012 8h00 - 12h00 $bf3Tour->setName('Tournois Battlefield 3'); $bf3Tour->setDescription('Ruée en escouade 4vs4 sur carte aléatoires- Equipes de 4 personnes - Compte BF3 et DLC Close Quarters requis'); $l4dTour = new Tournament($l4d); $l4dTour->addSchedule('Après-Midi', new Schedule(1353589200, 1353603600)); //22.11.2012 14h00 - 18h00 $l4dTour->setName('Tournois Left for Dead'); $l4dTour->setDescription('Survie 4vs4 en 5 manches sur carte aléatoire - Equipes de 4 personnes - Jeu fourni sur place'); Tournament::saveTournament($bf3Tour); Tournament::saveTournament($l4dTour); //Test des elements utilisés dans le frontend $gamesList = Game::getGames(); $countGames = Game::countGames(); $tourList = Tournament::getTournaments(); $countTour = Tournament::countTournaments(); //Autres test du moteur, non implanté dans le frontend $me = new User(); $me->setName('Karl'); $me->setSurname('Woditsch'); $me->setMail('*****@*****.**'); $me->setLogin(uniqid()); $me->setPassword('1234'); User::saveUser($me); $userList = User::getUsers(); $countUsers = User::countUsers(); $team = new Team(); $team->setName('Les winneurs'); $team->setDescription('Equipe de test');
public static function getGames() { $games = array(); $req = DataBase::getInstance()->prepare('SELECT id, name, description, cover FROM game'); $req->execute(); while ($datas = $req->fetch()) { $game = new Game(); $game->hydrate($datas); $games[] = $game; } $req->closeCursor(); return $games; }
<h2>Jeux</h2> <section class="games"> <?php use lib\content\Image; use lib\lan\Game; $games = Game::getGames(); foreach ($games as $game) { ?> <article> <img src="<?php echo Image::thumb('250', '360', 'uploads/', $game->getCover(), 'fill'); ?> " alt="" /> <div class="name"><?php echo $game->getName(); ?> </div> <p class="description"><?php echo $game->getDescription(); ?> </p> </article> <?php } ?> </section>
public static function getTournamentsFromTeam($id) { $tournaments = array(); $req = DataBase::getInstance()->prepare('SELECT id, name, description, game FROM tournament LEFT JOIN team_inscription ON tournament = id WHERE team = :id'); $req->bindvalue('id', $id, PDO::PARAM_INT); $req->execute(); while ($datas = $req->fetch()) { $toutnament = new Tournament(Game::getGame($datas['game'])); $toutnament->hydrate($datas); $toutnament->loadSchedules(); $tournaments[] = $toutnament; } $req->closeCursor(); return $tournaments; }