4d5f43324c5827c16269dcfd27c577f12d96d3fe
4 * Déclarations relatives à la base de données
6 * @package SPIP\Formidable\Pipelines
10 if (!defined('_ECRIRE_INC_VERSION')) return;
13 * Déclarer les interfaces des tables de formidable pour le compilateur
15 * @pipeline declarer_tables_interfaces
17 * @param array $interfaces
18 * Déclarations d'interface pour le compilateur
20 * Déclarations d'interface pour le compilateur
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';
28 $interfaces['tables_jointures']['spip_formulaires'][] = 'formulaires_liens';
29 $interfaces['tables_jointures']['spip_articles'][] = 'formulaires_liens';
30 $interfaces['tables_jointures']['spip_rubriques'][] = 'formulaires_liens';
36 * Déclarer les objets éditoriaux des formulaires
38 * @pipeline declarer_tables_objets_sql
39 * @param array $tables
40 * Description des tables
42 * Description complétée des tables
44 function formidable_declarer_tables_objets_sql($tables) {
45 $tables['spip_formulaires'] = array(
47 'titre' => "titre, '' AS lang",
49 'principale' => 'oui',
52 "id_formulaire" => "bigint(21) NOT NULL",
53 "identifiant" => "varchar(200)",
54 "titre" => "text NOT NULL default ''",
55 "descriptif" => "text",
56 "message_retour" => "text NOT NULL default ''",
57 "saisies" => "text NOT NULL default ''",
58 "traitements" => "text NOT NULL default ''",
59 "public" => "enum('non', 'oui') DEFAULT 'non' NOT NULL",
60 "statut" => "varchar(10) NOT NULL default ''",
62 "apres" => "varchar(12) NOT NULL default ''",
63 "url_redirect" => "varchar(255)"
66 "PRIMARY KEY" => "id_formulaire"
69 'id_formulaire' => 'id_formulaire'
71 'rechercher_champs' => array(
72 'titre' => 5, 'descriptif' => 3
76 $tables['spip_formulaires_reponses'] = array(
77 'type'=>'formulaires_reponse',
78 'titre' => "'' AS titre, '' AS lang",
80 'principale' => 'oui',
83 "id_formulaires_reponse" => "bigint(21) NOT NULL",
84 "id_formulaire" => "bigint(21) NOT NULL default 0",
85 "date" => "datetime NOT NULL default '0000-00-00 00:00:00'",
86 "ip" => "varchar(255) NOT NULL default ''",
87 "id_auteur" => "bigint(21) NOT NULL default 0",
88 "cookie" => "varchar(255) NOT NULL default ''",
89 "statut" => "varchar(10) NOT NULL default ''",
93 "PRIMARY KEY" => "id_formulaires_reponse",
94 "KEY id_formulaire" => "id_formulaire",
95 "KEY id_auteur" => "id_auteur",
96 "KEY cookie" => "cookie"
99 'id_formulaires_reponse' => 'id_formulaires_reponse',
100 'id_formulaire' => 'id_formulaire',
101 'id_auteur' => 'id_auteur'
106 'publie' => 'publie',
107 'previsu' => 'publie,prop',
108 'exception' => array('statut', 'tout'),
111 'texte_changer_statut' => 'formulaires_reponse:changer_statut',
112 'statut_titres' => array(
113 'prop'=>'info_article_propose',
114 'publie'=>'info_article_publie',
115 'poubelle'=>'info_article_supprime'
117 'statut_textes_instituer' => array(
118 'prop' => 'texte_statut_propose_evaluation',
119 'publie' => 'texte_statut_publie',
120 'refuse' => 'texte_statut_poubelle',
127 * Déclarer les tables principales de formidable
129 * @pipeline declarer_tables_principales
130 * @param array $tables_principales
131 * Description des tables
133 * Description complétée des tables
135 function formidable_declarer_tables_principales($tables_principales){
137 // Table formulaires_reponses_champs
138 $formulaires_reponses_champs = array(
139 "id_formulaires_reponse" => "bigint(21) NOT NULL default 0",
140 "nom" => "varchar(255) NOT NULL default ''",
141 "valeur" => "text NOT NULL DEFAULT ''",
144 $formulaires_reponses_champs_cles = array(
145 "PRIMARY KEY" => "id_formulaires_reponse, nom",
146 "KEY id_formulaires_reponse" => "id_formulaires_reponse"
148 $tables_principales['spip_formulaires_reponses_champs'] = array(
149 'field' => &$formulaires_reponses_champs,
150 'key' => &$formulaires_reponses_champs_cles
153 return $tables_principales;
157 * Déclarer les tables auxiliaires de formidable
159 * @pipeline declarer_tables_auxiliaires
160 * @param array $tables_auxiliaires
161 * Description des tables
163 * Description complétée des tables
165 function formidable_declarer_tables_auxiliaires($tables_auxiliaires){
166 $formulaires_liens = array(
167 "id_formulaire" => "bigint(21) DEFAULT '0' NOT NULL",
168 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
169 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL"
172 $formulaires_liens_cles = array(
173 "PRIMARY KEY" => "id_formulaire,id_objet,objet",
174 "KEY id_formulaire" => "id_formulaire"
177 $tables_auxiliaires['spip_formulaires_liens'] = array(
178 'field' => &$formulaires_liens,
179 'key' => &$formulaires_liens_cles
182 return $tables_auxiliaires;