Commit 91bed931 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Perimetre multiple

parent 86e80e25
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ create table unicaen_indicateur_categorie
    libelle     varchar(1024)        not null,
    ordre       integer default 9999 not null,
    description text
);s
);

create table unicaen_indicateur_indicateur
(
@@ -29,7 +29,8 @@ create table unicaen_indicateur_indicateur
    nb_elements              integer,
    categorie_id             integer
        constraint uii_unicaen_indicateur_categorie_id_fk
            references unicaen_indicateur_categorie
            references unicaen_indicateur_categorie,
    perimetre                varchar(256)
);
create unique index indicateur_id_uindex
    on unicaen_indicateur_indicateur (id);
+1 −2
Original line number Diff line number Diff line
@@ -62,6 +62,5 @@ Par exemple pour les périmètres de structure 5 et 12 et de domaine 1 cette mé

Améliorations
-------------
1. **PERIMÈTRE**  Exposer plusieurs périmètres
1. **SECURITE**  Verifier qu'il n'y est que des selects
1. **QoL**  Coloration tinyMCE 
 No newline at end of file
1. **QoL**  Coloration tinyMCE de la requete SQL
 No newline at end of file
+8 −6
Original line number Diff line number Diff line
@@ -130,14 +130,15 @@ class IndicateurForm extends Form {
            'type' => Select::class,
            'name' => 'perimetre',
            'options' => [
                'label' => "Périmètre associé <span class='icon icon-obligatoire' title='champ obligatoire'></span>  :",
                'label' => "Périmètres associés  <span class='icon icon-information text-info' title='Sélection multiple possible'></span>  :",
                'label_options' => [ 'disable_html_escape' => true, ],
                'empty_option' => "Sélection des périmètres",
                'value_options' => $this->perimetres,
            ],
            'attributes' => [
                'id' => 'perimetre',
                'class' => 'bootstrap-selectpicker show-tick',
                'class' => 'selectpicker show-tick',
                'multiple' => 'multiple',
            ],
        ]);
        // requete
@@ -145,7 +146,8 @@ class IndicateurForm extends Form {
            'name' => 'requete',
            'type' => 'textarea',
            'options' => [
                'label' => 'Requête* : ',
                'label' => "Requête <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ",
                'label_options' => [ 'disable_html_escape' => true, ],
                'label_attributes' => [
                    'class' => 'control-label',
                ],
@@ -198,7 +200,7 @@ class IndicateurForm extends Form {
            'namespace'             => [ 'required' => false,  ],
            'view_id'               => [ 'required' => true,  ],
            'entity'                => [ 'required' => true,  ],
            'perimetre'             => [ 'required' => true,  ],
            'perimetre'             => [ 'required' => false,  ],
            'requete'               => [ 'required' => true,  ],
        ]));
    }
+6 −3
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ namespace UnicaenIndicateur\Form\Indicateur;
use UnicaenIndicateur\Entity\Db\Indicateur;
use Laminas\Hydrator\HydratorInterface;
use UnicaenIndicateur\Service\Categorie\CategorieServiceAwareTrait;
use UnicaenIndicateur\Service\Perimetre\PerimetreServiceInterface;

class IndicateurHydrator implements HydratorInterface {
    use CategorieServiceAwareTrait;
@@ -20,7 +21,7 @@ class IndicateurHydrator implements HydratorInterface {
            'namespace' => $object->getNamespace(),
            'view_id' => $object->getViewId(),
            'entity' => $object->getEntity(),
            'perimetre' => $object->getPerimetre(),
            'perimetre' => ($object->getPerimetre())?explode(PerimetreServiceInterface::PERIMETRE_SEPARATOR, $object->getPerimetre()):null,
            'requete' => $object->getRequete(),
        ];
        return $data;
@@ -31,7 +32,9 @@ class IndicateurHydrator implements HydratorInterface {
        $code = (isset($data['code']) AND trim($data['code']) !== '')?trim($data['code']):null;
        $categorie = (isset($data['categorie']) && $data['categorie'] !== '')?$this->getCategorieService()->getCategorie($data['categorie']):null;
        $namespace = (isset($data['namespace']) AND trim($data['namespace']) !== '')?trim($data['namespace']):null;
        $perimetre = (isset($data['perimetre']) AND trim($data['perimetre']) !== '')?trim($data['perimetre']):null;

        $perimetres = isset($data['perimetre'])?implode(PerimetreServiceInterface::PERIMETRE_SEPARATOR, $data['perimetre']):null;
        //HERE I AM// $perimetreIds = (isset($data['perimetre']) AND ($data['perimetre']) !== '')?explode(PerimetreServiceInterface::PERIMETRE_SEPARATOR, $data['perimetre']):null;

        /** @var Indicateur $object */
        $object->setCode($code);
@@ -39,7 +42,7 @@ class IndicateurHydrator implements HydratorInterface {
        $object->setDescription($data['description']);
        $object->setCategorie($categorie);
        $object->setNamespace($namespace);
        $object->setPerimetre($perimetre);
        $object->setPerimetre($perimetres);
        $object->setViewId($data['view_id']);
        $object->setEntity($data['entity']);
        $object->setRequete($data['requete']);