<?php if (!isset($_SESSION)) { session_start(); } require_once 'initClass.php'; require_once 'init.php'; if (isset($_SESSION['idJoueurCourant']) && $_SESSION['idJoueurCourant'] != '') { $JoueurManager = new JoueurManager($db); $Joueur = new Joueur($JoueurManager->get($_SESSION['idJoueurCourant'])); $listePersonnage = $JoueurManager->getListePersonnageFromJoueur($Joueur->getId()); $PersonnageManager = new PersonnageManager($db); $Personnages = array(); $i = 0; if (count($listePersonnage) > 0) { foreach ($listePersonnage as $key => $item) { if (!isset($_SESSION['personnageCourant'])) { if ($i == 0) { $_SESSION['personnageCourant'] = $item->id; } else { $Personnages[] = new Personnage($PersonnageManager->get($item->id)); } } else { if ($item->id != $_SESSION['personnageCourant']) { $Personnages[] = new Personnage($PersonnageManager->get($item->id)); } } $i = $i + 1; } } $Personnage = new Personnage($PersonnageManager->get($_SESSION['personnageCourant']));
<?php if (!isset($_SESSION)) { session_start(); } require_once 'initClass.php'; require_once 'init.php'; if (isset($_SESSION['idJoueurCourant']) && $_SESSION['idJoueurCourant'] != '') { // Instance manager $PersonnageTypeManager = new PersonnageTypeManager($db); $PersonnageManager = new PersonnageManager($db); $JoueurManager = new JoueurManager($db); $EvolutionManager = new EvolutionManager($db); $FormulaireUniqueId = new FormulaireUniqueId(); $Joueur = new Joueur($JoueurManager->get($_SESSION['idJoueurCourant'])); $Privilege = new Privilege($JoueurManager->getPrivilege($Joueur->getId())); if ($Privilege->hasPermission('personnageCreer')) { // Insertion du nouveau personnage. if (isset($_POST) && count($_POST) > 0) { if ($FormulaireUniqueId->validate()) { $insert = true; // Si un champ n'a pas été saisie par l'utisateur foreach ($_POST as $key => $value) { if ($value == '') { $insert = false; } } if ($insert) { // Personnagetype avec les données du POST $PersonnageType = new PersonnageType($PersonnageTypeManager->get($_POST['personnageTypeId'])); // Création du personnage avec les données POST
<?php if (!isset($_SESSION)) { session_start(); } require_once 'initClass.php'; require_once 'init.php'; if (isset($_SESSION['idJoueurCourant']) && $_SESSION['idJoueurCourant'] != '') { $JoueurManager = new JoueurManager($db); $Joueur = new Joueur($JoueurManager->get($_SESSION['idJoueurCourant'])); $RoleManager = new RoleManager($db); $Privilege = new Privilege($JoueurManager->getPrivilege($Joueur->getId())); if ($Privilege->hasPermission('roleJoueur')) { if (isset($_POST) && count($_POST) > 0) { // Le traitement de l'insert if ($_POST['action'] == "ajouter") { $insert = true; // Si un champ n'a pas été saisie par l'utisateur foreach ($_POST as $key => $value) { if ($value == '') { $insert = false; } } if ($insert) { $joueurPost = $JoueurManager->login($_POST['login']); if ($joueurPost) { // Instance du joueur saisie par le formulaire $joueurPost = new Joueur($joueurPost); // Suppresion du joueur de son groupe précédent $RoleManager->delete_joueur_role($joueurPost->getId()); // Insertion table de liaison
<?php if (!isset($_SESSION)) { session_start(); } require_once 'init.php'; print $stromae; if (isset($_SESSION['idJoueurCourant']) && $_SESSION['idJoueurCourant'] != '') { $JoueurManager = new JoueurManager($db); $Joueur = new Joueur($JoueurManager->get($_SESSION['idJoueurCourant'])); $Privilege = new Privilege($JoueurManager->getPrivilege($Joueur->getId())); $listePersonnage = $JoueurManager->getListePersonnageFromJoueur($Joueur->getId()); //var_dump($listePersonnage); $PersonnageManager = new PersonnageManager($db); $Personnages = array(); $i = 0; if (count($listePersonnage) > 0) { foreach ($listePersonnage as $key => $item) { if (!isset($_SESSION['personnageCourant'])) { if ($i == 0) { $_SESSION['personnageCourant'] = $item->id; } else { $Personnages[] = new Personnage($PersonnageManager->get($item->id)); } } else { if ($item->id != $_SESSION['personnageCourant']) { $Personnages[] = new Personnage($PersonnageManager->get($item->id)); } } $i = $i + 1; }
} $_SESSION['ajax'] = true; require_once 'jeu.php'; break; case 'chercherLogin': $login = $_REQUEST['login']; $JoueurManager = new JoueurManager($db); $joueur = $JoueurManager->chercherLogin($login); if (is_array($joueur) && count($joueur) == 1) { echo $joueur[0]['login']; die; } break; case 'changerJoueur': $joueurId = $_REQUEST['joueurId']; $JoueurManager = new JoueurManager($db); $joueur = $JoueurManager->get($joueurId); if (is_array($joueur) && count($joueur) > 0) { $_SESSION['personnageCourant'] = null; $_SESSION['idJoueurCourant'] = $joueur['id']; echo true; die; } break; case 'seDeplacer': $_SESSION['ajax'] = true; $_SESSION['tourDisponible'] = true; $PersonnageManager = new PersonnageManager($db); $Personnage = new Personnage($PersonnageManager->get($_SESSION['personnageCourant'])); $positionX = $_REQUEST['positionX']; $positionY = $_REQUEST['positionY'];