podcast/base/podcast.php

100 lines
2.9 KiB
PHP
Raw Normal View History

2021-02-10 07:46:37 +01:00
<?php
/**
* Déclarations relatives à la base de données
*
* @plugin podcast
* @copyright 2021
* @author chankalan,vcalame
* @licence GNU/GPL
* @package SPIP\Podcast\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 podcast_declarer_tables_interfaces($interfaces) {
$interfaces['table_des_tables']['podcasts'] = 'podcasts';
2021-02-11 09:42:41 +01:00
$interfaces['table_des_tables']['chapitres'] = 'chapitres';
2021-02-10 07:46:37 +01:00
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 podcast_declarer_tables_objets_sql($tables) {
$tables['spip_podcasts'] = array(
'type' => 'podcast',
'principale' => 'oui',
'field'=> array(
'id_podcast' => 'bigint(21) NOT NULL',
'id_article' => 'bigint(21) NOT NULL DEFAULT 0',
'code' => 'varchar(25) NOT NULL DEFAULT ""',
'fichier' => 'tinytext NOT NULL DEFAULT ""',
'duree' => 'varchar(25) NOT NULL DEFAULT ""',
2021-02-10 07:46:37 +01:00
'maj' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'
),
'key' => array(
'PRIMARY KEY' => 'id_podcast',
'KEY id_article' => 'id_article',
),
'titre' => 'code AS titre, "" AS lang',
#'date' => '',
'champs_editables' => array('code', 'fichier', 'duree', 'id_article'),
'champs_versionnes' => array('code', 'fichier', 'duree', 'id_article'),
2021-02-10 07:46:37 +01:00
'rechercher_champs' => array(),
'tables_jointures' => array(),
2021-02-11 09:42:41 +01:00
);
$tables['spip_chapitres'] = array(
'type' => 'chapitre',
'principale' => 'oui',
'field'=> array(
'id_chapitre' => 'bigint(21) NOT NULL',
'id_podcast' => 'bigint(21) NOT NULL DEFAULT 0',
'titre' => 'tinytext NOT NULL DEFAULT ""',
'nom_identifiant' => 'tinytext NOT NULL DEFAULT ""',
2021-02-11 22:29:11 +01:00
'sujet_principal' => 'tinyint(1) NOT NULL DEFAULT 0',
2021-02-11 09:42:41 +01:00
'debut' => 'varchar(25) NOT NULL DEFAULT ""',
'fin' => 'varchar(25) NOT NULL DEFAULT ""',
'maj' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'
),
'key' => array(
'PRIMARY KEY' => 'id_chapitre',
'KEY id_podcast' => 'id_podcast',
),
'titre' => 'titre AS titre, "" AS lang',
#'date' => '',
'champs_editables' => array('titre', 'nom_identifiant', 'sujet_principal', 'debut', 'fin', 'id_podcast'),
'champs_versionnes' => array('titre', 'nom_identifiant', 'sujet_principal', 'debut', 'fin', 'id_podcast'),
'rechercher_champs' => array("titre" => 5),
'tables_jointures' => array(),
2021-02-10 07:46:37 +01:00
);
return $tables;
}