diff --git a/module/Formation/src/Formation/Controller/ExportController.php b/module/Formation/src/Formation/Controller/ExportController.php index a3b8d720f5f35928813ca33940b95b9944b3aa1e..1cc7a89b7b476d0e5f204b88b562aa50678df8b4 100644 --- a/module/Formation/src/Formation/Controller/ExportController.php +++ b/module/Formation/src/Formation/Controller/ExportController.php @@ -38,8 +38,11 @@ class ExportController extends AbstractActionController { $sessionEtats = $this->getEtatTypeService()->getEtatsTypesByCategorie($sessionCategorie); $params = $this->params()->fromQuery(); - $params['historise'] = '0'; - $inscriptions = $this->getInscriptionService()->getInscriptionsWithFiltre($params); + + if ($csv OR !empty($params)) { + $params['historise'] = '0'; + $inscriptions = $this->getInscriptionService()->getInscriptionsWithFiltre($params); + } else { $inscriptions = null; } if ($csv) { $headers = ["stagiaire", "affectation", "action de formation", "domaines", "période", "Au plan de formation"]; @@ -78,6 +81,7 @@ class ExportController extends AbstractActionController { 'params' => $params, 'inscriptionEtats' => $inscriptionEtats, 'sessionEtats' => $sessionEtats, + 'display' => !empty($params), 'inscriptions' => $inscriptions, ]); diff --git a/module/Formation/view/formation/export/extraction-inscription.phtml b/module/Formation/view/formation/export/extraction-inscription.phtml index 6f13c8ad9279cd2e2f71d4896e7490cd6b55576e..8bf9cbce89daae3757d3928884329b657931fccf 100644 --- a/module/Formation/view/formation/export/extraction-inscription.phtml +++ b/module/Formation/view/formation/export/extraction-inscription.phtml @@ -6,6 +6,7 @@ * @var EtatType[] $sessionEtats * @var Inscription[] $inscriptions * @var array $params + * @var bool $display * **/ @@ -113,70 +114,78 @@ $this->headTitle("Extraction d'inscription"); </div> </div> -<?php /** @see \Formation\Controller\ExportController::extractionInscriptionAction(); */ ?> -<a href="<?php echo $this->url('export/extraction-inscription', ['csv' => 'csv'], [], true); ?>" class="btn btn-primary"> - <span class="icon icon-csv"></span> - Exporter au format CSV -</a> -<table class="table table-condensed" id="inscriptions"> - <thead> - <tr> - <th> Stagiaire </th> - <th> Affectation </th> -<!-- <th> État de l'inscription</th>--> - <th> Action de formation </th> - <th> Domaine </th> - <th> Période </th> -<!-- <th> État de la sesion</th>--> -<!-- <th> Liste </th>--> - <th> Au plan de formation</th> - </tr> - </thead> - <tbody> - <?php foreach ($inscriptions as $inscription) : ?> - <?php - $stagiaire = $inscription->getIndividu(); - $affecation = null; - if ($stagiaire instanceof StagiaireExterne) $affecation = $stagiaire->getStructure(); - if ($stagiaire instanceof Agent) { - $structure = ($stagiaire->getAffectationPrincipale())?->getStructure(); - if ($structure) $affecation = (($structure->getNiv2() AND $structure->getNiv2() !== $structure)?($structure->getNiv2()->getLibelleCourt()." > "):"").$structure->getLibelleCourt(); - } - $session = $inscription->getSession(); - $action = $session->getFormation(); - ?> +<?php if (!$display) : ?> + <div class="alert alert-info"> + <span class="icon icon-information"></span> + Veuillez sélectionner vos critères d'extraction. + </div> +<?php else : ?> + <?php /** @see \Formation\Controller\ExportController::extractionInscriptionAction(); */ ?> + <a href="<?php echo $this->url('export/extraction-inscription', ['csv' => 'csv'], [], true); ?>" class="btn btn-primary"> + <span class="icon icon-csv"></span> + Exporter au format CSV + </a> + + <table class="table table-condensed" id="inscriptions"> + <thead> <tr> - <td data-order="<?php echo $stagiaire->getDenomination(false); ?>"> - <?php echo $stagiaire->getDenomination(); ?> - </td> - <td> <?php echo $affecation; ?> </td> -<!-- <td> --><?php //echo $this->etatinstance($inscription->getEtatActif()); ?><!--</td>--> - <td> <?php echo $action->getLibelle(); ?> </td> - <td> - <?php $domaines = $action->getDomaines(); ?> - <?php if (empty($domaines)): ?> - <em>Aucun domaine</em> - <?php else : ?> - <?php foreach ($domaines as $domaine) : ?> - <?php echo $domaine->getLibelle(); ?><br/> - <?php endforeach; ?> - <?php endif; ?> - </td> - <td> <?php echo $session->getPeriode(); ?> </td> -<!-- <td> --><?php //echo $this->etatinstance($session->getEtatActif()); ?><!--</td>--> -<!-- <td> --><?php //echo $inscription->getListe(); ?><!-- </td>--> - <td> - <?php if (!empty($session->getDemandesExternes())) : ?> - Hors plan de formation - <?php else: ?> - Dans le plan de formation - <?php endif ?> - </td> + <th> Stagiaire </th> + <th> Affectation </th> + <!-- <th> État de l'inscription</th>--> + <th> Action de formation </th> + <th> Domaine </th> + <th> Période </th> + <!-- <th> État de la sesion</th>--> + <!-- <th> Liste </th>--> + <th> Au plan de formation</th> </tr> - <?php endforeach; ?> - </tbody> -</table> + </thead> + <tbody> + <?php foreach ($inscriptions as $inscription) : ?> + <?php + $stagiaire = $inscription->getIndividu(); + $affecation = null; + if ($stagiaire instanceof StagiaireExterne) $affecation = $stagiaire->getStructure(); + if ($stagiaire instanceof Agent) { + $structure = ($stagiaire->getAffectationPrincipale())?->getStructure(); + if ($structure) $affecation = (($structure->getNiv2() AND $structure->getNiv2() !== $structure)?($structure->getNiv2()->getLibelleCourt()." > "):"").$structure->getLibelleCourt(); + } + $session = $inscription->getSession(); + $action = $session->getFormation(); + ?> + <tr> + <td data-order="<?php echo $stagiaire->getDenomination(false); ?>"> + <?php echo $stagiaire->getDenomination(); ?> + </td> + <td> <?php echo $affecation; ?> </td> + <!-- <td> --><?php //echo $this->etatinstance($inscription->getEtatActif()); ?><!--</td>--> + <td> <?php echo $action->getLibelle(); ?> </td> + <td> + <?php $domaines = $action->getDomaines(); ?> + <?php if (empty($domaines)): ?> + <em>Aucun domaine</em> + <?php else : ?> + <?php foreach ($domaines as $domaine) : ?> + <?php echo $domaine->getLibelle(); ?><br/> + <?php endforeach; ?> + <?php endif; ?> + </td> + <td> <?php echo $session->getPeriode(); ?> </td> + <!-- <td> --><?php //echo $this->etatinstance($session->getEtatActif()); ?><!--</td>--> + <!-- <td> --><?php //echo $inscription->getListe(); ?><!-- </td>--> + <td> + <?php if (!empty($session->getDemandesExternes())) : ?> + Hors plan de formation + <?php else: ?> + Dans le plan de formation + <?php endif ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> +<?php endif; ?> <script> $(document).ready(function () {