Commit 693f473c authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Affichage du parcours de formations dans l'export des fiches metiers

parent 71ef7efa
Loading
Loading
Loading
Loading
+103 −47
Original line number Diff line number Diff line
@@ -2,12 +2,15 @@

/**
 * @var FicheMetier $fiche
 * @var ParcoursDeFormation $parcours
 */

use Application\Entity\Db\Competence;
use Application\Entity\Db\CompetenceType;
use Application\Entity\Db\FicheMetier;
use Application\Entity\Db\FicheMetierTypeActivite;
use Application\Entity\Db\FormationGroupe;
use Application\Entity\Db\ParcoursDeFormation;
use Application\Entity\Db\Formation;

$metier = $fiche->getMetier();
@@ -54,6 +57,7 @@ $metier = $fiche->getMetier();
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    div.activite {
        border-left: 2px solid #123456;
        border-bottom: 1px solid #123456;
@@ -73,6 +77,7 @@ $metier = $fiche->getMetier();
    table.activite th {
        text-align: left;
    }

    table.activite td {
        font-size: 9pt;
        /*margin-left: 5rem;*/
@@ -83,7 +88,9 @@ $metier = $fiche->getMetier();

<?php
$activites = $fiche->getActivites();
    usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) { return $a->getPosition() < $b->getPosition();});
usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) {
    return $a->getPosition() < $b->getPosition();
});
?>

<!-- TITRE ------------------------------------------------------------------------------------------------------------>
@@ -103,11 +110,14 @@ $metier = $fiche->getMetier();
                <th> Références :</th>
                <?php if ($references and !empty($references)) : ?>
                <?php $first = true; ?>
                        <?php foreach ($references as $reference) : ?>
                <?php foreach ($references

                as $reference) : ?>
                <?php if (!$first) echo "<tr><th></th>"; ?>
                <td>
                    <?php echo $reference->getTitre(); ?>
                            </td></tr>
                </td>
            </tr>
            <?php $first = false; ?>
            <?php endforeach; ?>
            <?php endif; ?>
@@ -152,14 +162,18 @@ $metier = $fiche->getMetier();

<?php
$competences = $fiche->getCompetences();
usort($competences, function (Competence $a, Competence $b) { return $a->getLibelle() > $b->getLibelle();});
usort($competences, function (Competence $a, Competence $b) {
    return $a->getLibelle() > $b->getLibelle();
});

$types = [];
foreach ($competences as $competence) {
    $type = $competence->getType();
    $types[$type->getId()] = $type;
}
usort($types, function(CompetenceType $a, CompetenceType $b) { return $a->getOrdre() > $b->getOrdre();});
usort($types, function (CompetenceType $a, CompetenceType $b) {
    return $a->getOrdre() > $b->getOrdre();
});

$dictionnaire = [];
foreach ($types as $type) $dictionnaire[$type->getLibelle()] = [];
@@ -225,19 +239,61 @@ ksort($dictionnaire);
<?php endif; ?>

<?php
$formations = $fiche->getFormations();
usort($formations, function (Formation $a, Formation $b) { return $a->getLibelle() > $b->getLibelle();});
$categorie = $fiche->getMetier()->getCategorie();
$parcour = null;
/** @var ParcoursDeFormation $p */
foreach ($parcours as $p) {
    if ($p->getReference() === $categorie->getId()) {
        $parcour = $p;
        break;
    }
}

?>

<?php if (! empty($formations)) : ?>
<?php if (empty($parcours)) : ?>
    <div class="secondary-block">
        Aucun parcours de formation pour la catégorie : <?php echo $categorie->getLibelle(); ?>
    </div>
<?php else : ?>
    <div class="secondary-block">
        Formations
        Parcours de formation : <?php echo $parcour->getLibelle(); ?>
    </div>
    <div class="activite">

    <?php
        $groupes = [];
        $sans = [];
        $formations = [];
        foreach($parcour->getFormations() as $formation) {
            if ($formation->getGroupe()) {
                $groupes[$formation->getGroupe()->getId()] = $formation->getGroupe();
                $formations[$formation->getGroupe()->getId()][] = $formation;
            } {
                $sans[] = $formation;
            }
        }
        usort($groupes, function (FormationGroupe $a, FormationGroupe $b) {return $a->getOrdre() > $b->getOrdre();});
    ?>

    <ul>
            <?php foreach ($formations as $formation) : ?>
   <?php foreach ($groupes as $groupe) : ?>
        <li> <?php echo $groupe->getLibelle(); ?>
            <ul>
                <?php foreach ($formations[$groupe->getId()] as $formation) : ?>
                    <li> <?php echo $formation->getLibelle(); ?> </li>
                <?php endforeach; ?>
            </ul>
    </div>
        </li>
   <?php endforeach; ?>
        <?php if (! empty($sans)) : ?>
            <l1> Sans groupe ... </l1>
            <ul>
                <?php foreach ($sans as $formation) : ?>
                    <li> <?php echo $formation->getLibelle(); ?> </li>
                <?php endforeach; ?>
            </ul>
        <?php endif; ?>
    </ul>

<?php endif; ?>