[PLUGINS] +clavettes et dependances
[lhc/web/clavette_www.git] / www / plugins / agenda_3_5 / base / agenda_evenements.php
1 <?php
2 /**
3 * Plugin Agenda 4 pour Spip 3.0
4 * Licence GPL 3
5 *
6 * 2006-2011
7 * Auteurs : cf paquet.xml
8 */
9
10 if (!defined("_ECRIRE_INC_VERSION")) return;
11
12
13 /**
14 * Interfaces du compilateur
15 *
16 * @param array $interface
17 * @return array
18 */
19 function agenda_declarer_tables_interfaces($interface){
20 // 'spip_' dans l'index de $tables_principales
21 $interface['table_des_tables']['evenements']='evenements';
22
23 $interface['table_des_traitements']['LIEU'][]= 'expanser_liens('._TRAITEMENT_TYPO.')';
24 $interface['table_des_traitements']['ADRESSE'][]= _TRAITEMENT_RACCOURCIS;
25
26 // permet d'utiliser les criteres racine, meme_parent, id_parent
27 $interface['exceptions_des_tables']['evenements']['id_parent']='id_evenement_source';
28 $interface['exceptions_des_tables']['evenements']['id_rubrique']=array('spip_articles', 'id_rubrique');
29
30 return $interface;
31 }
32
33 /**
34 * Tables auxiliaires de liens
35 * @param array $tables_auxiliaires
36 * @return array
37 */
38 function agenda_declarer_tables_auxiliaires($tables_auxiliaires){
39
40 //-- Table des participants ----------------------
41 $spip_evenements_participants = array(
42 "id_evenement_participant" => "BIGINT(21) NOT NULL AUTO_INCREMENT",
43 "id_evenement" => "BIGINT (21) DEFAULT '0' NOT NULL",
44 "id_auteur" => "BIGINT (21) DEFAULT '0' NOT NULL",
45 "nom" => "text NOT NULL DEFAULT ''",
46 "email" => "tinytext NOT NULL DEFAULT ''",
47 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
48 "reponse" => "char(3) default '?' NOT NULL", // oui, non, ?
49 );
50
51 $spip_evenements_participants_key = array(
52 "PRIMARY KEY" => "id_evenement_participant",
53 "KEY id_evenement" => "id_evenement",
54 "KEY id_auteur" => "id_auteur");
55
56 $tables_auxiliaires['spip_evenements_participants'] = array(
57 'field' => &$spip_evenements_participants,
58 'key' => &$spip_evenements_participants_key);
59
60 return $tables_auxiliaires;
61 }
62
63 /**
64 * Declarer la table objet evenement
65 *
66 * @param array $tables
67 * @return array
68 */
69 function agenda_declarer_tables_objets_sql($tables){
70 $tables['spip_evenements'] = array(
71 'page'=>'evenement',
72 'texte_retour' => 'icone_retour',
73 'texte_objets' => 'agenda:info_evenements',
74 'texte_objet' => 'agenda:info_evenement',
75 'texte_modifier' => 'agenda:icone_modifier_evenement',
76 'texte_creer' => 'agenda:titre_cadre_ajouter_evenement',
77 'texte_logo_objet' => 'agenda:texte_logo_objet',
78 'info_aucun_objet'=> 'agenda:info_aucun_evenement',
79 'info_1_objet' => 'agenda:info_un_evenement',
80 'info_nb_objets' => 'agenda:info_nombre_evenements',
81 'titre' => 'titre, "" AS lang',
82 'date' => 'date_debut',
83 'principale' => 'oui',
84 'champs_editables' => array('date_debut', 'date_fin', 'titre', 'descriptif','lieu', 'adresse', 'inscription', 'places', 'horaire'),
85 'field'=> array(
86 "id_evenement" => "bigint(21) NOT NULL",
87 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
88 "date_debut" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
89 "date_fin" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
90 "titre" => "text NOT NULL DEFAULT ''",
91 "descriptif" => "text NOT NULL DEFAULT ''",
92 "lieu" => "text NOT NULL DEFAULT ''",
93 "adresse" => "text NOT NULL DEFAULT ''",
94 "inscription" => "tinyint(1) DEFAULT 0 NOT NULL",
95 "places" => "int(11) DEFAULT 0 NOT NULL",
96 "horaire" => "varchar(3) DEFAULT 'oui' NOT NULL",
97 "id_evenement_source" => "bigint(21) NOT NULL",
98 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
99 "maj" => "TIMESTAMP",
100 "date_creation" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"
101 ),
102 'key' => array(
103 "PRIMARY KEY" => "id_evenement",
104 "KEY date_debut" => "date_debut",
105 "KEY date_fin" => "date_fin",
106 "KEY id_article" => "id_article"
107 ),
108 'join' => array(
109 "id_evenement"=>"id_evenement",
110 "id_article"=>"id_article"
111 ),
112 'tables_jointures' => array(
113 'articles',
114 'evenements_participants',
115 ),
116 'rechercher_champs' => array(
117 'titre' => 8, 'descriptif' => 5, 'lieu' => 5, 'adresse' => 3
118 ),
119 'rechercher_jointures' => array(
120 'document' => array('titre' => 2, 'descriptif' => 1)
121 ),
122 'statut' => array(
123 array(
124 'champ' => 'statut',
125 'publie' => 'publie',
126 'previsu' => '!',
127 'exception' => array('statut','tout')
128 ),
129 ),
130 'statut_titres' => array(
131 'prop'=>'agenda:info_evenement_propose',
132 'publie'=>'agenda:info_evenement_publie',
133 'poubelle'=>'agenda:info_evenement_supprime'
134 ),
135 'statut_textes_instituer' => array(
136 'prop' => 'texte_statut_propose_evaluation',
137 'publie' => 'texte_statut_publie',
138 'poubelle' => 'texte_statut_poubelle',
139 ),
140 'texte_changer_statut' => 'agenda:texte_evenement_statut',
141 'champs_versionnes' => array('id_article', 'titre', 'descriptif', 'lieu', 'adresse', 'date_debut', 'date_fin', 'horaire'),
142
143 );
144
145 //-- Jointures ----------------------------------------------------
146 $tables['spip_articles']['tables_jointures'][] = 'evenements';
147 $tables['spip_auteurs']['tables_jointures'][] = 'evenements_participants';
148 $tables['spip_rubriques']['field']['agenda'] = 'tinyint(1) DEFAULT 0 NOT NULL';
149
150 return $tables;
151 }
152
153
154 ?>