3b7973b94e8773ef3cea1f0a464e3d5d4fee9164
[ptitvelo/web/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" => "BIGINT (21) DEFAULT '0' NOT NULL",
43 "id_auteur" => "BIGINT (21) DEFAULT '0' NOT NULL",
44 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
45 "reponse" => "char(3) default '?' NOT NULL", // oui, non, ?
46 );
47
48 $spip_evenements_participants_key = array(
49 "PRIMARY KEY" => "id_evenement, id_auteur",
50 "KEY id_auteur" => "id_auteur");
51
52 $tables_auxiliaires['spip_evenements_participants'] = array(
53 'field' => &$spip_evenements_participants,
54 'key' => &$spip_evenements_participants_key);
55
56 return $tables_auxiliaires;
57 }
58
59 /**
60 * Declarer la table objet evenement
61 *
62 * @param array $tables
63 * @return array
64 */
65 function agenda_declarer_tables_objets_sql($tables){
66 $tables['spip_evenements'] = array(
67 'page'=>'evenement',
68 'texte_retour' => 'icone_retour',
69 'texte_objets' => 'agenda:info_evenements',
70 'texte_objet' => 'agenda:info_evenement',
71 'texte_modifier' => 'agenda:icone_modifier_evenement',
72 'texte_creer' => 'agenda:titre_cadre_ajouter_evenement',
73 'texte_logo_objet' => 'agenda:texte_logo_objet',
74 'info_aucun_objet'=> 'agenda:info_aucun_evenement',
75 'info_1_objet' => 'agenda:info_un_evenement',
76 'info_nb_objets' => 'agenda:info_nombre_evenements',
77 'titre' => 'titre, "" AS lang',
78 'date' => 'date_debut',
79 'principale' => 'oui',
80 'champs_editables' => array('date_debut', 'date_fin', 'titre', 'descriptif','lieu', 'adresse', 'inscription', 'places', 'horaire'),
81 'field'=> array(
82 "id_evenement" => "bigint(21) NOT NULL",
83 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
84 "date_debut" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
85 "date_fin" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
86 "titre" => "text NOT NULL DEFAULT ''",
87 "descriptif" => "text NOT NULL DEFAULT ''",
88 "lieu" => "text NOT NULL DEFAULT ''",
89 "adresse" => "text NOT NULL DEFAULT ''",
90 "inscription" => "tinyint(1) DEFAULT 0 NOT NULL",
91 "places" => "int(11) DEFAULT 0 NOT NULL",
92 "horaire" => "varchar(3) DEFAULT 'oui' NOT NULL",
93 "id_evenement_source" => "bigint(21) NOT NULL",
94 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
95 "maj" => "TIMESTAMP"
96 ),
97 'key' => array(
98 "PRIMARY KEY" => "id_evenement",
99 "KEY date_debut" => "date_debut",
100 "KEY date_fin" => "date_fin",
101 "KEY id_article" => "id_article"
102 ),
103 'join' => array(
104 "id_evenement"=>"id_evenement",
105 "id_article"=>"id_article"
106 ),
107 'tables_jointures' => array(
108 'articles',
109 'evenements_participants',
110 ),
111 'rechercher_champs' => array(
112 'titre' => 8, 'descriptif' => 5, 'lieu' => 5, 'adresse' => 3
113 ),
114 'rechercher_jointures' => array(
115 'document' => array('titre' => 2, 'descriptif' => 1)
116 ),
117 'statut' => array(
118 array(
119 'champ' => 'statut',
120 'publie' => 'publie',
121 'previsu' => '!',
122 'exception' => array('statut','tout')
123 ),
124 ),
125 'statut_titres' => array(
126 'prop'=>'agenda:info_evenement_propose',
127 'publie'=>'agenda:info_evenement_publie',
128 'poubelle'=>'agenda:info_evenement_supprime'
129 ),
130 'statut_textes_instituer' => array(
131 'prop' => 'texte_statut_propose_evaluation',
132 'publie' => 'texte_statut_publie',
133 'poubelle' => 'texte_statut_poubelle',
134 ),
135 'texte_changer_statut' => 'agenda:texte_evenement_statut',
136 'champs_versionnes' => array('id_article', 'titre', 'descriptif', 'lieu', 'adresse'),
137
138 );
139
140 //-- Jointures ----------------------------------------------------
141 $tables['spip_articles']['tables_jointures'][] = 'evenements';
142 $tables['spip_auteurs']['tables_jointures'][] = 'evenements_participants';
143 $tables['spip_rubriques']['field']['agenda'] = 'tinyint(1) DEFAULT 0 NOT NULL';
144
145 return $tables;
146 }
147
148 ?>