3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2013 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
16 * Interfaces des tables mots et groupes de mots pour le compilateur
18 * @param array $interfaces
21 function mots_declarer_tables_interfaces($interfaces){
23 $interfaces['table_des_tables']['mots']='mots';
24 $interfaces['table_des_tables']['groupes_mots']='groupes_mots';
26 $interfaces['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre');
27 $interfaces['exceptions_des_jointures']['type_mot'] = array('spip_mots', 'type');
28 $interfaces['exceptions_des_jointures']['id_mot_syndic'] = array('spip_mots_liens', 'id_mot');
29 $interfaces['exceptions_des_jointures']['titre_mot_syndic'] = array('spip_mots', 'titre');
30 $interfaces['exceptions_des_jointures']['type_mot_syndic'] = array('spip_mots', 'type');
31 $interfaces['exceptions_des_jointures']['spip_articles']['id_groupe'] = array('spip_mots', 'id_groupe');
32 $interfaces['exceptions_des_jointures']['spip_rubriques']['id_groupe'] = array('spip_mots', 'id_groupe');
39 * Table auxilaire spip_mots_xx
41 * @param array $tables_auxiliaires
44 function mots_declarer_tables_auxiliaires($tables_auxiliaires){
46 $spip_mots_liens = array(
47 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
48 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
49 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL");
51 $spip_mots_liens_key = array(
52 "PRIMARY KEY" => "id_mot,id_objet,objet",
53 "KEY id_mot" => "id_mot",
54 "KEY id_objet" => "id_objet",
55 "KEY objet" => "objet",
58 $tables_auxiliaires['spip_mots_liens'] =
59 array('field' => &$spip_mots_liens, 'key' => &$spip_mots_liens_key);
61 return $tables_auxiliaires;
66 * Declarer les objets mots et les jointures mots pour tous les objets
68 * @param array $tables
71 function mots_declarer_tables_objets_sql($tables){
72 $tables['spip_mots'] = array(
74 'type_surnoms' => array('mot-cle'), // pour les icones...
75 'texte_retour' => 'icone_retour',
76 'texte_objets' => 'public:mots_clefs',
77 'texte_objet' => 'public:mots_clef',
78 'texte_modifier' => 'mots:icone_modifier_mot',
79 'texte_ajouter' => 'titre_ajouter_un_mot', // # A deplacer
80 'texte_creer' => 'titre_ajouter_un_mot',
81 'texte_logo_objet' => 'mots:logo_mot_cle',
82 'texte_creer_associer' => 'mots:creer_et_associer_un_mot',
83 'info_aucun_objet'=> 'mots:info_aucun_mot_cle',
84 'info_1_objet' => 'info_1_mot_cle',
85 'info_nb_objets' => 'info_nb_mots_cles',
86 'titre' => "titre, '' AS lang",
88 'principale' => 'oui',
90 "id_mot" => "bigint(21) NOT NULL",
91 "titre" => "text DEFAULT '' NOT NULL",
92 "descriptif" => "text DEFAULT '' NOT NULL",
93 "texte" => "longtext DEFAULT '' NOT NULL",
94 "id_groupe" => "bigint(21) DEFAULT 0 NOT NULL",
95 "type" => "text DEFAULT '' NOT NULL",
99 "PRIMARY KEY" => "id_mot",
100 "KEY id_groupe" => "id_groupe"
102 'rechercher_champs' => array(
103 'titre' => 8, 'texte' => 1, 'descriptif' => 5
105 'tables_jointures' => array(
106 #'mots_liens' // declare generiquement ci dessous
108 'champs_versionnes' => array('titre', 'descriptif', 'texte','id_groupe'),
111 $tables['spip_groupes_mots'] = array(
112 'table_objet_surnoms' => array('groupemot','groupe_mots' /*hum*/,'groupe_mot' /* hum*/,'groupe' /*hum (EXPOSE)*/),
113 'type'=>'groupe_mots',
114 'type_surnoms' => array('groupes_mot','groupemot','groupe_mot'),
115 'texte_retour' => 'icone_retour',
116 'texte_objets' => 'mots:titre_groupes_mots',
117 'texte_objet' => 'mots:titre_groupe_mots',
118 'texte_modifier' => 'mots:icone_modif_groupe_mots',
119 'texte_creer' => 'mots:icone_creation_groupe_mots',
120 'texte_logo_objet' => 'mots:logo_groupe',
121 'info_aucun_objet'=> 'mots:info_aucun_groupemots',
122 'info_1_objet' => 'mots:info_1_groupemots',
123 'info_nb_objets' => 'mots:info_nb_groupemots',
124 'titre' => "titre, '' AS lang",
126 'principale' => 'oui',
127 'page' => '', // pas de page publique pour les groupes
129 "id_groupe" => "bigint(21) NOT NULL",
130 "titre" => "text DEFAULT '' NOT NULL",
131 "descriptif" => "text DEFAULT '' NOT NULL",
132 "texte" => "longtext DEFAULT '' NOT NULL",
133 "unseul" => "varchar(3) DEFAULT '' NOT NULL",
134 "obligatoire" => "varchar(3) DEFAULT '' NOT NULL",
135 "tables_liees" => "text DEFAULT '' NOT NULL",
136 "minirezo" => "varchar(3) DEFAULT '' NOT NULL",
137 "comite" => "varchar(3) DEFAULT '' NOT NULL",
138 "forum" => "varchar(3) DEFAULT '' NOT NULL",
142 "PRIMARY KEY" => "id_groupe"
144 'rechercher_champs' => array(
145 'titre' => 8, 'texte' => 1, 'descriptif' => 5
147 'tables_jointures' => array(
150 'champs_versionnes' => array('titre', 'descriptif', 'texte','un_seul','obligatoire','tables_liees','minirezo','forum','comite'),
153 // jointures sur les mots pour tous les objets
154 $tables[]['tables_jointures'][]= 'mots_liens';
155 $tables[]['tables_jointures'][]= 'mots';
157 // cas particulier des auteurs et mots : declarer explicitement mots_liens comme jointure privilegiee
158 // cf http://core.spip.org/issues/2329
159 $tables['spip_auteurs']['tables_jointures'][]= 'mots_liens';
160 $tables['spip_auteurs']['tables_jointures'][]= 'mots';
161 $tables['spip_mots']['tables_jointures'][]= 'mots_liens';
162 $tables['spip_mots']['tables_jointures'][]= 'mots';
165 // recherche jointe sur les mots pour tous les objets
166 $tables[]['rechercher_jointures']['mot'] = array('titre' => 3);
167 // versionner les jointures pour tous les objets
168 $tables[]['champs_versionnes'][] = 'jointure_mots';