Loading module/Formation/src/Formation/Entity/Db/FormationGroupe.php +10 −55 Changes for module/Formation/src/Formation/Entity/Db/FormationGroupe.php: 10 added lines, 55 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Entity\Db\Interfaces\HasSourceInterface; use Application\Entity\Db\Traits\HasDescriptionTrait; use Application\Entity\Db\Traits\HasSourceTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface; use UnicaenUtilisateur\Entity\Db\HistoriqueAwareTrait; Loading @@ -18,11 +19,13 @@ class FormationGroupe implements HistoriqueAwareInterface, HasDescriptionInterfa private ?int $id = -1; private ?string $libelle = null; private ?string $couleur = null; /** @var string */ private $ordre; /** @var ArrayCollection (Formation) */ private $formations; private ?int $ordre = 0; private Collection $formations; public function __construct() { $this->formations = new ArrayCollection(); } public function getId() : int { Loading @@ -47,32 +50,14 @@ class FormationGroupe implements HistoriqueAwareInterface, HasDescriptionInterfa $this->libelle = $libelle; } public function getCouleur() : ?string { return $this->couleur; } public function setCouleur(?string $couleur) : void { $this->couleur = $couleur; } /** * @return string|null */ public function getOrdre() : ?string public function getOrdre() : ?int { return $this->ordre; } /** * @param string|null $ordre * @return FormationGroupe */ public function setOrdre(?string $ordre) : FormationGroupe public function setOrdre(?string $ordre) : void { $this->ordre = $ordre; return $this; } /** Loading @@ -83,34 +68,4 @@ class FormationGroupe implements HistoriqueAwareInterface, HasDescriptionInterfa return $this->formations->toArray(); } /** * @param Formation $formation * @return FormationGroupe */ public function addFormation(Formation $formation) : FormationGroupe { $this->formations->add($formation); return $this; } /** * @param Formation $formation * @return FormationGroupe */ public function removeFormation(Formation $formation) : FormationGroupe { $this->formations->removeElement($formation); return $this; } /** * @param Formation $formation * @return boolean */ public function hasFormation(Formation $formation) : bool { return $this->formations->contains($formation); } } No newline at end of file module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.FormationGroupe.dcm.xml −1 Changes for module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.FormationGroupe.dcm.xml: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ <field name="libelle" column="libelle" type="string" length="256" /> <field name="description" column="description" type="string" length="9999" /> <field name="couleur" column="couleur" type="string" length="256" /> <field name="ordre" column="ordre" type="integer" /> <one-to-many target-entity="Formation\Entity\Db\Formation" mapped-by="groupe" field="formations"/> Loading module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php −12 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php: 0 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -44,17 +44,6 @@ class FormationGroupeForm extends Form 'id' => 'ordre', ], ]); //couleur // $this->add([ // 'type' => Color::class, // 'name' => 'couleur', // 'options' => [ // 'label' => "Couleur :", // ], // 'attributes' => [ // 'id' => 'couleur', // ], // ]); //bouton $this->add([ 'type' => Button::class, Loading @@ -75,7 +64,6 @@ class FormationGroupeForm extends Form 'libelle' => ['required' => true,], 'description' => ['required' => false,], 'ordre' => ['required' => false,], // 'couleur' => [ 'required' => false, ], ])); } } No newline at end of file module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php +6 −6 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -17,8 +17,7 @@ class FormationGroupeHydrator implements HydratorInterface $data = [ 'libelle' => ($object->getLibelle()) ?: null, 'HasDescription' => ['description' => $object->getDescription()], 'ordre' => ($object->getOrdre()) ?: null, // 'couleur' => ($object->getCouleur())?:null, 'ordre' => ($object->getOrdre() !== null) ? $object->getOrdre(): null, ]; return $data; } Loading @@ -28,14 +27,15 @@ class FormationGroupeHydrator implements HydratorInterface * @param FormationGroupe $object * @return FormationGroupe */ public function hydrate(array $data, $object) public function hydrate(array $data, $object) : object { $libelle = (isset($data['libelle']) and trim($data['libelle']) !== '') ? trim($data['libelle']) : null; $description = (isset($data['HasDescription']) AND isset($data['HasDescription']['description']) && trim($data['HasDescription']['description']) != '')?trim($data['HasDescription']['description']):null; $ordre = (isset($data['ordre'])) ? $data['ordre'] : null; $object->setLibelle((isset($data['libelle']) and trim($data['libelle']) !== '') ? trim($data['libelle']) : null); $object->setLibelle($libelle); $object->setDescription($description); $object->setOrdre((isset($data['ordre']) and trim($data['ordre']) !== '') ? trim($data['ordre']) : null); // $object->setCouleur((isset($data['couleur']) AND trim($data['couleur']) !== '')?trim($data['couleur']):null); $object->setOrdre($ordre); return $object; } Loading module/Formation/view/formation/formation-groupe/index.phtml +29 −28 Changes for module/Formation/view/formation/formation-groupe/index.phtml: 29 added lines, 28 removed lines. Original line number Diff line number Diff line Loading @@ -19,33 +19,29 @@ $canDetruire = $this->isAllowed(FormationgroupePrivileges::getResourceId( $this->headTitle("Thèmes de formation"); ?> <div class="row"> <div class="col-md-8"> <h2 class="page-header"> Thèmes de formations </h2> </div> <div class="pull-right"> <h1 class="page-header"> Thèmes de formation </h1> <?php if ($canAjouter) : ?> <br/> <a <?php /** @see FormationGroupeController::ajouterGroupeAction() */ ?> href="<?php echo $this->url('formation-groupe/ajouter', [], [], true); ?>" class="btn btn-primary action ajax-modal" class="btn btn-primary ajax-modal" data-event="modification"> <span class="icon icon-ajouter"></span> Ajouter un thème </a> <?php endif; ?> </div> </div> <?php //echo $this->partial('partial/filtre',['historise' => $historise, 'source' => $source], [], true); ?> <?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?> <table class="datatable table table-condensed table-hover" id="groupes"> <thead> <tr> <th> Libellé </th> <th> Ordre </th> <th style="width: 10rem;"> #Formation </th> <th style="width: 14rem;"> Source </th> <th style="width: 9rem;"> Action </th> Loading @@ -54,17 +50,33 @@ $this->headTitle("Thèmes de formation"); <tbody> <?php foreach ($groupes as $groupe) : ?> <tr id="<?php echo $groupe->getId(); ?>" class="<?php if ($groupe->estHistorise()) echo "historise"; ?>"> <td> <?php echo $groupe->getLibelle(); ?> </td> <td> <?php echo count($groupe->getFormations()); ?> </td> <td> <span class="badge source <?php echo $groupe->getSource(); ?>" id="<?php echo $groupe->getSource(); ?>"><?php echo $groupe->getSource(); ?></span> </td> <td> <td> <!-- LIBELLE --> <?php echo $groupe->getLibelle(); ?> <?php if ($groupe->getDescription() !== null) : ?> <span class="icon icon-info" title="<?php echo $groupe->getDescription(); ?>" data-toggle="tooltip" data-html="true"> </span> <?php endif; ?> </td> <td> <!-- ORDRE --> <?php echo $groupe->getOrdre(); ?> </td> <td> <!-- NB FORMATION --> <?php echo count($groupe->getFormations()); ?> </td> <td> <!-- SOURCE --> <span class="badge source <?php echo $groupe->getSource(); ?>" id="<?php echo $groupe->getSource(); ?>"> <?php echo $groupe->getSource(); ?> <?php echo $groupe->getIdSource(); ?> </span> </td> <td class="action"> <!-- ACTION --> <?php if ($canAfficher) : ?> <a <?php /** @see FormationGroupeController::afficherGroupeAction() */ ?> href="<?php echo $this->url('formation-groupe/afficher', ['formation-groupe' => $groupe->getId()], [], true); ?>" class="ajax-modal"> <span class="icon icon-voir" title="Afficher le thème"></span></a> <?php else : ?> <span class="icon icon-voir" style="color:lightgrey;"></span> <?php endif; ?> <?php if ($canEditer) : ?> <a Loading @@ -74,8 +86,6 @@ $this->headTitle("Thèmes de formation"); data-event="modification" > <span class="icon icon-editer" title="Modifier le thème"></span></a> <?php else : ?> <span class="icon icon-editer" style="color:lightgrey;"></span> <?php endif; ?> <?php if ($canHistoriser) : ?> <?php if ($groupe->estNonHistorise()) : ?> Loading @@ -85,19 +95,12 @@ $this->headTitle("Thèmes de formation"); > <span class="icon icon-historiser" title="Supprimer le thème"></span></a> <?php else : ?> <a <?php /** @see FormationGroupeController::restaurerGroupeAction() */ ?> href="<?php echo $this->url('formation-groupe/restaurer', ['formation-groupe' => $groupe->getId()], [], true); ?>" > <span class="icon icon-restaurer" title="Restaurer le thème"></span></a> <?php endif; ?> <?php else : ?> <?php if ($groupe->estNonHistorise()) : ?> <span class="icon icon-historiser" style="color:lightgrey;"></span> <?php else : ?> <span class="icon icon-restaurer" style="color:lightgrey;"></span> <?php endif; ?> <?php endif; ?> <?php if ($canDetruire AND $groupe->estHistorise()) : ?> <a Loading @@ -106,8 +109,6 @@ $this->headTitle("Thèmes de formation"); class="ajax-modal" data-event="modification" > <span class="icon icon-retirer text-danger" title="Supprimer définitivement le thème"></span></a> <?php else : ?> <span class="icon icon-retirer" style="color:lightgrey;"></span> <?php endif; ?> </td> </tr> Loading Loading
module/Formation/src/Formation/Entity/Db/FormationGroupe.php +10 −55 Changes for module/Formation/src/Formation/Entity/Db/FormationGroupe.php: 10 added lines, 55 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Entity\Db\Interfaces\HasSourceInterface; use Application\Entity\Db\Traits\HasDescriptionTrait; use Application\Entity\Db\Traits\HasSourceTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface; use UnicaenUtilisateur\Entity\Db\HistoriqueAwareTrait; Loading @@ -18,11 +19,13 @@ class FormationGroupe implements HistoriqueAwareInterface, HasDescriptionInterfa private ?int $id = -1; private ?string $libelle = null; private ?string $couleur = null; /** @var string */ private $ordre; /** @var ArrayCollection (Formation) */ private $formations; private ?int $ordre = 0; private Collection $formations; public function __construct() { $this->formations = new ArrayCollection(); } public function getId() : int { Loading @@ -47,32 +50,14 @@ class FormationGroupe implements HistoriqueAwareInterface, HasDescriptionInterfa $this->libelle = $libelle; } public function getCouleur() : ?string { return $this->couleur; } public function setCouleur(?string $couleur) : void { $this->couleur = $couleur; } /** * @return string|null */ public function getOrdre() : ?string public function getOrdre() : ?int { return $this->ordre; } /** * @param string|null $ordre * @return FormationGroupe */ public function setOrdre(?string $ordre) : FormationGroupe public function setOrdre(?string $ordre) : void { $this->ordre = $ordre; return $this; } /** Loading @@ -83,34 +68,4 @@ class FormationGroupe implements HistoriqueAwareInterface, HasDescriptionInterfa return $this->formations->toArray(); } /** * @param Formation $formation * @return FormationGroupe */ public function addFormation(Formation $formation) : FormationGroupe { $this->formations->add($formation); return $this; } /** * @param Formation $formation * @return FormationGroupe */ public function removeFormation(Formation $formation) : FormationGroupe { $this->formations->removeElement($formation); return $this; } /** * @param Formation $formation * @return boolean */ public function hasFormation(Formation $formation) : bool { return $this->formations->contains($formation); } } No newline at end of file
module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.FormationGroupe.dcm.xml −1 Changes for module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.FormationGroupe.dcm.xml: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ <field name="libelle" column="libelle" type="string" length="256" /> <field name="description" column="description" type="string" length="9999" /> <field name="couleur" column="couleur" type="string" length="256" /> <field name="ordre" column="ordre" type="integer" /> <one-to-many target-entity="Formation\Entity\Db\Formation" mapped-by="groupe" field="formations"/> Loading
module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php −12 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php: 0 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -44,17 +44,6 @@ class FormationGroupeForm extends Form 'id' => 'ordre', ], ]); //couleur // $this->add([ // 'type' => Color::class, // 'name' => 'couleur', // 'options' => [ // 'label' => "Couleur :", // ], // 'attributes' => [ // 'id' => 'couleur', // ], // ]); //bouton $this->add([ 'type' => Button::class, Loading @@ -75,7 +64,6 @@ class FormationGroupeForm extends Form 'libelle' => ['required' => true,], 'description' => ['required' => false,], 'ordre' => ['required' => false,], // 'couleur' => [ 'required' => false, ], ])); } } No newline at end of file
module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php +6 −6 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -17,8 +17,7 @@ class FormationGroupeHydrator implements HydratorInterface $data = [ 'libelle' => ($object->getLibelle()) ?: null, 'HasDescription' => ['description' => $object->getDescription()], 'ordre' => ($object->getOrdre()) ?: null, // 'couleur' => ($object->getCouleur())?:null, 'ordre' => ($object->getOrdre() !== null) ? $object->getOrdre(): null, ]; return $data; } Loading @@ -28,14 +27,15 @@ class FormationGroupeHydrator implements HydratorInterface * @param FormationGroupe $object * @return FormationGroupe */ public function hydrate(array $data, $object) public function hydrate(array $data, $object) : object { $libelle = (isset($data['libelle']) and trim($data['libelle']) !== '') ? trim($data['libelle']) : null; $description = (isset($data['HasDescription']) AND isset($data['HasDescription']['description']) && trim($data['HasDescription']['description']) != '')?trim($data['HasDescription']['description']):null; $ordre = (isset($data['ordre'])) ? $data['ordre'] : null; $object->setLibelle((isset($data['libelle']) and trim($data['libelle']) !== '') ? trim($data['libelle']) : null); $object->setLibelle($libelle); $object->setDescription($description); $object->setOrdre((isset($data['ordre']) and trim($data['ordre']) !== '') ? trim($data['ordre']) : null); // $object->setCouleur((isset($data['couleur']) AND trim($data['couleur']) !== '')?trim($data['couleur']):null); $object->setOrdre($ordre); return $object; } Loading
module/Formation/view/formation/formation-groupe/index.phtml +29 −28 Changes for module/Formation/view/formation/formation-groupe/index.phtml: 29 added lines, 28 removed lines. Original line number Diff line number Diff line Loading @@ -19,33 +19,29 @@ $canDetruire = $this->isAllowed(FormationgroupePrivileges::getResourceId( $this->headTitle("Thèmes de formation"); ?> <div class="row"> <div class="col-md-8"> <h2 class="page-header"> Thèmes de formations </h2> </div> <div class="pull-right"> <h1 class="page-header"> Thèmes de formation </h1> <?php if ($canAjouter) : ?> <br/> <a <?php /** @see FormationGroupeController::ajouterGroupeAction() */ ?> href="<?php echo $this->url('formation-groupe/ajouter', [], [], true); ?>" class="btn btn-primary action ajax-modal" class="btn btn-primary ajax-modal" data-event="modification"> <span class="icon icon-ajouter"></span> Ajouter un thème </a> <?php endif; ?> </div> </div> <?php //echo $this->partial('partial/filtre',['historise' => $historise, 'source' => $source], [], true); ?> <?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?> <table class="datatable table table-condensed table-hover" id="groupes"> <thead> <tr> <th> Libellé </th> <th> Ordre </th> <th style="width: 10rem;"> #Formation </th> <th style="width: 14rem;"> Source </th> <th style="width: 9rem;"> Action </th> Loading @@ -54,17 +50,33 @@ $this->headTitle("Thèmes de formation"); <tbody> <?php foreach ($groupes as $groupe) : ?> <tr id="<?php echo $groupe->getId(); ?>" class="<?php if ($groupe->estHistorise()) echo "historise"; ?>"> <td> <?php echo $groupe->getLibelle(); ?> </td> <td> <?php echo count($groupe->getFormations()); ?> </td> <td> <span class="badge source <?php echo $groupe->getSource(); ?>" id="<?php echo $groupe->getSource(); ?>"><?php echo $groupe->getSource(); ?></span> </td> <td> <td> <!-- LIBELLE --> <?php echo $groupe->getLibelle(); ?> <?php if ($groupe->getDescription() !== null) : ?> <span class="icon icon-info" title="<?php echo $groupe->getDescription(); ?>" data-toggle="tooltip" data-html="true"> </span> <?php endif; ?> </td> <td> <!-- ORDRE --> <?php echo $groupe->getOrdre(); ?> </td> <td> <!-- NB FORMATION --> <?php echo count($groupe->getFormations()); ?> </td> <td> <!-- SOURCE --> <span class="badge source <?php echo $groupe->getSource(); ?>" id="<?php echo $groupe->getSource(); ?>"> <?php echo $groupe->getSource(); ?> <?php echo $groupe->getIdSource(); ?> </span> </td> <td class="action"> <!-- ACTION --> <?php if ($canAfficher) : ?> <a <?php /** @see FormationGroupeController::afficherGroupeAction() */ ?> href="<?php echo $this->url('formation-groupe/afficher', ['formation-groupe' => $groupe->getId()], [], true); ?>" class="ajax-modal"> <span class="icon icon-voir" title="Afficher le thème"></span></a> <?php else : ?> <span class="icon icon-voir" style="color:lightgrey;"></span> <?php endif; ?> <?php if ($canEditer) : ?> <a Loading @@ -74,8 +86,6 @@ $this->headTitle("Thèmes de formation"); data-event="modification" > <span class="icon icon-editer" title="Modifier le thème"></span></a> <?php else : ?> <span class="icon icon-editer" style="color:lightgrey;"></span> <?php endif; ?> <?php if ($canHistoriser) : ?> <?php if ($groupe->estNonHistorise()) : ?> Loading @@ -85,19 +95,12 @@ $this->headTitle("Thèmes de formation"); > <span class="icon icon-historiser" title="Supprimer le thème"></span></a> <?php else : ?> <a <?php /** @see FormationGroupeController::restaurerGroupeAction() */ ?> href="<?php echo $this->url('formation-groupe/restaurer', ['formation-groupe' => $groupe->getId()], [], true); ?>" > <span class="icon icon-restaurer" title="Restaurer le thème"></span></a> <?php endif; ?> <?php else : ?> <?php if ($groupe->estNonHistorise()) : ?> <span class="icon icon-historiser" style="color:lightgrey;"></span> <?php else : ?> <span class="icon icon-restaurer" style="color:lightgrey;"></span> <?php endif; ?> <?php endif; ?> <?php if ($canDetruire AND $groupe->estHistorise()) : ?> <a Loading @@ -106,8 +109,6 @@ $this->headTitle("Thèmes de formation"); class="ajax-modal" data-event="modification" > <span class="icon icon-retirer text-danger" title="Supprimer définitivement le thème"></span></a> <?php else : ?> <span class="icon icon-retirer" style="color:lightgrey;"></span> <?php endif; ?> </td> </tr> Loading