-
Notifications
You must be signed in to change notification settings - Fork 0
/
concoursMissions.php
executable file
·110 lines (94 loc) · 6.1 KB
/
concoursMissions.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
<?php
include('./requiert/new-form/header.php');
$meta_title = 'Quizzdeal.fr : Concours Missions';
$meta_description = '';
$sqlConcours = $pdo->query("SELECT * FROM concours WHERE id = 1");
$resultatConcours = $sqlConcours->fetch(PDO::FETCH_ASSOC);
$descriptionConcours = addslashes(htmlentities($resultatConcours['description']));
$dateDebutConcours = addslashes(htmlentities($resultatConcours['dateDebut']));
$dateFinConcours = addslashes(htmlentities($resultatConcours['dateFin']));
$gagnant1 = addslashes(htmlentities($resultatConcours['gagnant1']));
$gagnant2 = addslashes(htmlentities($resultatConcours['gagnant2']));
$gagnant3 = addslashes(htmlentities($resultatConcours['gagnant3']));
$gagnant4 = addslashes(htmlentities($resultatConcours['gagnant4']));
$gagnant5 = addslashes(htmlentities($resultatConcours['gagnant5']));
?>
<style type="text/css">
.pending-booking{
border: 1px solid rgb(234, 231, 231);
border-radius: 33px;
}
</style>
<div class="container" style="margin-top: 25px;">
<div class="row">
<div class="col-md-12">
<h1 class="title-page">Les concours missions</h1>
<p class="description-concours"><?= $descriptionConcours; ?></p>
<?php //Bloc req SQL pour la prochaine boucle
$messagesParPage = 50;
$retour_total = $pdo->query("SELECT COUNT(*) AS total FROM histo_offers WHERE dateUsTime >= '".$dateDebutConcours."' AND dateUsTime <= '".$dateFinConcours."' AND offerwall != 'Mission' AND etat LIKE 'Valid%%' GROUP BY idUser");
$donnees_total = $retour_total->fetch();
$total = $donnees_total['total'];
$nombreDePages = ceil($total / $messagesParPage);
if (isset($_GET['page'])) { $pageActuelle = intval($_GET['page']); if ($pageActuelle > $nombreDePages) { $pageActuelle = $nombreDePages; } } else { $pageActuelle = 1; }
$premiereEntree = ($pageActuelle - 1) * $messagesParPage;
$debits = $pdo->query("SELECT COUNT(id) as 'countId', idUser, SUM(remuneration) as 'amountTotal' FROM histo_offers WHERE dateUsTime >= '".$dateDebutConcours."' AND dateUsTime <= '".$dateFinConcours."' AND offerwall != 'Mission' AND etat != 'En cours' AND etat != 'Refusé' GROUP BY idUser ORDER BY amountTotal DESC LIMIT ".$premiereEntree.", ".$messagesParPage."");
$all_debits = $debits->fetchAll(PDO::FETCH_ASSOC);
$i = 1;
?>
<?php foreach ($all_debits as $dones_debits)://Boucle débit?>
<?php
$amountTotal = $dones_debits['amountTotal'];
$concoursIdUser = $dones_debits['idUser'];
$sql_userWin = $pdo->query("SELECT nom, prenom FROM users WHERE hashId = '".$concoursIdUser."' ");
$resultat_userWin = $sql_userWin->fetch(PDO::FETCH_ASSOC);
$winNom = $resultat_userWin['nom'];
$winPrenom = $resultat_userWin['prenom'];
if ($i == 1) { $gainPosition = displayMontant($gagnant1, 2, ' €'); }
else if ($i == 2) { $gainPosition = displayMontant($gagnant2, 2, ' €'); }
else if ($i == 3) { $gainPosition = displayMontant($gagnant3, 2, ' €'); }
else if ($i == 4) { $gainPosition = displayMontant($gagnant4, 2, ' €'); }
else if ($i == 5) { $gainPosition = displayMontant($gagnant5, 2, ' €'); }
else { $gainPosition = '-'; }
?>
<!-- TRANSACTION LIST ITEM -->
<div class="col-sm-6 pending-booking">
<div class="list-box-listing bookings">
<div class="list-box-listing-img"><img src="http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=120" alt=""></div>
<div class="list-box-listing-content">
<div class="inner">
<h3><?= $winPrenom; ?> <?= substr($winNom , 0, 2); ?>.</h3>
<div class="inner-booking-list">
<h5>Montant:</h5>
<ul class="booking-list">
<li class="highlighted"><?= displayMontant($amountTotal, 2, ''); ?> €</li>
</ul>
</div>
<div class="inner-booking-list">
<h5>Gain:</h5>
<ul class="booking-list">
<li class="highlighted
<?php
if($gainPosition != '0,00 €' && $gainPosition != '-')
echo 'gain';
?>"><?= $gainPosition; ?></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php $i++; endforeach; //Fin boucle débit?>
<div class="table group-nav">
<!-- PAGINATION-->
<?php if ($pageActuelle != 1) { $page_p = ($pageActuelle - 1); ?><a class="navigation-table" href="<?= url_site; ?>/concoursMissions.html?page=<?php echo $page_p; ?>"><i class="fa fa-angle-left"></i></a><?php } else { ?><i class="fa fa-angle-left"></i><?php } ?>
<?php if (($pageActuelle == 1 AND $nombreDePages > $pageActuelle) OR $nombreDePages > $pageActuelle) { $page_s = ($pageActuelle + 1); ?><a class="navigation-table" href="<?= url_site; ?>/concoursMissions.html?page=<?php echo $page_s; ?>"><i class="fa fa-angle-right"></i></a><?php } else { ?><i class="fa fa-angle-right"></i><?php } ?>
<!-- /PAGINATION-->
</div>
</div>
<!-- /TRANSACTION LIST -->
</div>
</div>
<?php
include('./requiert/new-form/footer.php');
?>