[PLUGINS] +maj gis4
[lhc/web/www.git] / www / plugins / gis / base / gis.php
index 5117ea6..89aa1cb 100644 (file)
@@ -3,24 +3,20 @@
 if (!defined("_ECRIRE_INC_VERSION")) return;
 
 function gis_declarer_tables_interfaces($interface){
-       $interface['tables_jointures']['spip_gis'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_gis_liens'][] = 'gis';
-       $interface['tables_jointures']['spip_articles'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_auteurs'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_breves'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_documents'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_groupes_mots'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_mots'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_rubriques'][] = 'gis_liens';
-       $interface['tables_jointures']['spip_syndic'][] = 'gis_liens';
-
        $interface['table_des_tables']['gis'] = 'gis';
        $interface['table_des_tables']['gis_liens'] = 'gis_liens';
 
        // Traitements typo et raccourcis
+       $interface['table_des_traitements']['TITRE_GIS'][] = 'typo(extraire_multi(%s))';
        $interface['table_des_traitements']['DESCRIPTIF_GIS'][] = _TRAITEMENT_RACCOURCIS;
+       $interface['table_des_traitements']['VILLE_GIS'][] = 'typo(extraire_multi(%s))';
+       $interface['table_des_traitements']['PAYS_GIS'][] = 'typo(extraire_multi(%s))';
+       $interface['table_des_traitements']['REGION_GIS'][] = 'typo(extraire_multi(%s))';
+       $interface['table_des_traitements']['DEPARTEMENT_GIS'][] = 'typo(extraire_multi(%s))';
        $interface['table_des_traitements']['VILLE'][] = 'typo(extraire_multi(%s))';
        $interface['table_des_traitements']['PAYS'][] = 'typo(extraire_multi(%s))';
+       $interface['table_des_traitements']['REGION'][] = 'typo(extraire_multi(%s))';
+       $interface['table_des_traitements']['DEPARTEMENT'][] = 'typo(extraire_multi(%s))';
 
        return $interface;
 }
@@ -37,7 +33,7 @@ function gis_declarer_tables_objets_sql($tables){
                /* La table */
                'field' => array(
                        "id_gis" => "bigint(21) NOT NULL",
-                       "titre" => "varchar(255) NOT NULL DEFAULT ''",
+                       "titre" => "text NOT NULL DEFAULT ''",
                        "descriptif" => "text NOT NULL DEFAULT ''",
                        "lat" => "double NULL NULL",
                        "lon" => "double NULL NULL",
@@ -46,11 +42,23 @@ function gis_declarer_tables_objets_sql($tables){
                        "pays" => "text NOT NULL DEFAULT ''",
                        "code_pays" => "varchar(255) NOT NULL DEFAULT ''",
                        "region" => "text NOT NULL DEFAULT ''",
+                       "departement" => "text NOT NULL DEFAULT ''",
                        "ville" => "text NOT NULL DEFAULT ''",
                        "code_postal" => "varchar(255) NOT NULL DEFAULT ''"
                ),
                'key' => array(
                        "PRIMARY KEY" => "id_gis",
+                       'KEY lat' => 'lat',
+                       'KEY lon' => 'lon',
+                       'KEY pays' => 'pays(500)',
+                       'KEY code_pays' => 'code_pays',
+                       'KEY region' => 'region(500)',
+                       'KEY departement' => 'departement(500)',
+                       'KEY ville' => 'ville(500)',
+                       'KEY code_postal' => 'code_postal',
+               ),
+               'join' => array(
+                               "id_gis"=>"id_gis"
                ),
                'principale' => 'oui',
                'modeles' => array('carte_gis', 'carte_gis_preview'),
@@ -59,18 +67,19 @@ function gis_declarer_tables_objets_sql($tables){
                'titre' => "titre, '' AS lang",
 
                /* L'édition, l'affichage et la recherche */
-               'page' => 'gis',
+               'page' => false,
                'url_voir' => 'gis',
                'url_edit' => 'gis_edit',
                'editable' => 'oui',
-               'champs_editables' => array('lat', 'lon', 'zoom', 'titre', 'descriptif', 'adresse', 'code_postal', 'ville', 'region', 'pays'),
-               /*'champs_editables' => array(), */
+               'champs_editables' => array('lat', 'lon', 'zoom', 'titre', 'descriptif', 'adresse', 'code_postal', 'ville', 'region', 'departement', 'pays', 'code_pays'),
+               'champs_versionnes' => array('lat', 'lon', 'zoom', 'titre', 'descriptif', 'adresse', 'code_postal', 'ville', 'region', 'departement', 'pays', 'code_pays'),
                'icone_objet' => 'gis',
                'rechercher_champs' => array(
                        'titre' => 8,
                        'descriptif' => 5,
                        'pays' => 3,
                        'region' => 3,
+                       'departement' => 3,
                        'ville' => 3,
                        'code_postal' => 3,
                ),
@@ -89,18 +98,19 @@ function gis_declarer_tables_objets_sql($tables){
                'texte_logo_objet' => 'gis:libelle_logo_gis',
        );
 
-       $spip_gis_liens = array(
-               "id_gis" => "bigint(21) NOT NULL",
-               "objet" => "VARCHAR (25) DEFAULT '' NOT NULL",
-               "id_objet" => "bigint(21) NOT NULL");
+       $tables[]['tables_jointures'][]= 'gis_liens';
+       $tables[]['champs_versionnes'][] = 'jointure_gis';
 
-       $spip_gis_liens_key = array(
-               "PRIMARY KEY" => "id_gis,id_objet,objet",
-               "KEY id_objet" => "id_gis");
-
-       $tables_auxiliaires['spip_gis_liens'] = array(
-               'field' => &$spip_gis_liens,
-               'key' => &$spip_gis_liens_key);
+       // recherche jointe sur les points gis pour tous les objets
+       $tables[]['rechercher_jointures']['gis'] = array(
+                       'titre' => 3,
+                       'descriptif' => 2,
+                       'pays' => 4,
+                       'region' => 1,
+                       'departement' => 1,
+                       'ville' => 1,
+                       'code_postal' => 1
+               );
 
        return $tables;
 }
@@ -113,7 +123,10 @@ function gis_declarer_tables_auxiliaires($tables_auxiliaires){
 
        $spip_gis_liens_key = array(
                "PRIMARY KEY" => "id_gis,id_objet,objet",
-               "KEY id_objet" => "id_gis");
+               "KEY id_gis" => "id_gis",
+               "KEY id_objet" => "id_objet",
+               "KEY objet" => "objet"
+       );
 
        $tables_auxiliaires['spip_gis_liens'] = array(
                'field' => &$spip_gis_liens,
@@ -122,4 +135,4 @@ function gis_declarer_tables_auxiliaires($tables_auxiliaires){
        return $tables_auxiliaires;
 }
 
-?>
\ No newline at end of file
+?>