-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserv.profil.php
120 lines (107 loc) · 3.85 KB
/
serv.profil.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**** INFOS UTILISATEUR ****/
extract($_SESSION['utilisateur']);
// Gestion des cas spécifiques
if ($civilite == 'm') {
$civilite = "homme";
}
else {
$civilite = 'femme';
}
if ($statut == 1) {
$statut = '<p><strong>Administrateur</strong></p>';
}
$date_enregistrement = date('d-m-Y', strtotime($date_enregistrement));
/**** COMMANDES UTILISATEUR EN COURS ****/
$requete = $pdo->query("SELECT c.date_enregistrement AS 'Date de réservation', s.titre_salle AS salle, p.date_arrivee AS arrivée, p.date_depart AS départ, p.id_produit, p.prix FROM commande c
JOIN produit p ON p.id_produit=c.id_produit
JOIN membre m ON c.id_membre=m.id_membre
JOIN salle s ON s.id_salle=p.id_salle
WHERE m.id_membre='$id_membre' AND p.date_depart > NOW() ORDER BY c.id_commande DESC");
////// THEAD //////
$nb_col = $requete->columnCount();
$content_thead = "";
// Voir a virer le rowCount qui ne marche pas partour avec PDO query
if($requete->rowCount() > 0)
{
for ($i = 0; $i < $nb_col; $i++) {
$col_table = $requete->getColumnMeta($i);
if($col_table["name"] != "id_produit")
{
$content_thead .= "<th>".mb_ucfirst($col_table["name"])."</th>";
}
}
$content_thead .= "<th> Actions </th>";
}
////// TBODY //////
$total_commandes = 0;
$tr_commandes_user = "";
$td_commandes_user = "";
$liste_commandes_user = $requete->fetchall(PDO::FETCH_ASSOC);
foreach ($liste_commandes_user as $commande)
{
$td_commandes_user= "";
foreach ($commande as $key => $value)
{
if($key != 'id_produit')
{
if($key == 'Date de réservation' || $key == 'arrivée' || $key == 'départ')
{
$td_commandes_user .= "<td> Le ".substr(date('d F Y H:i', strtotime($value)), 0, 16)."<br> à ".substr(date('m-d-Y H:i', strtotime($value)), 11)."</td>";
}
elseif($key == "prix")
{
$td_commandes_user .= "<td>".$value." € </td>";
}
else
{
$td_commandes_user .= "<td>".$value."</td>";
}
}
if($key == 'prix')
{
$total_commandes += $value;
}
}
$td_commandes_user .= "<td><a title='Voir le produit' href='".URL."fiche_produit.php?action=voir&id=".$commande['id_produit']."' class='btn btn-default btn-ok'><span class='glyphicon glyphicon-search'></span></a></td>";
$tr_commandes_user .= "<tr>".$td_commandes_user."</tr>";
}
/**** COMMANDES UTILISATEUR EN PASSEES ****/
$requete = $pdo->query("SELECT c.date_enregistrement AS 'Date de réservation', s.titre_salle AS salle, p.date_arrivee AS arrivée, p.date_depart AS départ, p.id_produit, p.prix FROM commande c
JOIN produit p ON p.id_produit=c.id_produit
JOIN membre m ON c.id_membre=m.id_membre
JOIN salle s ON s.id_salle=p.id_salle
WHERE m.id_membre='$id_membre' AND p.date_depart <= NOW() ORDER BY c.id_commande DESC");
////// TBODY //////
$total_commandes_p = 0;
$tr_commandes_user_p = "";
$td_commandes_user_p = "";
$liste_commandes_user_p = $requete->fetchall(PDO::FETCH_ASSOC);
foreach ($liste_commandes_user_p as $commande)
{
$td_commandes_user_p= "";
foreach ($commande as $key => $value)
{
if($key != 'id_produit')
{
if($key == 'Date de réservation' || $key == 'arrivée' || $key == 'départ')
{
$td_commandes_user_p .= "<td> Le ".substr(date('d F Y H:i', strtotime($value)), 0, 16)."<br> à ".substr(date('m-d-Y H:i', strtotime($value)), 11)."</td>";
}
elseif($key == "prix")
{
$td_commandes_user_p .= "<td>".$value." € </td>";
}
else
{
$td_commandes_user_p .= "<td>".$value."</td>";
}
}
if($key == 'prix')
{
$total_commandes_p += $value;
}
}
$td_commandes_user_p .= "<td><a title='Laisser un commentaire' href='".URL."fiche_produit.php?action=voir&id=".$commande['id_produit']."' class='btn btn-default btn-ok'><span class='glyphicon glyphicon-comment'></span></a></td>";
$tr_commandes_user_p .= "<tr>".$td_commandes_user_p."</tr>";
}