gamuMail/base/gamumail.php

78 lines
2 KiB
PHP

<?php
/**
* Déclarations relatives à la base de données
*
* @plugin GamuMail
* @copyright 2020
* @author tofulm
* @licence GNU/GPL
* @package SPIP\Gamumail\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 gamumail_declarer_tables_interfaces($interfaces) {
$interfaces['table_des_tables']['gamumails'] = 'gamumails';
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 gamumail_declarer_tables_objets_sql($tables) {
$tables['spip_gamumails'] = array(
'type' => 'gamumail',
'principale' => 'oui',
'field'=> array(
'id_gamumail' => 'bigint(21) NOT NULL',
'slug' => 'varchar(255) NOT NULL DEFAULT ""',
'titre' => 'varchar(255) NOT NULL DEFAULT ""',
'sujet' => 'varchar(255) NOT NULL DEFAULT ""',
'texte' => 'text NOT NULL DEFAULT ""',
'statut' => 'varchar(20) DEFAULT "0" NOT NULL',
'maj' => 'TIMESTAMP'
),
'key' => array(
'PRIMARY KEY' => 'id_gamumail',
'KEY statut' => 'statut',
),
'titre' => 'slug AS titre, "" AS lang',
#'date' => '',
'champs_editables' => array('slug', 'sujet', 'texte','titre'),
'champs_versionnes' => array('slug', 'sujet', 'texte','titre'),
'rechercher_champs' => array("slug" => 8),
'tables_jointures' => array(),
'statut'=> array(
array(
'champ' => 'statut',
'publie' => 'publie',
'exception' => array('statut','tout')
)
),
'texte_changer_statut' => 'gamumail:texte_changer_statut_gamumail',
);
return $tables;
}