From 80464eb786ba22db314d3c7a0647a9f455973a18 Mon Sep 17 00:00:00 2001 From: Alexandre Zvenigorosky <alexandre.zvenigorosky@unicaen.fr> Date: Wed, 20 Jun 2018 13:30:11 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Affichage=20des=20ann=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ModulateurController.php | 68 ++++++++++--------- .../TypeModulateurStructureService.php | 41 +++++++++++ .../view/application/modulateur/index.phtml | 2 +- 3 files changed, 77 insertions(+), 34 deletions(-) diff --git a/module/Application/src/Application/Controller/ModulateurController.php b/module/Application/src/Application/Controller/ModulateurController.php index b2d800cf3c..cf425b9438 100755 --- a/module/Application/src/Application/Controller/ModulateurController.php +++ b/module/Application/src/Application/Controller/ModulateurController.php @@ -42,15 +42,15 @@ class modulateurController extends AbstractController $this->em()->getFilters()->enable('historique')->init([ TypeModulateurStructure::class, ]); - $modulateurs = $this->getServiceModulateur()->getList(); - $typeModulateurs = $this->getServiceTypeModulateur()->getList(); + $modulateurs = $this->getServiceModulateur()->getList(); + $typeModulateurs = $this->getServiceTypeModulateur()->getList(); $typeModulateurStructures = $this->getServiceTypeModulateurStructure()->getList(); - $role = $this->getServiceContext()->getSelectedIdentityRole(); - $structure = $role->getStructure(); + $role = $this->getServiceContext()->getSelectedIdentityRole(); + $structure = $role->getStructure(); - return compact('modulateurs', 'typeModulateurs','typeModulateurStructures','structure'); + return compact('modulateurs', 'typeModulateurs', 'typeModulateurStructures', 'structure'); } @@ -142,47 +142,49 @@ class modulateurController extends AbstractController return new MessengerViewModel(compact('typeModulateur')); } + + + public function typeModulateurStructureSaisieAction() { /* @var $typeModulateurStructure typeModulateurStructure */ /* @var $typeModulateur typeModulateur */ $typeModulateur = $this->getEvent()->getParam('typeModulateur'); - $form = $this->getFormTypeModulateurStructureSaisie(); - // if (empty($typeModulateurStructure)) { - $title = 'Création d\'un nouveau Type de Modulateur de Structure'; - $typeModulateurStructure = $this->getServiceTypeModulateurStructure()->newEntity() - ->setTypeModulateur($typeModulateur); - // } else { - //$title = 'Édition d\'un Type de Modulateur pour une structure'; - //} + $form = $this->getFormTypeModulateurStructureSaisie(); + $title = 'Création d\'un nouveau Type de Modulateur de Structure'; + $typeModulateurStructure = $this->getServiceTypeModulateurStructure()->newEntity() + ->setTypeModulateur($typeModulateur); $form->bindRequestSave($typeModulateurStructure, $this->getRequest(), function (typeModulateurStructure $tms) { - try { - $this->getServiceTypeModulateurStructure()->save($tms); - $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); - } catch (\Exception $e) { - $e = DbException::translate($e); - $this->flashMessenger()->addErrorMessage($e->getMessage() . ':' . $tms->getId().':'.$tms->getTypeModulateur()); - } + try{ + $this->getServiceTypeModulateurStructure()->save($tms); + $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); + } catch (\Exception $e) { + $e = DbException::translate($e); + $this->flashMessenger()->addErrorMessage($e->getMessage() . ':' . $tms->getId() . ':' . $tms->getTypeModulateur()); + } }); - return compact('form', 'title'); - } +return compact('form', 'title'); +} - public function typeModulateurStructureDeleteAction() - { - /* @var $typeModulateurStructure typeModulateurStructure */ - $typeModulateurStructure = $this->getEvent()->getParam('typeModulateurStructure'); - try { - $this->getServiceTypeModulateurStructure()->delete($typeModulateurStructure); - $this->flashMessenger()->addSuccessMessage("Type de Modulateur de structure supprimé avec succès."); - } catch (\Exception $e) { - $this->flashMessenger()->addErrorMessage(DbException::translate($e)->getMessage()); - } - return new MessengerViewModel(compact('typeModulateur')); + +public +function typeModulateurStructureDeleteAction() +{ + /* @var $typeModulateurStructure typeModulateurStructure */ + $typeModulateurStructure = $this->getEvent()->getParam('typeModulateurStructure'); + try { + $this->getServiceTypeModulateurStructure()->delete($typeModulateurStructure); + $this->flashMessenger()->addSuccessMessage("Type de Modulateur de structure supprimé avec succès."); + } catch (\Exception $e) { + $this->flashMessenger()->addErrorMessage(DbException::translate($e)->getMessage()); } + + return new MessengerViewModel(compact('typeModulateur')); +} } \ No newline at end of file diff --git a/module/Application/src/Application/Service/TypeModulateurStructureService.php b/module/Application/src/Application/Service/TypeModulateurStructureService.php index a555d31aec..ea56d5947a 100644 --- a/module/Application/src/Application/Service/TypeModulateurStructureService.php +++ b/module/Application/src/Application/Service/TypeModulateurStructureService.php @@ -43,4 +43,45 @@ use TypeModulateurStructureServiceAwareTrait; return 'tmd'; } + public function existe(TypeModulateurStructure $tms){ + /* @var $tbltms typeModulateurStructure[] */ + /* @var $elt typeModulateurStructure */ + $dql = " + SELECT + m + FROM + Application\Entity\Db\TypeModulateurStructure m + WHERE + m.histoDestruction IS NULL + AND m.typeModulateur = :typemodulateur + AND m.structure = :structure"; + + $query = $this->getEntityManager()->createQuery($dql); + $query->setParameter('typemodulateur',$tms->getTypeModulateur()); + $query->setParameter('structure',$tms->getStructure()); + $tbltms = $query->getResult(); + // recherche de doublon + $ok = true; + foreach ($tbltms as $elt) { + if (((!$elt->getAnneeDebut()) or ($elt->getAnneeDebut()->getId() <= $tms->getAnneeFin()->getId())) and ((!$elt->getAnneeFin()) + or ($elt->getAnneeFin()->getId() >= $tms->getAnneeDebut()->getId()))) { + $ok = false; + } + } + return $ok; +} + + /** + * @param TypeModulateurStructure $entity + * + * @return TypeModulateurStructure + */ + public function save($entity) + { + if (!$this->existe($entity)) { + throw new \Exception('Un élément est en doublon avec l\'ajout demandé!'); + } + + return parent::save($entity); + } } \ No newline at end of file diff --git a/module/Application/view/application/modulateur/index.phtml b/module/Application/view/application/modulateur/index.phtml index 40a921fd53..92b286cfb1 100644 --- a/module/Application/view/application/modulateur/index.phtml +++ b/module/Application/view/application/modulateur/index.phtml @@ -88,7 +88,7 @@ foreach ($typeModulateurs as $tm) { <?php echo ($infoBulle ? '<abbr title="' . $infoBulle . '">' : '') . $tms->getStructure()->getLibelleCourt(); echo($infoBulle ? '</abbr>' : ''); if ($canEdit) { ?> - <a style="position:absolute; right: 20px;" pop-ajax" + <a style="position:absolute; right: 20px;" class="pop-ajax" href="<?= $this->url('modulateur/type-modulateur-structure-delete', ['typeModulateurStructure' => $tms->getId()]) ?>" title="Supprimer le type de modulateur pour la structure" data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>" -- GitLab From 2c5a367ab3537b18e01efbf6aff85b71c4edd999 Mon Sep 17 00:00:00 2001 From: Alexandre Zvenigorosky <alexandre.zvenigorosky@unicaen.fr> Date: Wed, 20 Jun 2018 14:09:30 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Affichage=20des=20ann=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/Application/config/modulateur.config.php | 3 ++- .../Application/Controller/ModulateurController.php | 11 ++++++++--- .../Service/TypeModulateurStructureService.php | 2 ++ .../view/application/modulateur/index.phtml | 13 +++++++++---- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/module/Application/config/modulateur.config.php b/module/Application/config/modulateur.config.php index bcd95aec50..ff697272ed 100644 --- a/module/Application/config/modulateur.config.php +++ b/module/Application/config/modulateur.config.php @@ -76,9 +76,10 @@ return [ 'type-modulateur-structure-saisie' => [ 'type' => 'Segment', 'options' => [ - 'route' => '/type-modulateur-structure-saisie/:typeModulateur', + 'route' => '/type-modulateur-structure-saisie/:typeModulateur[/:typeModulateurStructure]', 'constraints' => [ 'typeModulateur' => '[0-9]*', + 'typeModulateurStructure' => '[0-9]*', ], 'defaults' => [ 'action' => 'type-modulateur-structure-saisie', diff --git a/module/Application/src/Application/Controller/ModulateurController.php b/module/Application/src/Application/Controller/ModulateurController.php index cf425b9438..73f692197e 100755 --- a/module/Application/src/Application/Controller/ModulateurController.php +++ b/module/Application/src/Application/Controller/ModulateurController.php @@ -150,11 +150,16 @@ class modulateurController extends AbstractController /* @var $typeModulateurStructure typeModulateurStructure */ /* @var $typeModulateur typeModulateur */ $typeModulateur = $this->getEvent()->getParam('typeModulateur'); + $typeModulateurStructure = $this->getEvent()->getParam('typeModulateurStructure'); $form = $this->getFormTypeModulateurStructureSaisie(); - $title = 'Création d\'un nouveau Type de Modulateur de Structure'; - $typeModulateurStructure = $this->getServiceTypeModulateurStructure()->newEntity() - ->setTypeModulateur($typeModulateur); + if (empty($typeModulateurStructure)) { + $title = 'Ajout d\'une structure pour le type de modulateur'; + $typeModulateurStructure = $this->getServiceTypeModulateurStructure()->newEntity() + ->setTypeModulateur($typeModulateur); + } else { + $title = 'Édition d\'une sructure pour le type de modulateur'; + } $form->bindRequestSave($typeModulateurStructure, $this->getRequest(), function (typeModulateurStructure $tms) { try{ diff --git a/module/Application/src/Application/Service/TypeModulateurStructureService.php b/module/Application/src/Application/Service/TypeModulateurStructureService.php index ea56d5947a..5c6e1cd220 100644 --- a/module/Application/src/Application/Service/TypeModulateurStructureService.php +++ b/module/Application/src/Application/Service/TypeModulateurStructureService.php @@ -53,10 +53,12 @@ use TypeModulateurStructureServiceAwareTrait; Application\Entity\Db\TypeModulateurStructure m WHERE m.histoDestruction IS NULL + AND m.id != :id AND m.typeModulateur = :typemodulateur AND m.structure = :structure"; $query = $this->getEntityManager()->createQuery($dql); + $query->setParameter('id',$tms->getId()); $query->setParameter('typemodulateur',$tms->getTypeModulateur()); $query->setParameter('structure',$tms->getStructure()); $tbltms = $query->getResult(); diff --git a/module/Application/view/application/modulateur/index.phtml b/module/Application/view/application/modulateur/index.phtml index 92b286cfb1..9cfe8c7de0 100644 --- a/module/Application/view/application/modulateur/index.phtml +++ b/module/Application/view/application/modulateur/index.phtml @@ -70,7 +70,7 @@ foreach ($typeModulateurs as $tm) { <div class="col-md-9">Saisie par ens:</div> <div class="col-md-3"><?= affBooleen($tm->getSaisieParEnseignant()) ?></div> </div> - <table class="table table-bordered"> + <table class="table table-bordered table-condensed"> <?php foreach ($typeModulateurStructures as $tms) { ?> <?php if ($tm->getId() == $tms->getTypeModulateur()->getId()) { ?> @@ -88,7 +88,12 @@ foreach ($typeModulateurs as $tm) { <?php echo ($infoBulle ? '<abbr title="' . $infoBulle . '">' : '') . $tms->getStructure()->getLibelleCourt(); echo($infoBulle ? '</abbr>' : ''); if ($canEdit) { ?> - <a style="position:absolute; right: 20px;" class="pop-ajax" + <a style="position:absolute; right:36px; " class="ajax-modal" data-event="modulateur-saisie" + href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId(),'typeModulateurStructure' => $tms->getId()]) ?>" + title="Ajouter un type de modulateur pour une structure"> + <span class="glyphicon glyphicon-edit"></span> + </a> + <a style="position:absolute; right:20px; " class="pop-ajax" href="<?= $this->url('modulateur/type-modulateur-structure-delete', ['typeModulateurStructure' => $tms->getId()]) ?>" title="Supprimer le type de modulateur pour la structure" data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>" @@ -97,7 +102,7 @@ foreach ($typeModulateurs as $tm) { data-cancel-button="Non" data-submit-reload="true" > - <span class="glyphicon glyphicon-remove text-danger"></span> + <span class="glyphicon glyphicon-remove"></span> </a> <?php } ?> </td> @@ -109,7 +114,7 @@ foreach ($typeModulateurs as $tm) { <a class="ajax-modal" data-event="modulateur-saisie" href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId()]) ?>" title="Ajouter un type de modulateur pour une structure"> - <button type="button" class="btn-xs btn-primary">Ajouter</button> + <button type="button" class="btn-xs btn-primary">Ajouter une structure</button> </a> <?php } ?> </div> -- GitLab From 10dd51e21124ed413ad0cc2d4c613e772a4abb11 Mon Sep 17 00:00:00 2001 From: Alexandre Zvenigorosky <alexandre.zvenigorosky@unicaen.fr> Date: Wed, 20 Jun 2018 15:49:09 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Affichage=20des=20ann=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TypeModulateurStructureService.php | 57 +++++++++++++------ 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/module/Application/src/Application/Service/TypeModulateurStructureService.php b/module/Application/src/Application/Service/TypeModulateurStructureService.php index 5c6e1cd220..90807a5bc3 100644 --- a/module/Application/src/Application/Service/TypeModulateurStructureService.php +++ b/module/Application/src/Application/Service/TypeModulateurStructureService.php @@ -10,7 +10,8 @@ use Application\Service\Traits\TypeModulateurStructureServiceAwareTrait; */ class TypeModulateurStructureService extends AbstractEntityService { -use TypeModulateurStructureServiceAwareTrait; + use TypeModulateurStructureServiceAwareTrait; + /** * Liste des types de modulateur par structure * @@ -43,10 +44,26 @@ use TypeModulateurStructureServiceAwareTrait; return 'tmd'; } - public function existe(TypeModulateurStructure $tms){ - /* @var $tbltms typeModulateurStructure[] */ - /* @var $elt typeModulateurStructure */ - $dql = " + + + public function existe(TypeModulateurStructure $tms) + { + /* @var $tbltms typeModulateurStructure[] */ + /* @var $elt typeModulateurStructure */ + if (!$tms->getId()) { + $dql = " + SELECT + m + FROM + Application\Entity\Db\TypeModulateurStructure m + WHERE + m.histoDestruction IS NULL + AND m.typeModulateur = :typemodulateur + AND m.structure = :structure"; + + $query = $this->getEntityManager()->createQuery($dql); + } else { + $dql = " SELECT m FROM @@ -57,21 +74,25 @@ use TypeModulateurStructureServiceAwareTrait; AND m.typeModulateur = :typemodulateur AND m.structure = :structure"; - $query = $this->getEntityManager()->createQuery($dql); - $query->setParameter('id',$tms->getId()); - $query->setParameter('typemodulateur',$tms->getTypeModulateur()); - $query->setParameter('structure',$tms->getStructure()); - $tbltms = $query->getResult(); - // recherche de doublon - $ok = true; - foreach ($tbltms as $elt) { - if (((!$elt->getAnneeDebut()) or ($elt->getAnneeDebut()->getId() <= $tms->getAnneeFin()->getId())) and ((!$elt->getAnneeFin()) - or ($elt->getAnneeFin()->getId() >= $tms->getAnneeDebut()->getId()))) { - $ok = false; + $query = $this->getEntityManager()->createQuery($dql); + $query->setParameter('id', $tms->getId()); } + $query->setParameter('typemodulateur', $tms->getTypeModulateur()); + $query->setParameter('structure', $tms->getStructure()); + $tbltms = $query->getResult(); + // recherche de doublon + $ok = true; + foreach ($tbltms as $elt) { + if (((!$elt->getAnneeDebut()) or (!$tms->getAnneeFin()) or ($elt->getAnneeDebut()->getId() <= $tms->getAnneeFin()->getId())) and ((!$elt->getAnneeFin()) + or (!$tms->getAnneeDebut()) or ($elt->getAnneeFin()->getId() >= $tms->getAnneeDebut()->getId()))) { + $ok = false; + } + } + + return $ok; } - return $ok; -} + + /** * @param TypeModulateurStructure $entity -- GitLab From 9ae9cc0d641e322e15b07a8ee5b72bf0283a9e8f Mon Sep 17 00:00:00 2001 From: Alexandre Zvenigorosky <alexandre.zvenigorosky@unicaen.fr> Date: Wed, 20 Jun 2018 16:34:41 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Affichage=20des=20ann=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TypeModulateurStructureService.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/module/Application/src/Application/Service/TypeModulateurStructureService.php b/module/Application/src/Application/Service/TypeModulateurStructureService.php index 90807a5bc3..2fcd6ebdfb 100644 --- a/module/Application/src/Application/Service/TypeModulateurStructureService.php +++ b/module/Application/src/Application/Service/TypeModulateurStructureService.php @@ -4,7 +4,7 @@ namespace Application\Service; use Application\Entity\Db\TypeModulateurStructure; use Application\Service\Traits\TypeModulateurStructureServiceAwareTrait; - +use Doctrine\ORM\QueryBuilder; /** * Description of TypeModulateurStructureService */ @@ -102,9 +102,17 @@ class TypeModulateurStructureService extends AbstractEntityService public function save($entity) { if (!$this->existe($entity)) { - throw new \Exception('Un élément est en doublon avec l\'ajout demandé!'); + throw new \Exception('Une règle existe déjà pour cet intervalle d\'années choisi dans cette composante!'); } return parent::save($entity); } + + public function getList( QueryBuilder $qb=null, $alias=null ) + { + list($qb,$alias) = $this->initQuery($qb, $alias); + $qb->addOrderBy("$alias.structure"); + $qb->addOrderBy("$alias.anneeDebut"); + return parent::getList($qb, $alias); + } } \ No newline at end of file -- GitLab From 3d1f2d83e9506bca5cd669620b98c3a48033ddbb Mon Sep 17 00:00:00 2001 From: Alexandre Zvenigorosky <alexandre.zvenigorosky@unicaen.fr> Date: Wed, 19 Sep 2018 14:36:52 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Affichage=20des=20ann=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ModulateurController.php | 3 +- .../view/application/modulateur/index.phtml | 98 ++++++++++--------- 2 files changed, 53 insertions(+), 48 deletions(-) diff --git a/module/Application/src/Application/Controller/ModulateurController.php b/module/Application/src/Application/Controller/ModulateurController.php index 73f692197e..f48fe7b034 100755 --- a/module/Application/src/Application/Controller/ModulateurController.php +++ b/module/Application/src/Application/Controller/ModulateurController.php @@ -42,6 +42,7 @@ class modulateurController extends AbstractController $this->em()->getFilters()->enable('historique')->init([ TypeModulateurStructure::class, ]); + $anneeId = $this->getServiceContext()->getAnnee()->getId(); $modulateurs = $this->getServiceModulateur()->getList(); $typeModulateurs = $this->getServiceTypeModulateur()->getList(); $typeModulateurStructures = $this->getServiceTypeModulateurStructure()->getList(); @@ -50,7 +51,7 @@ class modulateurController extends AbstractController $role = $this->getServiceContext()->getSelectedIdentityRole(); $structure = $role->getStructure(); - return compact('modulateurs', 'typeModulateurs', 'typeModulateurStructures', 'structure'); + return compact('modulateurs', 'typeModulateurs', 'typeModulateurStructures', 'structure', 'anneeId'); } diff --git a/module/Application/view/application/modulateur/index.phtml b/module/Application/view/application/modulateur/index.phtml index 9cfe8c7de0..2d8d777a0e 100644 --- a/module/Application/view/application/modulateur/index.phtml +++ b/module/Application/view/application/modulateur/index.phtml @@ -1,4 +1,6 @@ <?php + + /** * @var $this \Application\View\Renderer\PhpRenderer * @var $modulateurs \Application\Entity\Db\modulateur[] @@ -20,7 +22,8 @@ $this->headTitle()->append("Modulateurs des taux horaires"); $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::MODULATEUR_EDITION)); ?> -<h1 class="page-header">Modulateurs des taux horaires</h1> +<h1 class="page-header">Modulateurs des taux horaires + <?= $anneeId ?></h1> <?php foreach ($typeModulateurs as $tm) { if ($this->isAllowed($tm, Privileges::MODULATEUR_VISUALISATION)) { ?> @@ -31,12 +34,11 @@ foreach ($typeModulateurs as $tm) { <span style="position:absolute; right: 50px;"> <?php if ($canEdit): ?> - <a class="ajax-modal" data-event="modulateur-saisie" - href="<?= $this->url('modulateur/saisie', ['typeModulateur' => $tm->getId()]) ?>" - title="Ajouter un modulateur"> + <a class="ajax-modal" data-event="modulateur-saisie" + href="<?= $this->url('modulateur/saisie', ['typeModulateur' => $tm->getId()]) ?>" + title="Ajouter un modulateur"> <span class="glyphicon glyphicon-plus"></span> </a> - <?php endif ?> <a class="ajax-modal" data-event="modulateur-saisie" href="<?= $this->url('modulateur/type-modulateur-saisie', ['typeModulateur' => $tm->getId()]) ?>" title="Modifier le type de modulateur"> @@ -54,6 +56,7 @@ foreach ($typeModulateurs as $tm) { </a> </span> </div> + <?php endif ?> </div> <div class="panel-body"> <div class="row"> @@ -71,51 +74,52 @@ foreach ($typeModulateurs as $tm) { <div class="col-md-3"><?= affBooleen($tm->getSaisieParEnseignant()) ?></div> </div> <table class="table table-bordered table-condensed"> - <?php foreach ($typeModulateurStructures - as $tms) { ?> - <?php if ($tm->getId() == $tms->getTypeModulateur()->getId()) { ?> - <tr> - <td> - <?php if (($tms->getAnneeDebut()) || ($tms->getAnneeFin())) { - if (!$tms->getAnneeDebut()) { - $infoBulle = ' à ' . $tms->getAnneeFin(); - } else { - if (!$tms->getAnneeFin()) { - $infoBulle = ' de ' . $tms->getAnneeDebut(); - } else $infoBulle = ' de ' . $tms->getAnneeDebut() . ' à ' . $tms->getAnneeFin(); - } - } else $infoBulle = ''; ?> - <?php echo ($infoBulle ? '<abbr title="' . $infoBulle . '">' : '') . $tms->getStructure()->getLibelleCourt(); - echo($infoBulle ? '</abbr>' : ''); - if ($canEdit) { ?> - <a style="position:absolute; right:36px; " class="ajax-modal" data-event="modulateur-saisie" - href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId(),'typeModulateurStructure' => $tms->getId()]) ?>" - title="Ajouter un type de modulateur pour une structure"> - <span class="glyphicon glyphicon-edit"></span> - </a> - <a style="position:absolute; right:20px; " class="pop-ajax" - href="<?= $this->url('modulateur/type-modulateur-structure-delete', ['typeModulateurStructure' => $tms->getId()]) ?>" - title="Supprimer le type de modulateur pour la structure" - data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>" - data-confirm="true" - data-confirm-button="Oui" - data-cancel-button="Non" - data-submit-reload="true" - > - <span class="glyphicon glyphicon-remove"></span> - </a> - <?php } ?> - </td> - </tr> - <?php } - } ?> + <?php foreach ($typeModulateurStructures + as $tms) { ?> + <?php if (($tm->getId() == $tms->getTypeModulateur()->getId()) && ((!$tms->getAnneeDebut()) || ($tms->getAnneeDebut()->getId() <= $anneeId)) && ((!$tms->getAnneeFin()) || ($tms->getAnneeFin()->getId() >= $anneeId))) { ?> + <tr> + <td> + <?php if (($tms->getAnneeDebut()) || ($tms->getAnneeFin())) { + if (!$tms->getAnneeDebut()) { + $infoBulle = ' à ' . $tms->getAnneeFin(); + } else { + if (!$tms->getAnneeFin()) { + $infoBulle = ' de ' . $tms->getAnneeDebut(); + } else $infoBulle = ' de ' . $tms->getAnneeDebut() . ' à ' . $tms->getAnneeFin(); + } + } else $infoBulle = ''; ?> + <?php echo ($infoBulle ? '<abbr title="' . $infoBulle . '">' : '') . $tms->getStructure()->getLibelleCourt(); + echo($infoBulle ? '</abbr>' : ''); + if ($canEdit) { ?> + <a style="position:absolute; right:36px; " class="ajax-modal" + data-event="modulateur-saisie" + href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId(), 'typeModulateurStructure' => $tms->getId()]) ?>" + title="Ajouter un type de modulateur pour une structure"> + <span class="glyphicon glyphicon-edit"></span> + </a> + <a style="position:absolute; right:20px; " class="pop-ajax" + href="<?= $this->url('modulateur/type-modulateur-structure-delete', ['typeModulateurStructure' => $tms->getId()]) ?>" + title="Supprimer le type de modulateur pour la structure" + data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>" + data-confirm="true" + data-confirm-button="Oui" + data-cancel-button="Non" + data-submit-reload="true" + > + <span class="glyphicon glyphicon-remove"></span> + </a> + <?php } ?> + </td> + </tr> + <?php } + } ?> </table> <?php if ($canEdit) { ?> <a class="ajax-modal" data-event="modulateur-saisie" - href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId()]) ?>" - title="Ajouter un type de modulateur pour une structure"> - <button type="button" class="btn-xs btn-primary">Ajouter une structure</button> - </a> + href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId()]) ?>" + title="Ajouter un type de modulateur pour une structure"> + <button type="button" class="btn-xs btn-primary">Ajouter une structure</button> + </a> <?php } ?> </div> <div class="col-md-9"> -- GitLab