| 14 | | |
| 15 | | // ---------- 3/3 - Declatation des interfaces, modalites d'utilisation des tables |
| 16 | | |
| 17 | | function vu_declarer_tables_interfaces($interface){ |
| 18 | | |
| 19 | | // Definir le nom des nouvelles boucles |
| 20 | | // La table ['vu_*'] aura en fait pour nom 'vu_*' |
| 21 | | $interface['table_des_tables']['vu_annonces']= 'vu_annonces'; |
| 22 | | $interface['table_des_tables']['vu_evenements'] = 'vu_evenements'; |
| 23 | | $interface['table_des_tables']['vu_publications'] = 'vu_publications'; |
| 24 | | |
| 25 | | // Indiquer les jointures possibles |
| 26 | | // de tables vu_* vers mots_vu_* : sur le champ id_* |
| 27 | | $interface['tables_jointures']['spip_vu_annonces']['id_annonce'] = 'mots_vu_annonces'; |
| 28 | | $interface['tables_jointures']['spip_vu_evenements']['id_evenement'] = 'mots_vu_evenements'; |
| 29 | | $interface['tables_jointures']['spip_vu_publications']['id_publication'] = 'mots_vu_publications'; |
| 30 | | |
| 31 | | // de tables mots_vu_* vers vu_* : sur le champ id_* |
| 32 | | $interface['tables_jointures']['spip_mots_vu_annonces']['id_annonce'] = 'vu_annonces'; |
| 33 | | $interface['tables_jointures']['spip_mots_vu_evenements']['id_evenement'] = 'vu_evenements'; |
| 34 | | $interface['tables_jointures']['spip_mots_vu_publications']['id_publication'] = 'vu_publications'; |
| 35 | | |
| 36 | | // de spip_mots vers mots_vu_* : sur le champ id_mot |
| 37 | | $interface['tables_jointures']['spip_mots']['id_mot'] = 'spip_mots_vu_annonces'; |
| 38 | | $interface['tables_jointures']['spip_mots']['id_mot'] = 'spip_mots_vu_evenements'; |
| 39 | | $interface['tables_jointures']['spip_mots']['id_mot'] = 'spip_mots_vu_publications'; |
| 40 | | |
| 41 | | // de vu_*_mots vers spip_mots : sur le champ id_mot |
| 42 | | $interface['tables_jointures']['spip_mots_vu_annonces']['id_mot'] = 'spip_mots'; |
| 43 | | $interface['tables_jointures']['spip_mots_vu_evenements']['id_mot'] = 'spip_mots'; |
| 44 | | $interface['tables_jointures']['spip_mots_vu_publications']['id_mot'] = 'spip_mots'; |
| 45 | | |
| 46 | | // Titre pour url |
| 47 | | $interface['table_titre']['spip_vu_annonces'] = "titre, '' AS lang"; |
| 48 | | $interface['table_titre']['spip_vu_evenements'] = "titre, '' AS lang"; |
| 49 | | $interface['table_titre']['spip_vu_publications'] = "titre, '' AS lang"; |
| 50 | | |
| 51 | | // On definit les traitements par défaut sur les champs qui le necessitent |
| 52 | | //$interface['table_des_traitements']['MON_CHAMPS'][]= 'ma_fonction(%s)'; |
| 53 | | $interfaces['PEREMPTION'][]= 'normaliser_date(%s)'; |
| 54 | | $interfaces['DATE_EVENEMENT'][]= 'normaliser_date(%s)'; |
| 55 | | $interfaces['DATE_PUBLICATION'][]= 'normaliser_date(%s)'; |
| 56 | | |
| 57 | | // On indique les champs 'date' pour accelerer les requetes SQL |
| 58 | | // Autorise l'utilisation des criteres 'age' et 'age_relatif' sur les nouveaux objets |
| 59 | | $interface['table_date']['vu_annonces'] = 'peremption'; |
| 60 | | $interface['table_date']['vu_annonces'] = 'date'; |
| 61 | | |
| 62 | | $interface['table_date']['vu_evenements'] = 'date_evenement'; |
| 63 | | $interface['table_date']['vu_evenements'] = 'date'; |
| 64 | | |
| 65 | | $interface['table_date']['vu_publications'] = 'date_publication'; |
| 66 | | $interface['table_date']['vu_publications'] = 'date'; |
| 67 | | |
| 68 | | return $interface; |
| 69 | | |
| | 160 | // ---------- 3/3 - Declatation des interfaces, modalites d'utilisation des tables |
| | 161 | |
| | 162 | function vu_declarer_tables_interfaces($interface){ |
| | 163 | |
| | 164 | // Definir le nom des nouvelles boucles |
| | 165 | // La table ['vu_*'] aura en fait pour nom 'vu_*' |
| | 166 | $interface['table_des_tables']['vu_annonces']= 'vu_annonces'; |
| | 167 | $interface['table_des_tables']['vu_evenements'] = 'vu_evenements'; |
| | 168 | $interface['table_des_tables']['vu_publications'] = 'vu_publications'; |
| | 169 | |
| | 170 | // Indiquer les jointures possibles |
| | 171 | // de tables vu_* vers mots_vu_* : sur le champ id_* |
| | 172 | $interface['tables_jointures']['spip_vu_annonces']['id_annonce'] = 'mots_vu_annonces'; |
| | 173 | $interface['tables_jointures']['spip_vu_evenements']['id_evenement'] = 'mots_vu_evenements'; |
| | 174 | $interface['tables_jointures']['spip_vu_publications']['id_publication'] = 'mots_vu_publications'; |
| | 175 | |
| | 176 | // de tables mots_vu_* vers vu_* : sur le champ id_* |
| | 177 | $interface['tables_jointures']['spip_mots_vu_annonces']['id_annonce'] = 'vu_annonces'; |
| | 178 | $interface['tables_jointures']['spip_mots_vu_evenements']['id_evenement'] = 'vu_evenements'; |
| | 179 | $interface['tables_jointures']['spip_mots_vu_publications']['id_publication'] = 'vu_publications'; |
| | 180 | |
| | 181 | // de spip_mots vers mots_vu_* : sur le champ id_mot |
| | 182 | $interface['tables_jointures']['spip_mots']['id_mot'] = 'spip_mots_vu_annonces'; |
| | 183 | $interface['tables_jointures']['spip_mots']['id_mot'] = 'spip_mots_vu_evenements'; |
| | 184 | $interface['tables_jointures']['spip_mots']['id_mot'] = 'spip_mots_vu_publications'; |
| | 185 | |
| | 186 | // de vu_*_mots vers spip_mots : sur le champ id_mot |
| | 187 | $interface['tables_jointures']['spip_mots_vu_annonces']['id_mot'] = 'spip_mots'; |
| | 188 | $interface['tables_jointures']['spip_mots_vu_evenements']['id_mot'] = 'spip_mots'; |
| | 189 | $interface['tables_jointures']['spip_mots_vu_publications']['id_mot'] = 'spip_mots'; |
| | 190 | |
| | 191 | // Titre pour url |
| | 192 | $interface['table_titre']['spip_vu_annonces'] = "titre, '' AS lang"; |
| | 193 | $interface['table_titre']['spip_vu_evenements'] = "titre, '' AS lang"; |
| | 194 | $interface['table_titre']['spip_vu_publications'] = "titre, '' AS lang"; |
| | 195 | |
| | 196 | // On definit les traitements par défaut sur les champs qui le necessitent |
| | 197 | //$interface['table_des_traitements']['MON_CHAMPS'][]= 'ma_fonction(%s)'; |
| | 198 | $interfaces['PEREMPTION'][]= 'normaliser_date(%s)'; |
| | 199 | $interfaces['DATE_EVENEMENT'][]= 'normaliser_date(%s)'; |
| | 200 | $interfaces['DATE_PUBLICATION'][]= 'normaliser_date(%s)'; |
| | 201 | |
| | 202 | // On indique les champs 'date' pour accelerer les requetes SQL |
| | 203 | // Autorise l'utilisation des criteres 'age' et 'age_relatif' sur les nouveaux objets |
| | 204 | $interface['table_date']['vu_annonces'] = 'peremption'; |
| | 205 | $interface['table_date']['vu_annonces'] = 'date'; |
| | 206 | |
| | 207 | $interface['table_date']['vu_evenements'] = 'date_evenement'; |
| | 208 | $interface['table_date']['vu_evenements'] = 'date'; |
| | 209 | |
| | 210 | $interface['table_date']['vu_publications'] = 'date_publication'; |
| | 211 | $interface['table_date']['vu_publications'] = 'date'; |
| | 212 | |
| | 213 | return $interface; |