115 lines
2.9 KiB
PHP
115 lines
2.9 KiB
PHP
<?php
|
|
/**
|
|
* Déclarations relatives à la base de données
|
|
*
|
|
* @plugin GamuForm
|
|
* @copyright 2020
|
|
* @author tofulm
|
|
* @licence GNU/GPL
|
|
* @package SPIP\Gamuform\Pipelines
|
|
*/
|
|
|
|
if (!defined('_ECRIRE_INC_VERSION')) {
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* Déclaration des alias de tables et filtres automatiques de champs
|
|
*
|
|
* @pipeline declarer_tables_interfaces
|
|
* @param array $interfaces
|
|
* Déclarations d'interface pour le compilateur
|
|
* @return array
|
|
* Déclarations d'interface pour le compilateur
|
|
*/
|
|
function gamuform_declarer_tables_interfaces($interfaces) {
|
|
|
|
$interfaces['table_des_tables']['gamuforms'] = 'gamuforms';
|
|
|
|
return $interfaces;
|
|
}
|
|
|
|
|
|
/**
|
|
* Déclaration des objets éditoriaux
|
|
*
|
|
* @pipeline declarer_tables_objets_sql
|
|
* @param array $tables
|
|
* Description des tables
|
|
* @return array
|
|
* Description complétée des tables
|
|
*/
|
|
function gamuform_declarer_tables_objets_sql($tables) {
|
|
|
|
$tables['spip_gamuforms'] = array(
|
|
'type' => 'gamuform',
|
|
'principale' => 'oui',
|
|
'field'=> array(
|
|
'id_gamuform' => 'bigint(21) NOT NULL',
|
|
'titre' => 'varchar(255) NOT NULL DEFAULT ""',
|
|
'date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',
|
|
'statut' => 'varchar(20) DEFAULT "0" NOT NULL',
|
|
'maj' => 'TIMESTAMP'
|
|
),
|
|
'key' => array(
|
|
'PRIMARY KEY' => 'id_gamuform',
|
|
'KEY statut' => 'statut',
|
|
),
|
|
'titre' => 'titre AS titre, "" AS lang',
|
|
'date' => 'date',
|
|
'champs_editables' => array('titre'),
|
|
'champs_versionnes' => array('titre'),
|
|
'rechercher_champs' => array(),
|
|
'tables_jointures' => array('spip_gamuforms_liens'),
|
|
'statut_textes_instituer' => array(
|
|
'prepa' => 'texte_statut_en_cours_redaction',
|
|
'prop' => 'texte_statut_propose_evaluation',
|
|
'publie' => 'texte_statut_publie',
|
|
'refuse' => 'texte_statut_refuse',
|
|
'poubelle' => 'texte_statut_poubelle',
|
|
),
|
|
'statut'=> array(
|
|
array(
|
|
'champ' => 'statut',
|
|
'publie' => 'publie',
|
|
'previsu' => 'publie,prop,prepa',
|
|
'post_date' => 'date',
|
|
'exception' => array('statut','tout')
|
|
)
|
|
),
|
|
'texte_changer_statut' => 'gamuform:texte_changer_statut_gamuform',
|
|
|
|
|
|
);
|
|
|
|
return $tables;
|
|
}
|
|
|
|
|
|
/**
|
|
* Déclaration des tables secondaires (liaisons)
|
|
*
|
|
* @pipeline declarer_tables_auxiliaires
|
|
* @param array $tables
|
|
* Description des tables
|
|
* @return array
|
|
* Description complétée des tables
|
|
*/
|
|
function gamuform_declarer_tables_auxiliaires($tables) {
|
|
|
|
$tables['spip_gamuforms_liens'] = array(
|
|
'field' => array(
|
|
'id_gamuform' => 'bigint(21) DEFAULT "0" NOT NULL',
|
|
'id_objet' => 'bigint(21) DEFAULT "0" NOT NULL',
|
|
'objet' => 'VARCHAR(25) DEFAULT "" NOT NULL',
|
|
'vu' => 'VARCHAR(6) DEFAULT "non" NOT NULL',
|
|
),
|
|
'key' => array(
|
|
'PRIMARY KEY' => 'id_gamuform,id_objet,objet',
|
|
'KEY id_gamuform' => 'id_gamuform',
|
|
)
|
|
);
|
|
|
|
return $tables;
|
|
}
|