1 | <?php |
---|
2 | |
---|
3 | // Sécurité |
---|
4 | if (!defined('_ECRIRE_INC_VERSION')) return; |
---|
5 | |
---|
6 | function formidable_declarer_tables_interfaces($interface){ |
---|
7 | // 'spip_' dans l'index de $tables_principales |
---|
8 | $interface['table_des_tables']['formulaires'] = 'formulaires'; |
---|
9 | $interface['table_des_tables']['formulaires_reponses'] = 'formulaires_reponses'; |
---|
10 | $interface['table_des_tables']['formulaires_reponses_champs'] = 'formulaires_reponses_champs'; |
---|
11 | |
---|
12 | |
---|
13 | $interface['table_titre']['formulaires'] = 'titre'; |
---|
14 | |
---|
15 | $interface['tables_jointures']['spip_formulaires'][] = 'formulaires_liens'; |
---|
16 | $interface['tables_jointures']['spip_articles'][] = 'formulaires_liens'; |
---|
17 | $interface['tables_jointures']['spip_rubriques'][] = 'formulaires_liens'; |
---|
18 | |
---|
19 | return $interface; |
---|
20 | } |
---|
21 | |
---|
22 | function formidable_declarer_tables_principales($tables_principales){ |
---|
23 | //-- Table formulaires ----------------------------------------------------- |
---|
24 | $formulaires = array( |
---|
25 | "id_formulaire" => "bigint(21) NOT NULL", |
---|
26 | "identifiant" => "varchar(200)", |
---|
27 | "titre" => "text NOT NULL default ''", |
---|
28 | "descriptif" => "text", |
---|
29 | "message_retour" => "text NOT NULL default ''", |
---|
30 | "saisies" => "text NOT NULL default ''", |
---|
31 | "traitements" => "text NOT NULL default ''", |
---|
32 | "public" => "enum('non', 'oui') DEFAULT 'non' NOT NULL", |
---|
33 | "statut" => "varchar(10) NOT NULL default ''", |
---|
34 | "maj" => "timestamp", |
---|
35 | "apres" => "varchar(12) NOT NULL default ''", |
---|
36 | "url_redirect" => "varchar(255)" |
---|
37 | ); |
---|
38 | $formulaires_cles = array( |
---|
39 | "PRIMARY KEY" => "id_formulaire" |
---|
40 | ); |
---|
41 | $tables_principales['spip_formulaires'] = array( |
---|
42 | 'field' => &$formulaires, |
---|
43 | 'key' => &$formulaires_cles, |
---|
44 | 'join'=> array( |
---|
45 | 'id_formulaire' => 'id_formulaire' |
---|
46 | ) |
---|
47 | ); |
---|
48 | |
---|
49 | //-- Table formulaires_reponses -------------------------------------------- |
---|
50 | $formulaires_reponses = array( |
---|
51 | "id_formulaires_reponse" => "bigint(21) NOT NULL", |
---|
52 | "id_formulaire" => "bigint(21) NOT NULL default 0", |
---|
53 | "date" => "datetime NOT NULL default '0000-00-00 00:00:00'", |
---|
54 | "ip" => "varchar(255) NOT NULL default ''", |
---|
55 | "id_auteur" => "bigint(21) NOT NULL default 0", |
---|
56 | "cookie" => "varchar(255) NOT NULL default ''", |
---|
57 | "statut" => "varchar(10) NOT NULL default ''", |
---|
58 | "maj" => "timestamp" |
---|
59 | ); |
---|
60 | $formulaires_reponses_cles = array( |
---|
61 | "PRIMARY KEY" => "id_formulaires_reponse", |
---|
62 | "KEY id_formulaire" => "id_formulaire", |
---|
63 | "KEY id_auteur" => "id_auteur", |
---|
64 | "KEY cookie" => "cookie" |
---|
65 | ); |
---|
66 | $tables_principales['spip_formulaires_reponses'] = array( |
---|
67 | 'field' => &$formulaires_reponses, |
---|
68 | 'key' => &$formulaires_reponses_cles, |
---|
69 | 'join'=> array( |
---|
70 | 'id_formulaires_reponse' => 'id_formulaires_reponse', |
---|
71 | 'id_formulaire' => 'id_formulaire', |
---|
72 | 'id_auteur' => 'id_auteur' |
---|
73 | ) |
---|
74 | ); |
---|
75 | |
---|
76 | //-- Table formulaires_reponses_champs ------------------------------------- |
---|
77 | $formulaires_reponses_champs = array( |
---|
78 | "id_formulaires_reponse" => "bigint(21) NOT NULL default 0", |
---|
79 | "nom" => "varchar(255) NOT NULL default ''", |
---|
80 | "valeur" => "text NOT NULL DEFAULT ''", |
---|
81 | "maj" => "timestamp" |
---|
82 | ); |
---|
83 | $formulaires_reponses_champs_cles = array( |
---|
84 | "PRIMARY KEY" => "id_formulaires_reponse, nom", |
---|
85 | "KEY id_formulaires_reponse" => "id_formulaires_reponse" |
---|
86 | ); |
---|
87 | $tables_principales['spip_formulaires_reponses_champs'] = array( |
---|
88 | 'field' => &$formulaires_reponses_champs, |
---|
89 | 'key' => &$formulaires_reponses_champs_cles |
---|
90 | ); |
---|
91 | |
---|
92 | return $tables_principales; |
---|
93 | } |
---|
94 | |
---|
95 | function formidable_declarer_tables_auxiliaires($tables_auxiliaires){ |
---|
96 | $formulaires_liens = array( |
---|
97 | "id_formulaire" => "bigint(21) DEFAULT '0' NOT NULL", |
---|
98 | "id_objet" => "bigint(21) DEFAULT '0' NOT NULL", |
---|
99 | "objet" => "VARCHAR (25) DEFAULT '' NOT NULL" |
---|
100 | ); |
---|
101 | |
---|
102 | $formulaires_liens_cles = array( |
---|
103 | "PRIMARY KEY" => "id_formulaire,id_objet,objet", |
---|
104 | "KEY id_formulaire" => "id_formulaire" |
---|
105 | ); |
---|
106 | |
---|
107 | $tables_auxiliaires['spip_formulaires_liens'] = array( |
---|
108 | 'field' => &$formulaires_liens, |
---|
109 | 'key' => &$formulaires_liens_cles |
---|
110 | ); |
---|
111 | |
---|
112 | return $tables_auxiliaires; |
---|
113 | } |
---|
114 | |
---|
115 | function formidable_rechercher_liste_des_champs($tables){ |
---|
116 | $tables['formulaire']['titre'] = 5; |
---|
117 | $tables['formulaire']['descriptif'] = 3; |
---|
118 | return $tables; |
---|
119 | } |
---|
120 | |
---|
121 | ?> |
---|