Merge branch 'main' of https://gitea.lyc-lecastel.fr/pierre.renaudot/AP44
This commit is contained in:
commit
2438e20db2
@ -3,6 +3,9 @@
|
|||||||
class Class_gestionFiche
|
class Class_gestionFiche
|
||||||
{
|
{
|
||||||
private $pdo = null;
|
private $pdo = null;
|
||||||
|
public static $NB_LIGNES_PAGINATION = 12;
|
||||||
|
public static $NB_LIGNES_FICHEAVALIDER = 15;
|
||||||
|
|
||||||
|
|
||||||
public function __construct(PdoGsb $pDO)
|
public function __construct(PdoGsb $pDO)
|
||||||
{
|
{
|
||||||
@ -13,43 +16,72 @@ class Class_gestionFiche
|
|||||||
{
|
{
|
||||||
$req = 'SELECT "uId", "uNom", "uPrenom" FROM utilisateur WHERE "uStatut"!=0 ORDER BY "uNom" ASC;';
|
$req = 'SELECT "uId", "uNom", "uPrenom" FROM utilisateur WHERE "uStatut"!=0 ORDER BY "uNom" ASC;';
|
||||||
$result = $this->pdo->prepare($req);
|
$result = $this->pdo->prepare($req);
|
||||||
$result ->execute();
|
$result->execute();
|
||||||
|
|
||||||
return $result->fetchAll();
|
return $result->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_ListesFiches(string $idUtilisateur): array
|
public function dateComplete(string $date): string
|
||||||
{
|
|
||||||
$req = 'SELECT "rMois", "rEtat", "rNbJustificatifs", ROUND("rMontantValide", 2) as "rMontantValide", "eLibelle"
|
|
||||||
FROM remboursement
|
|
||||||
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
|
||||||
WHERE "rVisiteur"= :userId
|
|
||||||
ORDER BY "rMois" DESC';
|
|
||||||
|
|
||||||
$result = $this->pdo->prepare($req);
|
|
||||||
$result ->bindParam("userId", $idUtilisateur);
|
|
||||||
$result ->execute();
|
|
||||||
|
|
||||||
return $result->fetchAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function dateComplete(string $date) : string
|
|
||||||
{
|
{
|
||||||
return substr($date, 0, 4) . '-' . substr($date, 4);
|
return substr($date, 0, 4) . '-' . substr($date, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_ficheAvalider() : array
|
public function get_ficheAvalider(int $nPage): array
|
||||||
{
|
{
|
||||||
$req = 'SELECT "rMois", "rVisiteur", "rEtat", ROUND("rMontantValide", 2) as "rMontantValide", "eLibelle", "uNom", "uPrenom"
|
$decalage = ($nPage - 1) * $this::$NB_LIGNES_FICHEAVALIDER;
|
||||||
|
$req = 'SELECT "rMois", "rVisiteur", "rEtat", ROUND("rMontantValide", 2)
|
||||||
|
as "rMontantValide", "eLibelle", "uNom", "uPrenom"
|
||||||
from remboursement
|
from remboursement
|
||||||
INNER JOIN utilisateur ON utilisateur."uId"=remboursement."rVisiteur"
|
INNER JOIN utilisateur ON utilisateur."uId"=remboursement."rVisiteur"
|
||||||
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
||||||
where "rEtat"=\'CL\'
|
where "rEtat"=\'CL\'
|
||||||
ORDER BY "rMois" ASC';
|
ORDER BY "rMois" ASC
|
||||||
|
LIMIT :nbLignes offset :decalage;';
|
||||||
$result = $this->pdo->prepare($req);
|
$result = $this->pdo->prepare($req);
|
||||||
$result ->execute();
|
$result->bindParam('nbLignes', $this::$NB_LIGNES_FICHEAVALIDER);
|
||||||
|
$result->bindParam('decalage', $decalage);
|
||||||
|
$result->execute();
|
||||||
|
|
||||||
return $result->fetchAll();
|
return $result->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public function get_nbFicheAvalider(): int
|
||||||
|
{
|
||||||
|
$req = 'SELECT COUNT(*) as "nbFicheAvalider" from remboursement
|
||||||
|
where "rEtat"=\'CL\'';
|
||||||
|
$result = $this->pdo->prepare($req);
|
||||||
|
$result->execute();
|
||||||
|
$result = $result->fetch();
|
||||||
|
|
||||||
|
return (int) $result['nbFicheAvalider'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_nbRemboursement(string $idUtilisateur): int
|
||||||
|
{
|
||||||
|
$req = 'SELECT COUNT(*) as "nbRemboursement" from remboursement WHERE "rVisiteur"= :userId;';
|
||||||
|
$result = $this->pdo->prepare($req);
|
||||||
|
$result->bindParam("userId", $idUtilisateur);
|
||||||
|
$result->execute();
|
||||||
|
$result = $result->fetch();
|
||||||
|
|
||||||
|
return (int) $result['nbRemboursement'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_Page(int $nPage, string $idUtilisateur): array
|
||||||
|
{
|
||||||
|
$decalage = ($nPage - 1) * $this::$NB_LIGNES_PAGINATION;
|
||||||
|
$req = 'SELECT "rMois", "rVisiteur", "rEtat", ROUND("rMontantValide", 2)
|
||||||
|
as "rMontantValide", "eLibelle"
|
||||||
|
FROM remboursement
|
||||||
|
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
||||||
|
WHERE "rVisiteur"= :userId
|
||||||
|
ORDER BY "rDateModif" DESC LIMIT :nbLignes offset :decalage;';
|
||||||
|
$result = $this->pdo->prepare($req);
|
||||||
|
$result->bindParam('nbLignes', $this::$NB_LIGNES_PAGINATION);
|
||||||
|
$result->bindParam('decalage', $decalage);
|
||||||
|
$result->bindParam('userId', $idUtilisateur);
|
||||||
|
$result->execute();
|
||||||
|
|
||||||
|
return $result->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ if ($_SESSION["typeU"] == "comptable") {
|
|||||||
$userId = $_SESSION['uId'];
|
$userId = $_SESSION['uId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$lesFiches = $gestionFiche->get_ficheAvalider();
|
|
||||||
|
|
||||||
|
|
||||||
include("vues/v_fichesAvalider.php");
|
include("vues/v_fichesAvalider.php");
|
||||||
|
@ -18,6 +18,7 @@ if ($typeU == "comptable") {
|
|||||||
$userId = $_SESSION['uId'];
|
$userId = $_SESSION['uId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$lesFiches = $gestionFiche->get_ListesFiches($userId);
|
|
||||||
|
|
||||||
|
|
||||||
include("vues/v_gestionFiches.php");
|
include("vues/v_gestionFiches.php");
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
<div class="text-center">
|
||||||
|
<br>
|
||||||
|
<h3>Fiches à valider</h3>
|
||||||
|
</div>
|
||||||
<div class="col-11 d-flex mx-auto">
|
<div class="col-11 d-flex mx-auto">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
@ -32,4 +36,35 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ($pages > 0) { ?>
|
||||||
|
<div class="col-4 d-flex mx-auto">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<!-- Lien vers la page précédente (désactivé si on se trouve sur la 1ère page) -->
|
||||||
|
<li class="page-item <?= ($currentPage == 1) ? "disabled" : "" ?>">
|
||||||
|
<a href="index.php?direction=ficheAvalider&page=<?= $currentPage - 1 ?>"
|
||||||
|
class="page-link">Précédente</a>
|
||||||
|
</li>
|
||||||
|
<?php for ($page = 1; $page <= $pages; $page++): ?>
|
||||||
|
<!-- Lien vers chacune des pages (activé si on se trouve sur la page correspondante) -->
|
||||||
|
<li class="page-item <?= ($currentPage == $page) ? "active" : "" ?>">
|
||||||
|
<a href="index.php?direction=ficheAvalider&page=<?= $page ?>"
|
||||||
|
class="page-link">
|
||||||
|
<?= $page ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endfor ?>
|
||||||
|
<!-- Lien vers la page suivante (désactivé si on se trouve sur la dernière page) -->
|
||||||
|
<li class="page-item <?= ($currentPage == $pages) ? "disabled" : "" ?>">
|
||||||
|
<a href="index.php?direction=ficheAvalider&page=<?= $currentPage + 1 ?>"
|
||||||
|
class="page-link">Suivante</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
};
|
||||||
|
?>
|
@ -12,9 +12,9 @@
|
|||||||
echo '<select class="form-select" name="selVisiteur" id="">';
|
echo '<select class="form-select" name="selVisiteur" id="">';
|
||||||
foreach ($LesUtilisateurs as $key => $value) {
|
foreach ($LesUtilisateurs as $key => $value) {
|
||||||
$id = $value['uId'];
|
$id = $value['uId'];
|
||||||
$prenom = $value['uPrenom'];
|
$prenom = $value['uPrenom'];
|
||||||
$nom = $value['uNom'];
|
$nom = $value['uNom'];
|
||||||
|
|
||||||
if ($id == $userId) {
|
if ($id == $userId) {
|
||||||
echo '<option value="' . $id . '" selected>' . $nom . " " . $prenom . "</option>";
|
echo '<option value="' . $id . '" selected>' . $nom . " " . $prenom . "</option>";
|
||||||
} else {
|
} else {
|
||||||
@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '</select>'; ?>
|
echo '</select>'; ?>
|
||||||
<button type="submit" class="btn btn-dark m-2" >Selectionner</button>
|
<button type="submit" class="btn btn-dark m-2">Selectionner</button>
|
||||||
<!-- Fin du formulaire -->
|
<!-- Fin du formulaire -->
|
||||||
<?php }
|
<?php }
|
||||||
?>
|
?>
|
||||||
@ -63,22 +63,35 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
PAGINATION:// NE PAS TOUCHER
|
PAGINATION:
|
||||||
-->
|
-->
|
||||||
<div class="col-4 d-flex mx-auto">
|
|
||||||
<nav aria-label="...">
|
<?php if ($pages > 0) { ?>
|
||||||
<ul class="pagination">
|
<div class="col-4 d-flex mx-auto">
|
||||||
<li class="page-item disabled">
|
<nav>
|
||||||
<a class="page-link">Previous</a>
|
<ul class="pagination">
|
||||||
</li>
|
<!-- Lien vers la page précédente (désactivé si on se trouve sur la 1ère page) -->
|
||||||
<li class="page-item"><a class="page-link" href="#">1</a></li>
|
<li class="page-item <?= ($currentPage == 1) ? "disabled" : "" ?>">
|
||||||
<li class="page-item active" aria-current="page">
|
<a href="index.php?direction=gestionFiche&page=<?= $currentPage - 1 ?>&selVisiteur=<?= $userId ?>"
|
||||||
<a class="page-link" href="#">2</a>
|
class="page-link">Précédente</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
<?php for ($page = 1; $page <= $pages; $page++): ?>
|
||||||
<li class="page-item">
|
<!-- Lien vers chacune des pages (activé si on se trouve sur la page correspondante) -->
|
||||||
<a class="page-link" href="#">Next</a>
|
<li class="page-item <?= ($currentPage == $page) ? "active" : "" ?>">
|
||||||
</li>
|
<a href="index.php?direction=gestionFiche&page=<?= $page ?>&selVisiteur=<?= $userId ?>"
|
||||||
</ul>
|
class="page-link">
|
||||||
</nav>
|
<?= $page ?>
|
||||||
</div>
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endfor ?>
|
||||||
|
<!-- Lien vers la page suivante (désactivé si on se trouve sur la dernière page) -->
|
||||||
|
<li class="page-item <?= ($currentPage == $pages) ? "disabled" : "" ?>">
|
||||||
|
<a href="index.php?direction=gestionFiche&page=<?= $currentPage + 1 ?>&selVisiteur=<?= $userId ?>"
|
||||||
|
class="page-link">Suivante</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
};
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user