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