Administration » Historique » Version 11
Ludovic Lestrat, 24/04/2018 16:37
1 | 1 | Ludovic Lestrat | h1. Mode équipe |
---|---|---|---|
2 | |||
3 | Pour permettre aux utilisateurs de voir les observations des autres utilisateurs sans pour autant les modifier il faut modifier le fichier : |
||
4 | 5 | Ludovic Lestrat | -Modeles\Filtres\fAppli.php- /Sources/Configuration/[production]/[nom_instance]/Filtres/fAppli.php des Sources |
5 | 1 | Ludovic Lestrat | |
6 | 6 | Ludovic Lestrat | -Commenter la ligne comme ceci : |
7 | 1 | Ludovic Lestrat | if (($droit != 'expert') && ($droit != 'admin')) { |
8 | //$filter .= ' AND numerisateur = ' . decrypteRSA(APPLI, $_SESSION[APPLI]['numerisateur']['code']); |
||
9 | 7 | Ludovic Lestrat | }- |
10 | 6 | Ludovic Lestrat | |
11 | Décommenter le cas que l'on veut mettre en place |
||
12 | 8 | Ludovic Lestrat | |
13 | h1. Ajustement de l'outil "Filtre sur emprise" |
||
14 | |||
15 | 9 | Ludovic Lestrat | Pour éviter une montée en charge du CPU lié à l'utilisation de cet outil, il faut modifier deux fichiers comme indiqué sur les pages github : |
16 | 8 | Ludovic Lestrat | - Environnement/Outils/FiltreCarte.php : https://github.com/mathieubossaert/obs_occ/commit/6a1a7afc30cb01f97d7de5a1e5811b665c32c2ab |
17 | - Sources/Configuration/ConfigUtilisee.php : https://github.com/mathieubossaert/obs_occ/commit/a029fb9206edc9e430c1a0466987e55087bf3347#diff-7be1b306267c9f2d4fc3deb5a0b2c3dc |
||
18 | 10 | Ludovic Lestrat | |
19 | h1. Optimisation Observateurs et structure |
||
20 | |||
21 | Pour améliorer le temps de filtrage dans l'interface de SICEN Web sur les observateurs et les structures, voici les modifications à apporter. |
||
22 | |||
23 | h2. En base : |
||
24 | |||
25 | <pre> |
||
26 | ALTER TABLE saisie.saisie_observation ADD COLUMN observateurs_pour_tri text; |
||
27 | ALTER TABLE saisie.saisie_observation ADD COLUMN structures_pour_tri text; |
||
28 | ALTER TABLE saisie.suivi_saisie_observation ADD COLUMN observateurs_pour_tri text; |
||
29 | ALTER TABLE saisie.suivi_saisie_observation ADD COLUMN structures_pour_tri text; |
||
30 | |||
31 | CREATE INDEX observateurs_pour_tri_index |
||
32 | ON saisie.saisie_observation |
||
33 | USING gist |
||
34 | (observateurs_pour_tri COLLATE pg_catalog."default" gist_trgm_ops); |
||
35 | |||
36 | CREATE INDEX structures_pour_tri_index |
||
37 | ON saisie.saisie_observation |
||
38 | USING gist |
||
39 | (structures_pour_tri COLLATE pg_catalog."default" gist_trgm_ops); |
||
40 | |||
41 | CREATE OR REPLACE FUNCTION saisie.alimente_observateurs_pour_tri() |
||
42 | RETURNS trigger AS |
||
43 | $BODY$ |
||
44 | BEGIN |
||
45 | NEW.observateurs_pour_tri = md.liste_nom_auteur(NEW.observateur); |
||
46 | RETURN NEW; |
||
47 | END; |
||
48 | $BODY$ |
||
49 | LANGUAGE plpgsql VOLATILE |
||
50 | COST 100; |
||
51 | |||
52 | CREATE TRIGGER alim_observateurs_pour_tri |
||
53 | BEFORE INSERT OR UPDATE OF observateur |
||
54 | ON saisie.saisie_observation |
||
55 | FOR EACH ROW |
||
56 | EXECUTE PROCEDURE saisie.alimente_observateurs_pour_tri(); |
||
57 | |||
58 | CREATE OR REPLACE FUNCTION saisie.alimente_structures_pour_tri() |
||
59 | RETURNS trigger AS |
||
60 | $BODY$ |
||
61 | BEGIN |
||
62 | NEW.structures_pour_tri = md.liste_nom_structure(NEW.structure); |
||
63 | RETURN NEW; |
||
64 | END; |
||
65 | $BODY$ |
||
66 | LANGUAGE plpgsql VOLATILE |
||
67 | COST 100; |
||
68 | |||
69 | CREATE TRIGGER alim_structures_pour_tri |
||
70 | BEFORE INSERT OR UPDATE OF structure |
||
71 | ON saisie.saisie_observation |
||
72 | FOR EACH ROW |
||
73 | EXECUTE PROCEDURE saisie.alimente_structures_pour_tri(); |
||
74 | |||
75 | UPDATE saisie.saisie_observation SET structures_pour_tri = md.liste_nom_structure(structure), observateurs_pour_tri = md.liste_nom_auteur(observateur); |
||
76 | </pre> |
||
77 | |||
78 | |||
79 | h2. Dans l'appli : |
||
80 | |||
81 | h3. Dans Modeles/Adaptations/fGrille.php : |
||
82 | <pre> |
||
83 | [[// $where = str_replace(' observat ', ' md.liste_nom_auteur(observateur) ', $where); |
||
84 | $where = str_replace(' observat ', ' observateurs_pour_tri ', $where); |
||
85 | // $where = str_replace(' struct ', ' md.liste_nom_structure(structure) ', $where); |
||
86 | $where = str_replace(' struct ', ' stuctures_pour_tri ', $where);]] |
||
87 | </pre> |
||
88 | |||
89 | h3. Dans Modeles/GeoJson/gjObs.php : |
||
90 | |||
91 | - remplacer les appels à md.liste_nom_structure(structure) par structures_pour_tri |
||
92 | - remplacer les appels à md.liste_nom_auteur(observateur) par observateurs_pour_tri |
||
93 | 11 | Ludovic Lestrat | |
94 | h1. Gestion des tri ET des filtres dans l'interface |
||
95 | |||
96 | Afin que les tris restent opérationnels dans le tableau de l'interface, même si un filtre est présent sur un champ, il faut effectuer la modification suivante dans le fichier Sources/Modeles/GeoJson/gjObs.php : |
||
97 | <pre> |
||
98 | if ($limit !== 'AUCUNE') { |
||
99 | $row_number = $start + 1 +$limit; |
||
100 | $req .= 'WHERE row_number > ' . $start . ' AND row_number < ' . $row_number; |
||
101 | $req .= 'order by ' . $sort . ' ' . $dir . ' NULLS LAST;'; // ligne à ajouter |
||
102 | Cf : https://github.com/mathieubossaert/obs_occ/blob/4dfbf9a56b97d9243ad2263d60dda838c8fdbab6/Sources/Modeles/GeoJson/gjObs.php#L45 |
||
103 | </pre> |