Commit b107a6c9 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Affichage formation et element pédagogique

Ajout des filtres
parent b84cbbc4
Loading
Loading
Loading
Loading
+40 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ use Application\Service\Traits\LocalContextServiceAwareTrait;
use Application\Service\Traits\NiveauEtapeServiceAwareTrait;
use Application\Service\Traits\StructureServiceAwareTrait;
use UnicaenApp\View\Model\CsvModel;
use Zend\Debug\Debug;
use Zend\Session\Container;


@@ -139,7 +140,6 @@ class OffreFormationController extends AbstractController

        list($structure, $niveau, $etape) = $this->getParams();


        // persiste les filtres dans le contexte local
        $this->getServiceLocalContext()
            ->setStructure($structure)
@@ -155,6 +155,7 @@ class OffreFormationController extends AbstractController
        if ($etape) $params['etape'] = $etape->getId();



        // élément pédagogique sélectionné dans le champ de recherche
        if (($element = $this->params()->fromPost('element')) && isset($element['id'])) {
            $form->get('element')->setValue($element);
@@ -231,6 +232,44 @@ class OffreFormationController extends AbstractController

    public function reconductionAction()
    {
        $structures = $this->getServiceStructure()->getList($this->getServiceStructure()->finderByEnseignement());

        list($structure, $niveau, $etape) = $this->getParams();

        $this->getServiceLocalContext()
            ->setStructure($structure)
            ->setNiveau($niveau)
            ->setEtape($etape);

        list($niveaux, $etapes, $elements) = $this->getNeep($structure, $niveau, $etape);
        //Order ETAPE > ELEMENT PEDAGOGIQUE
        $etapesComplementaires = [];
        foreach ($etapes as $v)
        {
            $etapesComplementaires[$v->getId()]['etape'] = $v;
        }
        foreach ($elements as $v)
        {
            $structureId = $v->getStructure()->getId();
            $etapesComplementaires[$structureId]['elements_pedagogique'][] = $v;
        }



        Debug::dump($etapesComplementaires);

        return [
            'etapesComplementaires' => $etapesComplementaires,
            'structure'  => $structure,
            'structures' => $structures,
            'niveau'     => $niveau,
            'niveaux'    => $niveaux,
            'etape'  => $etape,
            'etapes' => $etapes,
            'elements' => $elements
        ];



    }

+136 −0
Original line number Diff line number Diff line
<div class="row" id="reconduction-filters">
    <div class="col-md-4">
        <!---------------- Champ de sélection d'une structure --------------->
        <div class="panel panel-default">
            <div class="panel-heading">Structure</div>
            <div class="panel-body">
                <?php
                $selectStructure = new \Zend\Form\Element\Select('structure');
                $selectStructure
                    ->setValueOptions(['' => "(Sélectionnez une structure)"] + \UnicaenApp\Util::collectionAsOptions($structures))
                    ->setValue($structure ? $structure->getId() : null)
                    ->setAttributes(['class' => 'structure',
                                     'style' => 'width:250px;']);
                echo $this->formSelect($selectStructure);
                ?>

            </div>
        </div>
    </div>
    <div class="col-md-4">
        <!---------------- Champ de sélection niveau --------------->
        <div class="panel panel-default">
            <div class="panel-heading">Niveau</div>
            <div class="panel-body">
                <?php
                $selectNiveau = new \Zend\Form\Element\Select('niveau');
                $selectNiveau
                    ->setValueOptions(['' => "(Sélectionnez un niveau)"] + \UnicaenApp\Util::collectionAsOptions($niveaux))
                    ->setValue($niveau ? $niveau->getId() : null)
                    ->setAttributes(['class' => 'niveau',
                                     'style' => 'width:250px;']);
                echo $this->formSelect($selectNiveau);
                ?>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <!---------------- Champ de sélection formation --------------->
        <div class="panel panel-default">
            <div class="panel-heading">Formation</div>
            <div class="panel-body">
                <?php
                $selectEtapes = new \Zend\Form\Element\Select('etape');
                $selectEtapes
                    ->setValueOptions(['' => "(Sélectionnez une formation)"] + \UnicaenApp\Util::collectionAsOptions($etapes))
                    ->setValue($etape ? $etape->getId() : null)
                    ->setAttributes(['class' => 'etape',
                                    'style' => 'width:250px;']);
                echo $this->formSelect($selectEtapes);
                ?>
            </div>
        </div>
    </div>
</div>
<div class="row" style="margin:0 5px 0 5px;">
    <div class="col-11">
        <!---------------- Tableau des éléments pédagogiques --------------->
        <table class="table table-bordered table-condensed table-hover table-sort">
            <thead>
            <tr>
                <th colspan="3">Formation</th>
                <th colspan="5">Enseignement</th>
            </tr>
            <tr>
                <th><input type="checkbox"/></th>
                <th>Niveau</th>
                <th>Libellé</th>
                <th>Code</th>
                <th>Libellé</th>
                <th>Période</th>
                <th title="Formation ouverte à distance">FOAD</th>
                <th title="Régime d'inscription">Rég. d'insc.</th>
            </tr>
            </thead>
            <?php foreach ($elements as $ep): /* @var $ep \Application\Entity\Db\ElementPedagogique */ ?>
                <tr id="<?= $ep->getId() ?>">
                    <td><input type="checkbox"/></td>
                    <td><?= $ep->getEtape()->getNiveauToString() ?></td>
                    <td class="etape"><?= $this->etape($ep->getEtape())->renderLink() ?></td>
                    <td class="element"><?= $ep->getCode() ?></td>
                    <td class="element"><?= $this->elementPedagogique($ep)->renderLink($ep->getLibelle()) ?></td>
                    <td class="periode"><?= $ep->getPeriode() ?: "" ?></td>
                    <td><?= (bool)$ep->getTauxFoad() ? "Oui" : "Non" ?></td>
                    <td><?= $ep->getRegimesInscription(true) ?></td>
                </tr>
            <?php endforeach; ?>
            <tbody>
            </tbody>
        </table>

        <?php foreach ($etapesComplementaires as $ec): ?>
            <table class="table table-bordered table-condensed table-hover table-sort">
                <thead>
                <tr>
                    <th colspan="3">Formation : <?= $ec['etape']->__toString();?></th>
                    <th colspan="5">Enseignement</th>
                </tr>
                <tr>
                    <th><input type="checkbox"/></th>
                    <th>Niveau</th>
                    <th>Libellé</th>
                    <th>Code</th>
                    <th>Libellé</th>
                    <th>Période</th>
                    <th title="Formation ouverte à distance">FOAD</th>
                    <th title="Régime d'inscription">Rég. d'insc.</th>
                </tr>
                </thead>
            </table>

        <?php endforeach; ?>
    </div>
</div>

<script>
    $("document").ready(function()
    {
        $("body").on("change", "#reconduction-filters select", function(event)
        {
            $("*").css('cursor', 'wait');
            var structure = $('select.structure').val();
            var niveau = $('select.niveau').val();
            var etape = $('select.etape').val();
            var query = '';
            if(structure){ query += 'structure='+structure+'&';}
            if(niveau){ query += 'niveau='+niveau+'&';}
            if(etape){query += 'etape='+etape+'&';}
            var url = '<?= $this->url('of/reconduction'); ?>';
            url += '?' + query;
            $(location).attr('href', url);
        });
       
    });

</script>