Skip to content
Snippets Groups Projects
Commit 78af8c87 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Correction rendu historique des formations

parent e93f4a54
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,8 @@ namespace Formation\Controller; ...@@ -4,6 +4,8 @@ namespace Formation\Controller;
use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\Macro\MacroServiceAwareTrait; use Application\Service\Macro\MacroServiceAwareTrait;
use Formation\Entity\Db\Formation;
use Formation\Entity\Db\FormationInstanceInscrit;
use Formation\Entity\Db\Seance; use Formation\Entity\Db\Seance;
use Formation\Provider\Etat\SessionEtats; use Formation\Provider\Etat\SessionEtats;
use Formation\Provider\Template\PdfTemplates; use Formation\Provider\Template\PdfTemplates;
...@@ -127,12 +129,25 @@ class FormationInstanceDocumentController extends AbstractActionController ...@@ -127,12 +129,25 @@ class FormationInstanceDocumentController extends AbstractActionController
$inscriptions = $this->getFormationInstanceInscritService()->getFormationsBySuivies($agent); $inscriptions = $this->getFormationInstanceInscritService()->getFormationsBySuivies($agent);
$texte = "<ul>"; $array = [];
foreach ($inscriptions as $inscription) {
$annee = Formation::getAnnee($inscription->getInstance()->getDebut(true));
$array[$annee][] = $inscription;
}
ksort($array);
$array = array_reverse($array, true);
$texte = "";
foreach ($array as $annee => $inscriptions) {
usort($inscriptions, function (FormationInstanceInscrit $a, FormationInstanceInscrit $b) { return $a->getInstance()->getDebut(true) > $b->getInstance()->getDebut(true);});
$texte .= "<div>";
$texte .= "<h3>Formations pour l'année ".$annee."/" . ($annee+1)."</h3>";
$texte .= "<ul>";
foreach ($inscriptions as $inscription) { foreach ($inscriptions as $inscription) {
$dureeSuivie = $inscription->getDureePresence(); $dureeSuivie = $inscription->getDureePresence();
$session = $inscription->getInstance(); $session = $inscription->getInstance();
$sessionEtat = $session->getEtat()->getCode(); $sessionEtat = $session->getEtat()->getCode();
if ($dureeSuivie != '0 heures ' AND ($sessionEtat === SessionEtats::ETAT_CLOTURE_INSTANCE OR $sessionEtat === SessionEtats::ETAT_ATTENTE_RETOURS)) { if ($dureeSuivie != '0 heures ' and ($sessionEtat === SessionEtats::ETAT_CLOTURE_INSTANCE or $sessionEtat === SessionEtats::ETAT_ATTENTE_RETOURS)) {
$libelle = $session->getFormation()->getLibelle(); $libelle = $session->getFormation()->getLibelle();
$periode = $session->getPeriode(); $periode = $session->getPeriode();
$texte .= "<li>"; $texte .= "<li>";
...@@ -141,7 +156,8 @@ class FormationInstanceDocumentController extends AbstractActionController ...@@ -141,7 +156,8 @@ class FormationInstanceDocumentController extends AbstractActionController
$texte .= "</li>"; $texte .= "</li>";
} }
} }
$texte .= "<ul>"; $texte .= "</ul>";
}
$vars = [ $vars = [
'agent' => $agent, 'agent' => $agent,
...@@ -153,6 +169,7 @@ class FormationInstanceDocumentController extends AbstractActionController ...@@ -153,6 +169,7 @@ class FormationInstanceDocumentController extends AbstractActionController
$exporter->setRenderer($this->renderer); $exporter->setRenderer($this->renderer);
$exporter->getMpdf()->SetTitle($rendu->getSujet()); $exporter->getMpdf()->SetTitle($rendu->getSujet());
$exporter->setHeaderScript('/application/document/pdf/entete-logo-ccc'); $exporter->setHeaderScript('/application/document/pdf/entete-logo-ccc');
$exporter->getMpdf()->SetMargins(0,0,50);
$exporter->setFooterScript('/application/document/pdf/pied-vide'); $exporter->setFooterScript('/application/document/pdf/pied-vide');
$exporter->addBodyHtml($corps); $exporter->addBodyHtml($corps);
return $exporter->export($rendu->getSujet(), PdfExporter::DESTINATION_BROWSER, null); return $exporter->export($rendu->getSujet(), PdfExporter::DESTINATION_BROWSER, null);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment