[CSS] +fix page header and title color
[lhc/web/www.git] / www / plugins / formidable / base / formidable_tables.php
1 <?php
2
3 /**
4 * Déclarations relatives à la base de données
5 *
6 * @package SPIP\Formidable\Pipelines
7 **/
8
9 // Sécurité
10 if (!defined('_ECRIRE_INC_VERSION')) {
11 return;
12 }
13
14 /**
15 * Déclarer les interfaces des tables de formidable pour le compilateur
16 *
17 * @pipeline declarer_tables_interfaces
18 *
19 * @param array $interfaces
20 * Déclarations d'interface pour le compilateur
21 * @return array
22 * Déclarations d'interface pour le compilateur
23 **/
24 function formidable_declarer_tables_interfaces($interfaces) {
25 // 'spip_' dans l'index de $tables_principales
26 $interfaces['table_des_tables']['formulaires'] = 'formulaires';
27 $interfaces['table_des_tables']['formulaires_reponses'] = 'formulaires_reponses';
28 $interfaces['table_des_tables']['formulaires_reponses_champs'] = 'formulaires_reponses_champs';
29
30 $interfaces['tables_jointures']['spip_formulaires'][] = 'formulaires_liens';
31 $interfaces['tables_jointures']['spip_articles'][] = 'formulaires_liens';
32 $interfaces['tables_jointures']['spip_rubriques'][] = 'formulaires_liens';
33
34 $interfaces['table_des_traitements']['MESSAGE_RETOUR']['formulaires']= _TRAITEMENT_RACCOURCIS;
35 $interfaces['table_des_traitements']['URL_REDIRECT']['formulaires']= 'vider_url(%s)';
36
37
38 return $interfaces;
39 }
40
41 /**
42 * Déclarer les objets éditoriaux des formulaires
43 *
44 * @pipeline declarer_tables_objets_sql
45 * @param array $tables
46 * Description des tables
47 * @return array
48 * Description complétée des tables
49 */
50 function formidable_declarer_tables_objets_sql($tables) {
51 include_spip('inc/config');
52 $tables['spip_formulaires'] = array(
53 'type'=>'formulaire',
54 'titre' => "titre, '' AS lang",
55 'date' => 'date_creation',
56 'principale' => 'oui',
57 'texte_modifier' => 'formidable:editer_modifier_formulaire',
58 'info_aucun_objet'=> 'formidable:info_aucun_formulaire',
59 'info_1_objet' => 'formidable:info_1_formulaire',
60 'info_nb_objets' => 'formidable:info_nb_formulaires',
61 'texte_creer_associer' => 'formidable:liens_creer_associer',
62 'texte_ajouter' => 'formidable:liens_ajouter',
63
64 'champs_editables' => array('titre', 'identifiant', 'descriptif', 'css', 'message_retour', 'saisies', 'traitements', 'public','apres','unicite','message_erreur_unicite','url_redirect','resume_reponse'),
65 'champs_versionnes' => array('titre', 'identifiant', 'descriptif', 'css', 'message_retour', 'saisies', 'traitements', 'public','apres','unicite','message_erreur_unicite','url_redirect','resume_reponse'),
66 'field' => array(
67 'id_formulaire' => 'bigint(21) NOT NULL',
68 'identifiant' => 'varchar(200)',
69 'titre' => "text NOT NULL default ''",
70 'descriptif' => 'text',
71 'css' => 'varchar(255) not null default ""',
72 'message_retour' => "text NOT NULL default ''",
73 'saisies' => "longtext NOT NULL default ''",
74 'traitements' => "text NOT NULL default ''",
75 'public' => "enum('non', 'oui') DEFAULT 'non' NOT NULL",
76 'apres' => "varchar(12) NOT NULL default ''",
77 'unicite' => "text NOT NULL default ''",
78 'message_erreur_unicite' => "text NOT NULL default ''",
79 'url_redirect' => 'varchar(255)',
80 'statut' => "varchar(10) NOT NULL default ''",
81 'resume_reponse' => "text NOT NULL default ''",
82 'date_creation' => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
83 'maj' => 'timestamp',
84 ),
85 'key' => array(
86 'PRIMARY KEY' => 'id_formulaire'
87 ),
88 'join'=> array(
89 'id_formulaire' => 'id_formulaire'
90 ),
91 'statut'=> array(
92 array(
93 'champ' => 'statut',
94 'publie' => 'publie',
95 'previsu' => 'publie,prop',
96 'exception' => array('statut', 'tout'),
97 )
98 ),
99 'texte_changer_statut' => 'formidable:changer_statut',
100 'rechercher_champs' => array(
101 'titre' => 5, 'descriptif' => 3, 'identifiant' => 3,
102 ),
103 'statut_titres' => array(
104 'prop'=>'info_article_propose',
105 'publie'=>'info_article_publie',
106 'refuse'=>'formidable:info_formulaire_refuse',
107 'poubelle'=>'info_article_supprime'
108 ),
109 'statut_textes_instituer' => array(
110 'prop' => 'texte_statut_propose_evaluation',
111 'publie' => 'texte_statut_publie',
112 'refuse'=>'formidable:texte_statut_refuse',
113 'poubelle' => 'texte_statut_poubelle',
114 ),
115 'page' => (lire_config('formidable/analyse/activer_pages')=='on') ? 'formulaire' : false,
116
117 );
118
119 $tables['spip_formulaires_reponses'] = array(
120 'type_objet'=>'formulaires_reponse',
121 'table_objet_surnoms' => array('formulairesreponse'),
122 'type'=>'formulaires_reponse',
123 'type_surnoms' => array('formulairesreponse'),
124 'titre' => "'' AS titre, '' AS lang",
125 'date' => 'date',
126 'principale' => 'oui',
127 'info_aucun_objet'=> 'formidable:info_aucune_reponse',
128 'info_1_objet' => 'formidable:info_1_reponse',
129 'info_nb_objets' => 'formidable:info_nb_reponses',
130
131 'field' => array(
132 'id_formulaires_reponse' => 'bigint(21) NOT NULL',
133 'id_formulaire' => 'bigint(21) NOT NULL default 0',
134 'date' => "datetime NOT NULL default '0000-00-00 00:00:00'",
135 'ip' => "varchar(255) NOT NULL default ''",
136 'id_auteur' => 'bigint(21) NOT NULL default 0',
137 'cookie' => "varchar(255) NOT NULL default ''",
138 'statut' => "varchar(10) NOT NULL default ''",
139 'maj' => 'timestamp'
140 ),
141 'key' => array(
142 'PRIMARY KEY' => 'id_formulaires_reponse',
143 'KEY id_formulaire' => 'id_formulaire',
144 'KEY id_auteur' => 'id_auteur',
145 'KEY cookie' => 'cookie'
146 ),
147 'join' => array(
148 'id_formulaires_reponse' => 'id_formulaires_reponse',
149 'id_formulaire' => 'id_formulaire',
150 'id_auteur' => 'id_auteur'
151 ),
152 'statut'=> array(
153 array(
154 'champ' => 'statut',
155 'publie' => 'publie',
156 'previsu' => 'publie,prop',
157 'exception' => array('statut', 'tout'),
158 )
159 ),
160 'texte_changer_statut' => 'formulaires_reponse:changer_statut',
161 'rechercher_champs' => array('ip'=>1),
162 'rechercher_jointures' => array(
163 'formulaires_reponses_champ' => array('valeur' => 4),
164 ),
165 'statut_titres' => array(
166 'prop'=>'formidable:info_reponse_proposee',
167 'publie'=>'formidable:info_reponse_publiee',
168 'poubelle' => 'formidable:info_reponse_poubelle',
169 'refuse'=>'formidable:info_reponse_refusee'
170 ),
171 'statut_textes_instituer' => array(
172 'prop' => 'formidable:texte_statut_propose_evaluation',
173 'publie' => 'formidable:texte_statut_publie',
174 'refuse' => 'formidable:texte_statut_refusee',
175 'poubelle' => 'formidable:texte_statut_poubelle'
176 ),
177 );
178 return $tables;
179 }
180
181 /**
182 * Déclarer les tables principales de formidable
183 *
184 * @pipeline declarer_tables_principales
185 * @param array $tables_principales
186 * Description des tables
187 * @return array
188 * Description complétée des tables
189 **/
190 function formidable_declarer_tables_principales($tables_principales) {
191
192 // Table formulaires_reponses_champs
193 $formulaires_reponses_champs = array(
194 'id_formulaires_reponses_champ' => 'bigint(21) NOT NULL',
195 'id_formulaires_reponse' => 'bigint(21) NOT NULL default 0',
196 'nom' => "varchar(255) NOT NULL default ''",
197 'valeur' => "text NOT NULL DEFAULT ''",
198 'maj' => 'timestamp'
199 );
200 $formulaires_reponses_champs_cles = array(
201 'PRIMARY KEY' => 'id_formulaires_reponses_champ',
202 'KEY id_formulaires_reponse' => 'id_formulaires_reponse',
203 'KEY nom' => 'nom',
204 'UNIQUE reponse' => 'id_formulaires_reponse,nom',
205 );
206 $tables_principales['spip_formulaires_reponses_champs'] = array(
207 'field' => &$formulaires_reponses_champs,
208 'key' => &$formulaires_reponses_champs_cles
209 );
210
211 return $tables_principales;
212 }
213
214 /**
215 * Déclarer les tables auxiliaires de formidable
216 *
217 * @pipeline declarer_tables_auxiliaires
218 * @param array $tables_auxiliaires
219 * Description des tables
220 * @return array
221 * Description complétée des tables
222 **/
223 function formidable_declarer_tables_auxiliaires($tables_auxiliaires) {
224 $formulaires_liens = array(
225 'id_formulaire' => "bigint(21) DEFAULT '0' NOT NULL",
226 'id_objet' => "bigint(21) DEFAULT '0' NOT NULL",
227 'objet' => "VARCHAR (25) DEFAULT '' NOT NULL"
228 );
229
230 $formulaires_liens_cles = array(
231 'PRIMARY KEY' => 'id_formulaire,id_objet,objet',
232 'KEY id_formulaire' => 'id_formulaire'
233 );
234
235 $tables_auxiliaires['spip_formulaires_liens'] = array(
236 'field' => &$formulaires_liens,
237 'key' => &$formulaires_liens_cles
238 );
239
240 return $tables_auxiliaires;
241 }