[PLUGINS] ~formidable 1.3.6 --> 1.9.1
[lhc/web/www.git] / www / plugins / formidable_1_0 / 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')) return;
11
12 /**
13 * Déclarer les interfaces des tables de formidable pour le compilateur
14 *
15 * @pipeline declarer_tables_interfaces
16 *
17 * @param array $interfaces
18 * Déclarations d'interface pour le compilateur
19 * @return array
20 * Déclarations d'interface pour le compilateur
21 **/
22 function formidable_declarer_tables_interfaces($interfaces) {
23 // 'spip_' dans l'index de $tables_principales
24 $interfaces['table_des_tables']['formulaires'] = 'formulaires';
25 $interfaces['table_des_tables']['formulaires_reponses'] = 'formulaires_reponses';
26 $interfaces['table_des_tables']['formulaires_reponses_champs'] = 'formulaires_reponses_champs';
27
28 $interfaces['tables_jointures']['spip_formulaires'][] = 'formulaires_liens';
29 $interfaces['tables_jointures']['spip_articles'][] = 'formulaires_liens';
30 $interfaces['tables_jointures']['spip_rubriques'][] = 'formulaires_liens';
31
32 return $interfaces;
33 }
34
35 /**
36 * Déclarer les objets éditoriaux des formulaires
37 *
38 * @pipeline declarer_tables_objets_sql
39 * @param array $tables
40 * Description des tables
41 * @return array
42 * Description complétée des tables
43 */
44 function formidable_declarer_tables_objets_sql($tables) {
45 $tables['spip_formulaires'] = array(
46 'type'=>'formulaire',
47 'titre' => "titre, '' AS lang",
48 'date' => 'date_creation',
49 'principale' => 'oui',
50 'texte_modifier' => 'formidable:editer_modifier_formulaire',
51
52 'field' => array(
53 "id_formulaire" => "bigint(21) NOT NULL",
54 "identifiant" => "varchar(200)",
55 "titre" => "text NOT NULL default ''",
56 "descriptif" => "text",
57 "message_retour" => "text NOT NULL default ''",
58 "saisies" => "longtext NOT NULL default ''",
59 "traitements" => "text NOT NULL default ''",
60 "public" => "enum('non', 'oui') DEFAULT 'non' NOT NULL",
61 "statut" => "varchar(10) NOT NULL default ''",
62 "date_creation" => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
63 "maj" => "timestamp",
64 "apres" => "varchar(12) NOT NULL default ''",
65 "url_redirect" => "varchar(255)"
66 ),
67 'key' => array(
68 "PRIMARY KEY" => "id_formulaire"
69 ),
70 'join'=> array(
71 'id_formulaire' => 'id_formulaire'
72 ),
73 'rechercher_champs' => array(
74 'titre' => 5, 'descriptif' => 3
75 ),
76 );
77
78 $tables['spip_formulaires_reponses'] = array(
79 'type'=>'formulaires_reponse',
80 'titre' => "'' AS titre, '' AS lang",
81 'date' => 'date',
82 'principale' => 'oui',
83
84 'field' => array(
85 "id_formulaires_reponse" => "bigint(21) NOT NULL",
86 "id_formulaire" => "bigint(21) NOT NULL default 0",
87 "date" => "datetime NOT NULL default '0000-00-00 00:00:00'",
88 "ip" => "varchar(255) NOT NULL default ''",
89 "id_auteur" => "bigint(21) NOT NULL default 0",
90 "cookie" => "varchar(255) NOT NULL default ''",
91 "statut" => "varchar(10) NOT NULL default ''",
92 "maj" => "timestamp"
93 ),
94 'key' => array(
95 "PRIMARY KEY" => "id_formulaires_reponse",
96 "KEY id_formulaire" => "id_formulaire",
97 "KEY id_auteur" => "id_auteur",
98 "KEY cookie" => "cookie"
99 ),
100 'join' => array(
101 'id_formulaires_reponse' => 'id_formulaires_reponse',
102 'id_formulaire' => 'id_formulaire',
103 'id_auteur' => 'id_auteur'
104 ),
105 'statut'=> array(
106 array(
107 'champ' => 'statut',
108 'publie' => 'publie',
109 'previsu' => 'publie,prop',
110 'exception' => array('statut', 'tout'),
111 )
112 ),
113 'texte_changer_statut' => 'formulaires_reponse:changer_statut',
114 'statut_titres' => array(
115 'prop'=>'info_article_propose',
116 'publie'=>'info_article_publie',
117 'poubelle'=>'info_article_supprime'
118 ),
119 'statut_textes_instituer' => array(
120 'prop' => 'texte_statut_propose_evaluation',
121 'publie' => 'texte_statut_publie',
122 'refuse' => 'texte_statut_poubelle',
123 ),
124 );
125 return $tables;
126 }
127
128 /**
129 * Déclarer les tables principales de formidable
130 *
131 * @pipeline declarer_tables_principales
132 * @param array $tables_principales
133 * Description des tables
134 * @return array
135 * Description complétée des tables
136 **/
137 function formidable_declarer_tables_principales($tables_principales){
138
139 // Table formulaires_reponses_champs
140 $formulaires_reponses_champs = array(
141 "id_formulaires_reponse" => "bigint(21) NOT NULL default 0",
142 "nom" => "varchar(255) NOT NULL default ''",
143 "valeur" => "text NOT NULL DEFAULT ''",
144 "maj" => "timestamp"
145 );
146 $formulaires_reponses_champs_cles = array(
147 "PRIMARY KEY" => "id_formulaires_reponse, nom",
148 "KEY id_formulaires_reponse" => "id_formulaires_reponse"
149 );
150 $tables_principales['spip_formulaires_reponses_champs'] = array(
151 'field' => &$formulaires_reponses_champs,
152 'key' => &$formulaires_reponses_champs_cles
153 );
154
155 return $tables_principales;
156 }
157
158 /**
159 * Déclarer les tables auxiliaires de formidable
160 *
161 * @pipeline declarer_tables_auxiliaires
162 * @param array $tables_auxiliaires
163 * Description des tables
164 * @return array
165 * Description complétée des tables
166 **/
167 function formidable_declarer_tables_auxiliaires($tables_auxiliaires){
168 $formulaires_liens = array(
169 "id_formulaire" => "bigint(21) DEFAULT '0' NOT NULL",
170 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
171 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL"
172 );
173
174 $formulaires_liens_cles = array(
175 "PRIMARY KEY" => "id_formulaire,id_objet,objet",
176 "KEY id_formulaire" => "id_formulaire"
177 );
178
179 $tables_auxiliaires['spip_formulaires_liens'] = array(
180 'field' => &$formulaires_liens,
181 'key' => &$formulaires_liens_cles
182 );
183
184 return $tables_auxiliaires;
185 }
186
187
188
189 ?>