[PLUGINS] +clavettes et dependances
[lhc/web/clavette_www.git] / www / plugins / import_ics / base / import_ics.php
1 <?php
2 /**
3 * Déclarations relatives à la base de données
4 *
5 * @plugin Import_ics
6 * @copyright 2013
7 * @author Amaury
8 * @licence GNU/GPL
9 * @package SPIP\Import_ics\Pipelines
10 */
11
12 if (!defined('_ECRIRE_INC_VERSION')) return;
13 /**
14 * Déclaration des alias de tables et filtres automatiques de champs
15 *
16 * @pipeline declarer_tables_interfaces
17 * @param array $interfaces
18 * Déclarations d'interface pour le compilateur
19 * @return array
20 * Déclarations d'interface pour le compilateur
21 */
22 function import_ics_declarer_tables_interfaces($interfaces) {
23
24 $interfaces['table_des_tables']['almanachs'] = 'almanachs';
25
26 return $interfaces;
27 }
28
29
30 /**
31 * Déclaration des objets éditoriaux
32 *
33 * @pipeline declarer_tables_objets_sql
34 * @param array $tables
35 * Description des tables
36 * @return array
37 * Description complétée des tables
38 */
39 function import_ics_declarer_tables_objets_sql($tables) {
40
41 $tables['spip_almanachs'] = array(
42 'type' => 'almanach',
43 'principale' => "oui",
44 'field'=> array(
45 "id_almanach" => "bigint(21) NOT NULL",
46 "titre" => "text NOT NULL DEFAULT ''",
47 "url" => "text NOT NULL DEFAULT ''",
48 "id_article" => "bigint(21) NOT NULL DEFAULT 0",
49 "id_mot" => "bigint(21) NOT NULL DEFAULT 0",
50 "id_ressource" => "bigint(21) NOT NULL DEFAULT 0",
51 "date" => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
52 "statut" => "varchar(20) DEFAULT '0' NOT NULL",
53 "maj" => "TIMESTAMP",
54 "statut_maj" => "varchar(20) DEFAULT '0' NOT NULL"
55 ),
56 'key' => array(
57 "PRIMARY KEY" => "id_almanach",
58 "KEY statut" => "statut",
59 ),
60 'titre' => "titre AS titre, '' AS lang",
61 'date' => "date",
62 'champs_editables' => array('titre', 'url', 'id_article', 'id_mot', 'id_ressource'),
63 'champs_versionnes' => array('titre', 'url', 'id_article', 'id_mot', 'id_ressource'),
64 'rechercher_champs' => array(),
65 'tables_jointures' => array('spip_almanachs_liens'),
66 'statut_textes_instituer' => array(
67 'prepa' => 'texte_statut_en_cours_redaction',
68 'prop' => 'texte_statut_propose_evaluation',
69 'publie' => 'texte_statut_publie',
70 'refuse' => 'texte_statut_refuse',
71 'poubelle' => 'texte_statut_poubelle',
72 ),
73 'statut'=> array(
74 array(
75 'champ' => 'statut',
76 'publie' => 'publie',
77 'previsu' => 'publie,prop,prepa',
78 'post_date' => 'date',
79 'exception' => array('statut','tout')
80 )
81 ),
82 'texte_changer_statut' => 'almanach:texte_changer_statut_almanach',
83
84
85 );
86
87 return $tables;
88 }
89
90
91 /**
92 * Déclaration des tables secondaires (liaisons)
93 *
94 * @pipeline declarer_tables_auxiliaires
95 * @param array $tables
96 * Description des tables
97 * @return array
98 * Description complétée des tables
99 */
100 function import_ics_declarer_tables_auxiliaires($tables) {
101
102 $tables['spip_almanachs_liens'] = array(
103 'field' => array(
104 "id_almanach" => "bigint(21) DEFAULT '0' NOT NULL",
105 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
106 "objet" => "VARCHAR(25) DEFAULT '' NOT NULL",
107 "vu" => "VARCHAR(6) DEFAULT 'non' NOT NULL"
108 ),
109 'key' => array(
110 "PRIMARY KEY" => "id_almanach,id_objet,objet",
111 "KEY id_almanach" => "id_almanach"
112 )
113 );
114
115 return $tables;
116 }
117
118
119 ?>