Loading module/Oscar/src/Oscar/Controller/PcruController.php +23 −11 Original line number Diff line number Diff line Loading @@ -509,7 +509,14 @@ class PcruController extends AbstractOscarController implements UseLoggerService $resultsQuery = $resultsQuery->getQuery(); if ($this->getRequest()->isGet()) { $current_page = 1; $countQuery = $this->getEntityManager() ->createQueryBuilder('c') ->select('count(c)') ->from(\Oscar\Entity\PcruApiContrats::class, 'c'); $countQuery = $this->addQueryParameters($recherche, $recherche_segments, $countQuery); $total_count = $countQuery->getQuery() ->getSingleScalarResult(); $items_per_page = 15; $par_page = trim($this->params()->fromQuery('par_page')); if ($par_page == "25") { Loading @@ -520,19 +527,24 @@ class PcruController extends AbstractOscarController implements UseLoggerService $items_per_page = 100; } $results = $resultsQuery->setFirstResult(0) $total_page = ceil($total_count / $items_per_page); $current_page = 1; $current_page_param = trim($this->params()->fromQuery('current_page')); if (ctype_digit($current_page_param) && mb_strlen($current_page_param) <= 7) { $current_page_param = (int) $current_page_param; if ($current_page_param >= 1 && $current_page_param <= $total_page) { $current_page = $current_page_param; } else if ($current_page_param > $total_page) { $current_page = $total_page; } } $results = $resultsQuery->setFirstResult(($current_page - 1) * $items_per_page) ->setMaxResults($items_per_page) ->getResult(); $countQuery = $this->getEntityManager() ->createQueryBuilder('c') ->select('count(c)') ->from(\Oscar\Entity\PcruApiContrats::class, 'c'); $countQuery = $this->addQueryParameters($recherche, $recherche_segments, $countQuery); $countQuery = $countQuery->getQuery() ->getSingleScalarResult(); return ["contrats" => $results, "totalCount" => $countQuery, "recherche" => $recherche, "par_page" => $items_per_page, "tri_ordre" => $tri_ordre, "tri_champ" => $tri_champ]; return ["contrats" => $results, "totalCount" => $total_count, "recherche" => $recherche, "par_page" => $items_per_page, "tri_ordre" => $tri_ordre, "tri_champ" => $tri_champ, "current_page" => $current_page, "total_page" => $total_page]; } if ($this->getRequest()->isPost() && $this->params()->fromPost('action') == "export_csv") { Loading module/Oscar/view/oscar/pcru/contratspcru.phtml +46 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ </form> </div> <div style="display: flex; justify-content: end;"> <div style="display: flex; justify-content: end; align-items: center;"> <span> <?php if(count($contrats) == 0): ?> <?php if($recherche == ""): ?> Loading Loading @@ -78,6 +78,51 @@ <input type="hidden" name="par_page" value="100"> <input <?= $par_page == 100 ? 'style="text-decoration-line: none;"' : '' ?> class="contrats-pcru-par-page" type="submit" value="100" <?= $par_page == 100 ? 'disabled' : '' ?>> </form> <span style="padding-left: 1rem;"> Aller à la page :</span> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="1"> <input type="submit" value="⏮" <?= $current_page == 1 ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="<?= $current_page > 1 ? $current_page - 1 : 1 ?>"> <input type="submit" value="⏴" <?= $current_page == 1 ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> <form> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <select name="current_page" id="current_page" onchange="this.form.submit()" style="background-color: white; border: 1px solid lightgrey;"> <?php for ($i = 1; $i <= $total_page; $i++): ?> <option value="<?= $i ?>" <?= $i == $current_page ? 'selected' : '' ?>><?= $i ?></option> <?php endfor; ?> </select> </form> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="<?= $current_page >= $total_page ? $total_page : $current_page + 1 ?>"> <input type="submit" value="⏵" <?= $current_page == $total_page ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="<?= $total_page ?>"> <input type="submit" value="⏭" <?= $current_page == $total_page ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> </div> <div id="contrats_table"> Loading Loading
module/Oscar/src/Oscar/Controller/PcruController.php +23 −11 Original line number Diff line number Diff line Loading @@ -509,7 +509,14 @@ class PcruController extends AbstractOscarController implements UseLoggerService $resultsQuery = $resultsQuery->getQuery(); if ($this->getRequest()->isGet()) { $current_page = 1; $countQuery = $this->getEntityManager() ->createQueryBuilder('c') ->select('count(c)') ->from(\Oscar\Entity\PcruApiContrats::class, 'c'); $countQuery = $this->addQueryParameters($recherche, $recherche_segments, $countQuery); $total_count = $countQuery->getQuery() ->getSingleScalarResult(); $items_per_page = 15; $par_page = trim($this->params()->fromQuery('par_page')); if ($par_page == "25") { Loading @@ -520,19 +527,24 @@ class PcruController extends AbstractOscarController implements UseLoggerService $items_per_page = 100; } $results = $resultsQuery->setFirstResult(0) $total_page = ceil($total_count / $items_per_page); $current_page = 1; $current_page_param = trim($this->params()->fromQuery('current_page')); if (ctype_digit($current_page_param) && mb_strlen($current_page_param) <= 7) { $current_page_param = (int) $current_page_param; if ($current_page_param >= 1 && $current_page_param <= $total_page) { $current_page = $current_page_param; } else if ($current_page_param > $total_page) { $current_page = $total_page; } } $results = $resultsQuery->setFirstResult(($current_page - 1) * $items_per_page) ->setMaxResults($items_per_page) ->getResult(); $countQuery = $this->getEntityManager() ->createQueryBuilder('c') ->select('count(c)') ->from(\Oscar\Entity\PcruApiContrats::class, 'c'); $countQuery = $this->addQueryParameters($recherche, $recherche_segments, $countQuery); $countQuery = $countQuery->getQuery() ->getSingleScalarResult(); return ["contrats" => $results, "totalCount" => $countQuery, "recherche" => $recherche, "par_page" => $items_per_page, "tri_ordre" => $tri_ordre, "tri_champ" => $tri_champ]; return ["contrats" => $results, "totalCount" => $total_count, "recherche" => $recherche, "par_page" => $items_per_page, "tri_ordre" => $tri_ordre, "tri_champ" => $tri_champ, "current_page" => $current_page, "total_page" => $total_page]; } if ($this->getRequest()->isPost() && $this->params()->fromPost('action') == "export_csv") { Loading
module/Oscar/view/oscar/pcru/contratspcru.phtml +46 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ </form> </div> <div style="display: flex; justify-content: end;"> <div style="display: flex; justify-content: end; align-items: center;"> <span> <?php if(count($contrats) == 0): ?> <?php if($recherche == ""): ?> Loading Loading @@ -78,6 +78,51 @@ <input type="hidden" name="par_page" value="100"> <input <?= $par_page == 100 ? 'style="text-decoration-line: none;"' : '' ?> class="contrats-pcru-par-page" type="submit" value="100" <?= $par_page == 100 ? 'disabled' : '' ?>> </form> <span style="padding-left: 1rem;"> Aller à la page :</span> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="1"> <input type="submit" value="⏮" <?= $current_page == 1 ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="<?= $current_page > 1 ? $current_page - 1 : 1 ?>"> <input type="submit" value="⏴" <?= $current_page == 1 ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> <form> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <select name="current_page" id="current_page" onchange="this.form.submit()" style="background-color: white; border: 1px solid lightgrey;"> <?php for ($i = 1; $i <= $total_page; $i++): ?> <option value="<?= $i ?>" <?= $i == $current_page ? 'selected' : '' ?>><?= $i ?></option> <?php endfor; ?> </select> </form> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="<?= $current_page >= $total_page ? $total_page : $current_page + 1 ?>"> <input type="submit" value="⏵" <?= $current_page == $total_page ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> <form style="display: inline;"> <input type="hidden" name="recherche" value="<?= $recherche ?>"> <input type="hidden" name="par_page" value="<?= $par_page ?>"> <input type="hidden" name="tri_ordre" value="<?= $tri_ordre ?>"> <input type="hidden" name="tri_champ" value="<?= $tri_champ ?>"> <input type="hidden" name="current_page" value="<?= $total_page ?>"> <input type="submit" value="⏭" <?= $current_page == $total_page ? 'style="text-decoration-line: none;" disabled' : '' ?> class="contrats-pcru-par-page"> </form> </div> <div id="contrats_table"> Loading