Commit 3ed3b177 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout d'éléments descriptifs des actions de formation : type, objectifs, programme

parent c592e439
Loading
Loading
Loading
Loading
+8 −1
Changes for documentation/release/3.0.1.md: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
**CHANGES version 3.0.1**

* Ajout d'éléments descriptifs des actions de formation : type, objectifs, programme
* Ajout d'un état annulé aux événements afin de faciliter la gestion 
* Ajout d'un filtre sur les événements pour réduire l'affichage.
* Ajout de mots clefs aux événements pour les lier à des entités de la même façon que les mails ou les rendus.  

```sql
INSERT INTO unicaen_evenement_etat (CODE, LIBELLE, DESCRIPTION) VALUES ('annule', 'Événement dont le traitement a été annulé', null);
-- partie SESSION
alter table formation add type varchar(64);
alter table formation add objectifs text;
alter table formation add programme text;


-- partie EVENEMENT 
INSERT INTO unicaen_evenement_etat (CODE, LIBELLE, DESCRIPTION) VALUES ('annule', 'Événement dont le traitement a été annulé', null);
alter table unicaen_evenement_instance add mots_clefs text;
```
 No newline at end of file
+46
Changes for module/Formation/src/Formation/Entity/Db/Formation.php: 46 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,12 +30,26 @@ class Formation implements HistoriqueAwareInterface,
    const RATTACHEMENT_PREVENTION = 'prévention';
    const RATTACHEMENT_BIBLIOTHEQUE = 'bibliotheque';

    const TYPE_PRESENTIEL = 'Présentiel';
    const TYPE_DISTANCIEL = 'Distanciel';
    const TYPE_MIXTE      = 'Mixte';
    const TYPES = [
        Formation::TYPE_PRESENTIEL => 'Formation en présentiel',
        Formation::TYPE_DISTANCIEL => 'Formation en distanciel',
        Formation::TYPE_MIXTE => 'Formation en présentiel/distanciel'
    ];

    private ?int $id = -1;
    private ?string $libelle = null;
    private ?string $lien = null;
    private ?FormationGroupe $groupe = null;
    private bool $affichage = true;

    // information sur l'action de formation
    private ?string $type = null;
    private ?string $objectifs = null;
    private ?string $programme = null;

    private Collection $missions;
    private Collection $instances;
    private Collection $abonnements;
@@ -203,6 +217,38 @@ class Formation implements HistoriqueAwareInterface,
        $this->rattachement = $rattachement;
    }

    /** INFORMATION SUR L'ACTION DE FORMATION *************************************************************************/

    public function getType(): ?string
    {
        return $this->type;
    }

    public function setType(?string $type): void
    {
        $this->type = $type;
    }

    public function getObjectifs(): ?string
    {
        return $this->objectifs;
    }

    public function setObjectifs(?string $objectifs): void
    {
        $this->objectifs = $objectifs;
    }

    public function getProgramme(): ?string
    {
        return $this->programme;
    }

    public function setProgramme(?string $programme): void
    {
        $this->programme = $programme;
    }

    /** Formation Instances *******************************************************************************************/

    /**
+4
Changes for module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.Formation.dcm.xml: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@
            <join-column name="groupe_id" referenced-column-name="id"/>
        </many-to-one>

        <field name="type"            column="type"             type="string" length="64"/>
        <field name="objectifs"       column="objectifs"        type="string" />
        <field name="programme"       column="programme"        type="string" />

        <one-to-many field="instances" target-entity="Formation\Entity\Db\FormationInstance" mapped-by="formation"/>
        <one-to-many field="abonnements" target-entity="Formation\Entity\Db\FormationAbonnement" mapped-by="formation"/>

+50 −5
Changes for module/Formation/src/Formation/Form/Formation/FormationForm.php: 50 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Laminas\Form\Element\Button;
use Laminas\Form\Element\Radio;
use Laminas\Form\Element\Select;
use Laminas\Form\Element\Text;
use Laminas\Form\Element\Textarea;
use Laminas\Form\Form;
use Laminas\InputFilter\Factory;

@@ -24,7 +25,8 @@ class FormationForm extends Form
            'type' => Text::class,
            'name' => 'libelle',
            'options' => [
                'label' => "Libelle :",
                'label' => "Libelle <span class='icon icon-obligatoire' title='Champ obligatoire'></span> :",
                'label_options' => [ 'disable_html_escape' => true, ],
            ],
            'attributes' => [
                'id' => 'libelle',
@@ -56,6 +58,48 @@ class FormationForm extends Form
                'id' => 'description',
            ],
        ]);
        //type
        $this->add([
            'name' => 'type',
            'type' => Select::class,
            'options' => [
                'label' => "Modalité de présence/formation <span class='icon icon-obligatoire' title='Champ obligatoire'></span> :",
                'label_options' => [ 'disable_html_escape' => true, ],
                'label_attributes' => [ 'class' => 'control-label', ],
                'empty_option' => 'Sélectionner un mode ...',
                'value_options' => Formation::TYPES,
            ],
            'attributes' => [
                'class' => 'description form-control show-tick',
                'data-live-search'  => 'true',
                'style' => 'height:300px;',
            ]
        ]);
        //objectifs
        $this->add([
            'type' => Textarea::class,
            'name' => 'objectifs',
            'options' => [
                'label' => "Objectif :",
            ],
            'attributes' => [
                'id' => 'objectifs',
                'class' => 'type2 form-control',
            ],
        ]);
        //programme
        $this->add([
            'type' => Textarea::class,
            'name' => 'programme',
            'options' => [
                'label' => "Programme :",
            ],
            'attributes' => [
                'id' => 'programme',
                'class' => 'type2 form-control',
            ],
        ]);

        //lien
        $this->add([
            'type' => Text::class,
@@ -73,7 +117,7 @@ class FormationForm extends Form
            'type' => Radio::class,
            'name' => 'affichage',
            'options' => [
                'label' => "Affichage dans le 'plan de formation à venir'  <span class='icon obligatoire' title='Champ obligatoire'></span> :",
                'label' => "Affichage dans le 'plan de formation à venir'  <span class='icon icon-obligatoire' title='Champ obligatoire'></span> :",
                'label_options' => [ 'disable_html_escape' => true, ],
                'value_options' => [
                    true => "Oui",
@@ -106,9 +150,7 @@ class FormationForm extends Form
            'name' => 'creer',
            'options' => [
                'label' => '<i class="fas fa-save"></i> Enregistrer l\'activité',
                'label_options' => [
                    'disable_html_escape' => true,
                ],
                'label_options' => [ 'disable_html_escape' => true, ],
            ],
            'attributes' => [
                'type' => 'submit',
@@ -124,6 +166,9 @@ class FormationForm extends Form
            'lien' => ['required' => false,],
            'affichage' => ['required' => true,],
            'rattachement' => ['required' => false,],
            'type' => ['required' => true,],
            'objectifs' => ['required' => false,],
            'programme' => ['required' => false,],
        ]));
    }
}
 No newline at end of file
+13 −1
Changes for module/Formation/src/Formation/Form/Formation/FormationHydrator.php: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -23,6 +23,11 @@ class FormationHydrator implements HydratorInterface
            'groupe' => ($object->getGroupe()) ? $object->getGroupe()->getId() : null,
            'affichage' => $object->getAffichage(),
            'rattachement' => $object->getRattachement(),

            'type' => $object->getType(),
            'objectifs' => $object->getObjectifs(),
            'programme' => $object->getProgramme(),

        ];

        return $data;
@@ -33,12 +38,15 @@ class FormationHydrator implements HydratorInterface
     * @param Formation $object
     * @return Formation
     */
    public function hydrate(array $data, $object)
    public function hydrate(array $data,object $object) : object
    {
        $groupe = (isset($data['groupe']) && $data['groupe'] !== "") ? $this->getFormationGroupeService()->getFormationGroupe($data['groupe']) : null;
        $description = (isset($data['HasDescription']) AND isset($data['HasDescription']['description']) && trim($data['HasDescription']['description']) != '')?trim($data['HasDescription']['description']):null;
        $affichage = !((isset($data['affichage']) and $data['affichage'] === '0'));
        $rattachement = $data['rattachement'] ?? null;
        $type = $data['type'] ?? null;
        $objectifs = $data['objectifs'] ?? null;
        $programme = $data['programme'] ?? null;

        $object->setLibelle($data['libelle']);
        $object->setDescription($description);
@@ -46,6 +54,10 @@ class FormationHydrator implements HydratorInterface
        $object->setGroupe($groupe);
        $object->setAffichage($affichage);
        $object->setRattachement($rattachement);

        $object->setType($type);
        $object->setObjectifs($objectifs);
        $object->setProgramme($programme);
        return $object;
    }

Loading