[PLUGINS] +clavettes et dependances
[lhc/web/clavette_www.git] / www / plugins / gis / base / gis.php
1 <?php
2
3 if (!defined("_ECRIRE_INC_VERSION")) return;
4
5 function gis_declarer_tables_interfaces($interface){
6 $interface['table_des_tables']['gis'] = 'gis';
7 $interface['table_des_tables']['gis_liens'] = 'gis_liens';
8
9 // Traitements typo et raccourcis
10 $interface['table_des_traitements']['TITRE_GIS'][] = 'typo(extraire_multi(%s))';
11 $interface['table_des_traitements']['DESCRIPTIF_GIS'][] = _TRAITEMENT_RACCOURCIS;
12 $interface['table_des_traitements']['VILLE_GIS'][] = 'typo(extraire_multi(%s))';
13 $interface['table_des_traitements']['PAYS_GIS'][] = 'typo(extraire_multi(%s))';
14 $interface['table_des_traitements']['REGION_GIS'][] = 'typo(extraire_multi(%s))';
15 $interface['table_des_traitements']['DEPARTEMENT_GIS'][] = 'typo(extraire_multi(%s))';
16 $interface['table_des_traitements']['VILLE'][] = 'typo(extraire_multi(%s))';
17 $interface['table_des_traitements']['PAYS'][] = 'typo(extraire_multi(%s))';
18 $interface['table_des_traitements']['REGION'][] = 'typo(extraire_multi(%s))';
19 $interface['table_des_traitements']['DEPARTEMENT'][] = 'typo(extraire_multi(%s))';
20
21 return $interface;
22 }
23
24 function gis_declarer_tables_objets_sql($tables){
25 /* Declaration de la table de points gis */
26 $tables['spip_gis'] = array(
27 /* Declarations principales */
28 'table_objet' => 'gis',
29 'table_objet_surnoms' => array('gis'),
30 'type' => 'gis',
31 'type_surnoms' => array('gi'),
32
33 /* La table */
34 'field' => array(
35 "id_gis" => "bigint(21) NOT NULL",
36 "titre" => "text NOT NULL DEFAULT ''",
37 "descriptif" => "text NOT NULL DEFAULT ''",
38 "lat" => "double NULL NULL",
39 "lon" => "double NULL NULL",
40 "zoom" => "tinyint(4) NULL NULL",
41 "adresse" => "text NOT NULL DEFAULT ''",
42 "pays" => "text NOT NULL DEFAULT ''",
43 "code_pays" => "varchar(255) NOT NULL DEFAULT ''",
44 "region" => "text NOT NULL DEFAULT ''",
45 "departement" => "text NOT NULL DEFAULT ''",
46 "ville" => "text NOT NULL DEFAULT ''",
47 "code_postal" => "varchar(255) NOT NULL DEFAULT ''"
48 ),
49 'key' => array(
50 "PRIMARY KEY" => "id_gis",
51 'KEY lat' => 'lat',
52 'KEY lon' => 'lon',
53 'KEY pays' => 'pays(500)',
54 'KEY code_pays' => 'code_pays',
55 'KEY region' => 'region(500)',
56 'KEY departement' => 'departement(500)',
57 'KEY ville' => 'ville(500)',
58 'KEY code_postal' => 'code_postal',
59 ),
60 'join' => array(
61 "id_gis"=>"id_gis"
62 ),
63 'principale' => 'oui',
64 'modeles' => array('carte_gis', 'carte_gis_preview'),
65
66 /* Le titre, la date et la gestion du statut */
67 'titre' => "titre, '' AS lang",
68
69 /* L'édition, l'affichage et la recherche */
70 'page' => false,
71 'url_voir' => 'gis',
72 'url_edit' => 'gis_edit',
73 'editable' => 'oui',
74 'champs_editables' => array('lat', 'lon', 'zoom', 'titre', 'descriptif', 'adresse', 'code_postal', 'ville', 'region', 'departement', 'pays', 'code_pays'),
75 'champs_versionnes' => array('lat', 'lon', 'zoom', 'titre', 'descriptif', 'adresse', 'code_postal', 'ville', 'region', 'departement', 'pays', 'code_pays'),
76 'icone_objet' => 'gis',
77 'rechercher_champs' => array(
78 'titre' => 8,
79 'descriptif' => 5,
80 'pays' => 3,
81 'region' => 3,
82 'departement' => 3,
83 'ville' => 3,
84 'code_postal' => 3,
85 ),
86
87 /* Les textes standard */
88 'texte_ajouter' => 'gis:texte_ajouter_gis',
89 'texte_retour' => 'icone_retour',
90 'texte_modifier' => 'gis:texte_modifier_gis',
91 'texte_creer' => 'gis:texte_creer_gis',
92 'texte_creer_associer' => 'gis:texte_creer_associer_gis',
93 'texte_objet' => 'gis:gis_singulier',
94 'texte_objets' => 'gis:gis_pluriel',
95 'info_aucun_objet' => 'gis:info_aucun_gis',
96 'info_1_objet' => 'gis:info_1_gis',
97 'info_nb_objets' => 'gis:info_nb_gis',
98 'texte_logo_objet' => 'gis:libelle_logo_gis',
99 );
100
101 $tables[]['tables_jointures'][]= 'gis_liens';
102 $tables[]['champs_versionnes'][] = 'jointure_gis';
103
104 // recherche jointe sur les points gis pour tous les objets
105 $tables[]['rechercher_jointures']['gis'] = array(
106 'titre' => 3,
107 'descriptif' => 2,
108 'pays' => 4,
109 'region' => 1,
110 'departement' => 1,
111 'ville' => 1,
112 'code_postal' => 1
113 );
114
115 return $tables;
116 }
117
118 function gis_declarer_tables_auxiliaires($tables_auxiliaires){
119 $spip_gis_liens = array(
120 "id_gis" => "bigint(21) NOT NULL",
121 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL",
122 "id_objet" => "bigint(21) NOT NULL");
123
124 $spip_gis_liens_key = array(
125 "PRIMARY KEY" => "id_gis,id_objet,objet",
126 "KEY id_objet" => "id_gis");
127
128 $tables_auxiliaires['spip_gis_liens'] = array(
129 'field' => &$spip_gis_liens,
130 'key' => &$spip_gis_liens_key);
131
132 return $tables_auxiliaires;
133 }
134
135 ?>