gamuMail/base/gamumail.php

101 lines
2.9 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';
//$interfaces['table_des_tables']['gamumail_pdfs'] = 'gamumail_pdfs';
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 ""',
'id_docs' => 'text NOT NULL DEFAULT ""',
'statut' => 'varchar(20) DEFAULT "0" NOT NULL',
'public' => 'varchar(20) DEFAULT "oui" NOT NULL',
'editable' => 'varchar(5) DEFAULT "oui" NOT NULL',
'date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',
'maj' => 'TIMESTAMP',
'rang' => 'smallint(6) NOT NULL'
),
'key' => array(
'PRIMARY KEY' => 'id_gamumail',
'KEY statut' => 'statut',
),
// 'titre' => 'slug AS titre, "" AS lang',
#'date' => '',
'champs_editables' => array('slug', 'sujet', 'texte','titre', 'editable', 'public', 'id_docs', 'rang', 'statut', 'date'),
'champs_versionnes' => array('slug', 'sujet', 'texte','titre', 'editable', 'public', 'id_docs', 'rang', 'statut', 'date'),
'rechercher_champs' => array("slug" => 8),
'tables_jointures' => array(),
'statut'=> array(
array(
'champ' => 'statut',
'publie' => 'publie',
'previsu' => '!',
'exception' => array('statut','tout')
)
),
'texte_changer_statut' => 'gamumail:texte_changer_statut_gamumail',
);
//$tables['spip_gamumail_pdfs'] = array(
//'type' => 'gamumail_pdf',
//'principale' => 'oui',
//'field'=> array(
//'id_gamumail_pdf' => 'bigint(21) NOT NULL',
//'id_gamumail' => 'bigint(21) NOT NULL',
//'pdf' => 'varchar(255) NOT NULL DEFAULT ""',
//'args' => 'varchar(255) NOT NULL DEFAULT ""',
//'maj' => 'TIMESTAMP'
//),
//'key' => array(
//'PRIMARY KEY' => 'id_gamumail_pdf',
//'KEY id_gamumail' => 'id_gamumail',
//)
//);
return $tables;
}