Commit 5a797a17 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Utilisation du générateur d'URL de Zend

Affichage d'erreur propre en cas de soucis lors de la reconduction d'ODF
parent afc5df47
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class OffreFormationController extends AbstractController
        $this->initFilters();


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

        // persiste les filtres dans le contexte local
        $this->getServiceLocalContext()
@@ -58,7 +58,7 @@ class OffreFormationController extends AbstractController
            ->setEtape($etape);

        $structures = $this->getServiceStructure()->getList($this->getServiceStructure()->finderByEnseignement());
        list($niveaux, $etapes, $elements) = $this->getServiceOffreFormation()->getNeep($structure, $niveau, $etape);
        [$niveaux, $etapes, $elements] = $this->getServiceOffreFormation()->getNeep($structure, $niveau, $etape);

        $params = [];
        if ($structure) $params['structure'] = $structure->getId();
@@ -90,7 +90,7 @@ class OffreFormationController extends AbstractController
    {
        $this->initFilters();

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

        $elements = $this->getServiceOffreFormation()->getNeep($structure, $niveau, $etape)[2];
        /* @var $elements ElementPedagogique[] */
@@ -145,7 +145,7 @@ class OffreFormationController extends AbstractController
    public function reconductionAction()
    {
        $this->initFilterHistorique();
        list($structure, $niveau, $etape) = $this->getParams();
        [$structure, $niveau, $etape] = $this->getParams();
        //Get role of user
        $role = $this->getServiceContext()->getSelectedIdentityRole();

@@ -155,7 +155,7 @@ class OffreFormationController extends AbstractController
        $structures = $this->getServiceStructure()->getList($qb);

        $anneeEnCours = $this->getServiceContext()->getAnnee();
        list($offresComplementaires, $mappingEtape, $reconductionTotale) = $this->getServiceOffreFormation()->getOffreComplementaire($structure, $niveau, $etape);
        [$offresComplementaires, $mappingEtape, $reconductionTotale] = $this->getServiceOffreFormation()->getOffreComplementaire($structure, $niveau, $etape);

        $reconductionStep = '';
        $messageStep      = '';
@@ -181,7 +181,7 @@ class OffreFormationController extends AbstractController
            } catch (\Exception $e) {
                $reconductionStep = false;
                $messageStep      = $e->getMessage();
                echo $e->getMessage();
                $this->flashMessenger()->addErrorMessage($e->getMessage());
            }
        }

+83 −77
Original line number Diff line number Diff line
<?php
/**
 * @var $this \Application\View\Renderer\PhpRenderer
 *
 */

$this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');
?>

@@ -28,8 +33,7 @@ $this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');
    <div class="col-11">



        <h3>Offre de formation complémantaire / Année universitaire :  <?php echo $anneeEnCours->getLibelle(); ?></h3>
        <h3>Offre de formation complémantaire / Année universitaire : <?php echo $anneeEnCours; ?></h3>
        <br/>
        <?php
        echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
@@ -56,26 +60,43 @@ $this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');
            </table>
        <?php else: ?>
            <?php if ($fromPost): ?>
               <p> <a href="<?= $this->url('of/reconduction') . "?structure=" . $structure->getId(); ?>" >< Retour à la liste des formations.</a></p>
                <p><a href="<?= $this->url('of/reconduction', [], ['query' => ['structure' => $structure->getId()]]) ?>"><
                        Retour à la liste
                        des formations.</a></p>
            <?php else: ?>
                <?php if ($reconductionTotale == 'non'): ?>
                <div class="well well-sm">Les lignes avec le fond gris ont déjà été reconduites pour la prochaine année universitaire.</div>
                <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST" id="form-reconduction">
                    <div class="well well-sm">Les lignes avec le fond gris ont déjà été reconduites pour la prochaine année
                        universitaire.
                    </div>
                    <form action="<?php echo $this->url(null, [], [], true) ?>" method="POST" id="form-reconduction">

                        <?php foreach ($offresComplementaires

                    <?php foreach ($offresComplementaires as $ec): ?>
                        as $ec): ?>
                        <?php if ($ec['reconduction_partiel'] == 'oui'): ?>
                        <table class="reconduction-offre table table-bordered table-condensed table-hover">
                            <?php else: ?>
                            <table class="reconduction-offre table table-bordered table-condensed table-hover" style="display: none;" >
                            <table class="reconduction-offre table table-bordered table-condensed table-hover"
                                   style="display: none;">
                                <?php endif; ?>
                                <thead>
                                <tr class="<?php if($ec['reconduction'] == 'oui'){echo "active";}else{echo "info";}?>">
                                <tr class="<?php if ($ec['reconduction'] == 'oui') {
                                    echo "active";
                                } else {
                                    echo "info";
                                } ?>">
                                    <?php if ($ec['reconduction'] == 'oui'): ?>
                                        <th><input title="Formation déjà reconduite pour l'année prochaine"  type="checkbox" class="checkbox-formation" disabled="disabled" name="etape[]" value="<?= $ec['etape']->getId(); ?>"/>  <span class="label label-warning" style="margin:0 auto;">Reconduit</span></th>
                                        <th><input title="Formation déjà reconduite pour l'année prochaine" type="checkbox"
                                                   class="checkbox-formation" disabled="disabled" name="etape[]"
                                                   value="<?= $ec['etape']->getId(); ?>"/> <span class="label label-warning"
                                                                                                 style="margin:0 auto;">Reconduit</span>
                                        </th>
                                    <?php else: ?>
                                        <th><input type="checkbox" class="checkbox-formation" checked="checked" name="etape[]" value="<?= $ec['etape']->getId(); ?>"/></th>
                                        <th><input type="checkbox" class="checkbox-formation" checked="checked" name="etape[]"
                                                   value="<?= $ec['etape']->getId(); ?>"/></th>
                                    <?php endif; ?>
                                <th colspan="6">Formation : <?= $ec['etape']->__toString() . ' (' . $ec['etape']->getAnnee()->getLibelle() . ')'; ?></th>
                                    <th colspan="6">Formation
                                        : <?= $ec['etape'] . ' (' . $ec['etape']->getAnnee() . ')'; ?></th>
                                </tr>
                                <tr>
                                    <th colspan="2">Code</th>
@@ -87,8 +108,7 @@ $this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');
                                </thead>
                                <tbody>
                                <?php
                            if(empty($ec['elements_pedagogique']))
                            {
                                if (empty($ec['elements_pedagogique'])) {
                                    ?>
                                    <tr>
                                        <td colspan="7" style="text-align: center;">Aucun élément pédagogique</td>
@@ -96,14 +116,21 @@ $this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');
                                <?php } ?>

                                <?php foreach ($ec['elements_pedagogique'] as $ep): ?>
                                    <tr id="<?= $ep['element']->getId() ?>" class="<?php if($ep['reconduction'] == 'oui'){echo "active";}?>">
                                    <tr id="<?= $ep['element']->getId() ?>" class="<?php if ($ep['reconduction'] == 'oui') {
                                        echo "active";
                                    } ?>">
                                        <?php if ($ep['reconduction'] == 'oui'): ?>
                                            <td>
                                                <input title="Elément pédagogique déjà reconduit pour l'année prochaine" class="checkbox-element" disabled="disabled" type="checkbox" name="element[<?php echo $ec['etape']->getId();?>][]" value="<?= $ep['element']->getId(); ?>"/>
                                                <input title="Elément pédagogique déjà reconduit pour l'année prochaine"
                                                       class="checkbox-element" disabled="disabled" type="checkbox"
                                                       name="element[<?php echo $ec['etape']->getId(); ?>][]"
                                                       value="<?= $ep['element']->getId(); ?>"/>
                                                <span class="label label-warning">Reconduit</span>
                                            </td>
                                        <?php else: ?>
                                            <td><input class="checkbox-element" type="checkbox" checked="checked" name="element[<?php echo $ec['etape']->getId();?>][]" value="<?= $ep['element']->getId(); ?>"/></td>
                                            <td><input class="checkbox-element" type="checkbox" checked="checked"
                                                       name="element[<?php echo $ec['etape']->getId(); ?>][]"
                                                       value="<?= $ep['element']->getId(); ?>"/></td>
                                        <?php endif; ?>
                                        <td class="element"><?= $ep['element']->getCode() ?></td>
                                        <td class="element"><?= $this->elementPedagogique($ep['element'])->renderLink($ep['element']->getLibelle()) ?></td>
@@ -122,7 +149,9 @@ $this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');
                </div>
                <div style='text-align:right'>
                <button type='button' class='btn btn-default pop-ajax-hide'>Non</button>
                <button type='button' class='btn btn-primary' id='confirm-reconduction'>Oui</button></div>"><span class="glyphicon glyphicon-share"></span> Reconduire l'offre pour l'année suivante</button>
                <button type='button' class='btn btn-primary' id='confirm-reconduction'>Oui</button></div>"><span
                                        class="glyphicon glyphicon-share"></span> Reconduire l'offre pour l'année suivante
                            </button>
                    </form>
                <?php else: ?>
                    <table class="reconduction-offre table table-bordered table-condensed table-hover">
@@ -149,26 +178,3 @@ $this->headScript()->offsetSetFile(100, '/js/reconduction-offre.js');

    </div>
</div>

<div id="modal-dialog" class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <a href="#" data-dismiss="modal" aria-hidden="true" class="close">×</a>
                <h3>Demande de confirmation</h3>
            </div>
            <div class="modal-body">
                <p>Êtes vous sûre de vouloir reconduire ces offres de formation pour la prochaine année universitaire ?</p>
            </div>
            <div class="modal-footer">
                <a href="#" id="btnYes" class="btn confirm">OUI</a>
                <a href="#" data-dismiss="modal" aria-hidden="true" class="btn secondary">NON</a>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

</script>