Loading module/Application/config/type-formation.config.php +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ return [ 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:typeFormation]', 'route' => '/saisie[/:typeFormation][/:groupeTypeFormation]', 'constraints' => [ 'typeFormation' => '[0-9]*', ], Loading module/Application/src/Controller/TypeFormationController.php +9 −5 Original line number Diff line number Diff line Loading @@ -54,19 +54,23 @@ class TypeFormationController extends AbstractController GroupeTypeFormation::class, ]); $typeFormations = $this->getEvent()->getParam('typeFormation'); $typeFormation = $this->getEvent()->getParam('typeFormation'); $form = $this->getFormTypeFormationTypeFormationSaisie(); if (empty($typeFormations)) { if (empty($typeFormation)) { $title = "Création d'un nouveau type de formation"; $typeFormations = $this->getServiceTypeFormation()->newEntity(); /** @var TypeFormation $typeFormation */ $typeFormation = $this->getServiceTypeFormation()->newEntity(); $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation'); $typeFormation->setGroupe($groupeTypeFormation); } else { $title = "Édition d'un type de formation"; } $form->bindRequestSave($typeFormations, $this->getRequest(), function () use ($typeFormations, $form) { $form->bindRequestSave($typeFormation, $this->getRequest(), function () use ($typeFormation, $form) { $this->getServiceTypeFormation()->save($typeFormations); $this->getServiceTypeFormation()->save($typeFormation); $this->flashMessenger()->addSuccessMessage( "Ajout réussi" ); Loading module/Application/src/Entity/Db/TypeFormation.php +41 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application\Entity\Db; use Application\Service\AbstractEntityService; use Application\Service\Traits\SourceServiceAwareTrait; use RuntimeException; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; Loading @@ -10,11 +13,11 @@ use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * TypeFormation */ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface class TypeFormation extends AbstractEntityService implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; use ImportAwareTrait; use SourceServiceAwareTrait; /** * @var string */ Loading @@ -41,6 +44,29 @@ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface protected bool $serviceStatutaire = true; /** * retourne la classe des entités * * @return string * @throws RuntimeException */ public function getEntityClass() { return TypeFormation::class; } /** * Retourne l'alias d'entité courante * * @return string */ public function getAlias() { return 'typeFormation'; } /** * @return string Loading Loading @@ -147,4 +173,17 @@ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface return $this->getLibelleLong(); } /** * Retourne une nouvelle entité, initialisée avec les bons paramètres * * @return TypeFormation */ public function newEntity(): TypeFormation { $entity = parent::newEntity(); // toutes les entités créées ont OSE pour source!! $entity->setSource($this->getServiceSource()->getOse()); return $entity; } } module/Application/view/application/type-formation/index.phtml +10 −12 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); </div> <?php endif; ?> </div> <div class="card-body"> <table class="table table-bordered table-sm"> <thead> <tr> Loading @@ -66,7 +66,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); <?php if ($canEdit): ?> <td style="text-align: center"> <a class="ajax-modal" data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie', ['typeFormation' => $typeFormation->getId()], ['query' => ['tab' => 'edition']]) ?>" href="<?= $this->url('type-formation/saisie', ['typeFormation' => $typeFormation->getId(), 'groupeTypeFormation' => $groupeTypeFormation->getId()], ['query' => ['tab' => 'edition']]) ?>" title="Modifier le type de formation"><i class="fas fa-pen-to-square"></i></a> <?php if (!$typeFormation->getSource()->getImportable()): ?> <a class="pop-ajax" data-title="Suppression du type de formation" data-content="Êtes-vous sur de vouloir supprimer ?" Loading @@ -82,8 +82,14 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); <?php endforeach; ?> </tbody> </table> <?php if ($canEdit): ?> <tr class="champ-triable"> <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie', ['typeFormation' => '','groupeTypeFormation' => $groupeTypeFormation->getId()]); ?>"><i class="fas fa-plus"></i> Ajout d'un nouveau type de formation</a> </tr> <?php endif; ?> </div> </div> </div> <?php endforeach; ?> Loading Loading @@ -139,14 +145,6 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); </a> </tr> <?php endif; ?> <?php if ($canEdit): ?> <tr class="champ-triable"> <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie'); ?>"><i class="fas fa-plus"></i> Ajout d'un nouveau type de formation</a> </tr> <?php endif; ?> <script type="text/javascript"> $(function () { Loading Loading
module/Application/config/type-formation.config.php +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ return [ 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:typeFormation]', 'route' => '/saisie[/:typeFormation][/:groupeTypeFormation]', 'constraints' => [ 'typeFormation' => '[0-9]*', ], Loading
module/Application/src/Controller/TypeFormationController.php +9 −5 Original line number Diff line number Diff line Loading @@ -54,19 +54,23 @@ class TypeFormationController extends AbstractController GroupeTypeFormation::class, ]); $typeFormations = $this->getEvent()->getParam('typeFormation'); $typeFormation = $this->getEvent()->getParam('typeFormation'); $form = $this->getFormTypeFormationTypeFormationSaisie(); if (empty($typeFormations)) { if (empty($typeFormation)) { $title = "Création d'un nouveau type de formation"; $typeFormations = $this->getServiceTypeFormation()->newEntity(); /** @var TypeFormation $typeFormation */ $typeFormation = $this->getServiceTypeFormation()->newEntity(); $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation'); $typeFormation->setGroupe($groupeTypeFormation); } else { $title = "Édition d'un type de formation"; } $form->bindRequestSave($typeFormations, $this->getRequest(), function () use ($typeFormations, $form) { $form->bindRequestSave($typeFormation, $this->getRequest(), function () use ($typeFormation, $form) { $this->getServiceTypeFormation()->save($typeFormations); $this->getServiceTypeFormation()->save($typeFormation); $this->flashMessenger()->addSuccessMessage( "Ajout réussi" ); Loading
module/Application/src/Entity/Db/TypeFormation.php +41 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application\Entity\Db; use Application\Service\AbstractEntityService; use Application\Service\Traits\SourceServiceAwareTrait; use RuntimeException; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; Loading @@ -10,11 +13,11 @@ use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * TypeFormation */ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface class TypeFormation extends AbstractEntityService implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; use ImportAwareTrait; use SourceServiceAwareTrait; /** * @var string */ Loading @@ -41,6 +44,29 @@ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface protected bool $serviceStatutaire = true; /** * retourne la classe des entités * * @return string * @throws RuntimeException */ public function getEntityClass() { return TypeFormation::class; } /** * Retourne l'alias d'entité courante * * @return string */ public function getAlias() { return 'typeFormation'; } /** * @return string Loading Loading @@ -147,4 +173,17 @@ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface return $this->getLibelleLong(); } /** * Retourne une nouvelle entité, initialisée avec les bons paramètres * * @return TypeFormation */ public function newEntity(): TypeFormation { $entity = parent::newEntity(); // toutes les entités créées ont OSE pour source!! $entity->setSource($this->getServiceSource()->getOse()); return $entity; } }
module/Application/view/application/type-formation/index.phtml +10 −12 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); </div> <?php endif; ?> </div> <div class="card-body"> <table class="table table-bordered table-sm"> <thead> <tr> Loading @@ -66,7 +66,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); <?php if ($canEdit): ?> <td style="text-align: center"> <a class="ajax-modal" data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie', ['typeFormation' => $typeFormation->getId()], ['query' => ['tab' => 'edition']]) ?>" href="<?= $this->url('type-formation/saisie', ['typeFormation' => $typeFormation->getId(), 'groupeTypeFormation' => $groupeTypeFormation->getId()], ['query' => ['tab' => 'edition']]) ?>" title="Modifier le type de formation"><i class="fas fa-pen-to-square"></i></a> <?php if (!$typeFormation->getSource()->getImportable()): ?> <a class="pop-ajax" data-title="Suppression du type de formation" data-content="Êtes-vous sur de vouloir supprimer ?" Loading @@ -82,8 +82,14 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); <?php endforeach; ?> </tbody> </table> <?php if ($canEdit): ?> <tr class="champ-triable"> <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie', ['typeFormation' => '','groupeTypeFormation' => $groupeTypeFormation->getId()]); ?>"><i class="fas fa-plus"></i> Ajout d'un nouveau type de formation</a> </tr> <?php endif; ?> </div> </div> </div> <?php endforeach; ?> Loading Loading @@ -139,14 +145,6 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); </a> </tr> <?php endif; ?> <?php if ($canEdit): ?> <tr class="champ-triable"> <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie'); ?>"><i class="fas fa-plus"></i> Ajout d'un nouveau type de formation</a> </tr> <?php endif; ?> <script type="text/javascript"> $(function () { Loading