/
amelioration.php
63 lines (49 loc) · 1.57 KB
/
amelioration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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']));
$smarty->assign('personnage', $Personnage);
$smarty->assign('personnages', $Personnages);
$smarty->display('page/pageAmelioration.tpl');
}
else
{
header('Location: index.php');
}
?>