Commit 7735a5b7 authored by joriot221's avatar joriot221
Browse files

Premiere version de la restauration d'of

parent cfdca65f
Loading
Loading
Loading
Loading
+10 −1
Changes for module/Application/config/offre-formation.config.php: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -218,6 +218,15 @@ return [
                                    'defaults'    => ['action' => 'saisir'],
                                ],
                            ],
                            'restaurer' => [
                                'type'    => 'Segment',
                                'options' => [
                                    'route'       => '/restaurer/:etape',
                                    'constraints' => ['etape' => '[0-9]*'],
                                    'defaults'    => ['action' => 'restaurer'],
                                ],
                            ],

                            'modifier'      => [
                                'type'    => 'Segment',
                                'options' => [
@@ -362,7 +371,7 @@ return [
                ],
                [
                    'controller' => 'Application\Controller\OffreFormation\Etape',
                    'action'     => ['saisir', 'supprimer'],
                    'action'     => ['restaurer', 'saisir', 'supprimer'],
                    'privileges' => Privileges::ODF_ETAPE_EDITION,
                ],
                /* Éléments pédagogiques */
+18 −0
Changes for module/Application/src/Controller/OffreFormation/EtapeController.php: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -74,6 +74,24 @@ class EtapeController extends AbstractController



    public function restaurerAction()
    {
        if (!($etape = $this->getEvent()->getParam('etape'))) {
            throw new \RuntimeException('L\'identifiant n\'est pas bon ou n\'a pas été fourni');
        }

        $etape->dehistoriser();
        $this->getServiceEtape()->save($etape);

        $elems = $this->em()->getRepository(ElementPedagogique::class)->findBy([
            'etape'            => $etape,
            'histodestruction' => null,
        ]);


        return $this->redirect()->toRoute('of', ['etape' => $etape->getId()], [], true);
    }

    public function voirAction()
    {
        $this->em()->getFilters()->enable('historique')->init([
+5 −0
Changes for module/Application/view/application/offre-formation/index.phtml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -211,6 +211,10 @@ $canSyncElement = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_ELE
        <?php else: ?>

            <!---------------- Champ de recherche d'un élément pédagogique --------------->
            <?php if ($compl = $etape && $etape->estHistorise()):
                echo "<br />" . $this->tag('a', ['class' => 'no-intranavigation', 'href' => $this->url('of/etape/restaurer', ['etape' => $etape->getId()])])->html('Restaurer la formation');
            endif; ?>

            <div class="element-rech panel panel-default">
                <div class="panel-heading" style="margin-bottom:1em">
                    <?php $compl = $etape ? "de la formation <strong>$etape</strong>" : "toutes formations confondues"; ?>
@@ -273,6 +277,7 @@ $canSyncElement = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_ELE
                    </tr>
                    </thead>
                    <tbody>

                    <?php foreach ($elements as $ep): /* @var $ep \Application\Entity\Db\ElementPedagogique */ ?>
                        <tr id="<?= $ep->getId() ?>">
                            <td><?= $ep->getEtape()->getNiveauToString() ?></td>