libreavous/base/libreavous.php
2021-10-05 11:29:09 +02:00

283 lines
7.4 KiB
PHP

<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
// des champs extras sur les articles
function libreavous_declarer_champs_extras($champs = array()) {
// Table : spip_articles
if (isset($champs['spip_articles']) and !is_array($champs['spip_articles'])) {
$champs['spip_articles'] = array();
}
$champs['spip_articles']['podcast_sommaire'] = array(
'saisie' => 'textarea',
'options' => array(
'nom' => 'podcast_sommaire',
'label' => 'Sommaire',
'rows' => '10',
'cols' => '40',
'sql' => 'text DEFAULT \'\' NOT NULL',
'inserer_barre' => 'edition',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_code'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'podcast_code',
'label' => 'Code',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_duree'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'podcast_duree',
'label' => 'Durée',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_mp3'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'podcast_mp3',
'label' => 'Taille mp3',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_ogg'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'podcast_ogg',
'label' => 'Taille Ogg',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_transcription'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'podcast_transcription',
'label' => 'Lien transcription',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_personnes'] = array(
'saisie' => 'textarea',
'options' => array(
'nom' => 'podcast_personnes',
'label' => 'Personnes participantes',
'rows' => '10',
'cols' => '40',
'sql' => 'text DEFAULT \'\' NOT NULL',
'inserer_barre' => 'edition',
'rechercher' => 5,
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_references'] = array(
'saisie' => 'textarea',
'options' => array(
'nom' => 'podcast_references',
'label' => 'Références',
'rows' => '20',
'cols' => '40',
'sql' => 'text DEFAULT \'\' NOT NULL',
'inserer_barre' => 'edition',
'rechercher' => 5,
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_galeriephotos'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'podcast_galeriephotos',
'label' => 'Galerie Photos',
'type' => 'text',
'size' => '40',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_musique'] = array(
'saisie' => 'textarea',
'options' => array(
'nom' => 'podcast_musique',
'label' => 'Pauses musicales',
'rows' => '5',
'cols' => '40',
'sql' => 'text DEFAULT \'\' NOT NULL',
'inserer_barre' => 'edition',
'rechercher' => 5,
),
'verifier' => array(
),
);
$champs['spip_articles']['drupal_guid'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'drupal_guid',
'label' => 'GUID Drupal',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['drupal_pubdate'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'drupal_pubdate',
'label' => 'PubDate Drupal',
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['chronique'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'chronique',
'label' => _T('libreavous:chronique_label'),
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
'explication' => _T('libreavous:chronique_explications'),
),
'verifier' => array(
),
);
$champs['spip_articles']['description_rss'] = array(
'saisie' => 'textarea',
'options' => array(
'nom' => 'description_rss',
'label' => _T('libreavous:description_rss_label'),
'type' => 'text',
'size' => '40',
'autocomplete' => 'defaut',
'sql' => 'text DEFAULT \'\' NOT NULL',
'explication' => _T('libreavous:description_rss_explications'),
),
'verifier' => array(
),
);
return $champs;
}
// un nouvel objet chapitre
/**
* 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 libreavous_declarer_tables_interfaces($interfaces) {
$interfaces['table_des_tables']['chapitres'] = 'chapitres';
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 libreavous_declarer_tables_objets_sql($tables) {
$tables['spip_chapitres'] = array(
'type' => 'chapitre',
'principale' => 'oui',
'field'=> array(
'id_chapitre' => 'bigint(21) NOT NULL',
'id_article' => 'bigint(21) NOT NULL DEFAULT 0',
'titre' => 'tinytext NOT NULL DEFAULT ""',
'code' => 'tinytext NOT NULL DEFAULT ""',
'code_fichier' => 'tinytext NOT NULL DEFAULT ""',
'code_podcast' => 'varchar(255) NOT NULL DEFAULT ""',
'debut' => 'varchar(25) NOT NULL DEFAULT ""',
'fin' => 'varchar(25) NOT NULL DEFAULT ""',
'type_sujet' => 'varchar(25) NOT NULL DEFAULT ""',
'chronique' => 'varchar(255) NOT NULL DEFAULT ""',
'mp3' => 'varchar(255) NOT NULL DEFAULT ""',
'ogg' => 'varchar(255) NOT NULL DEFAULT ""',
'references_sujet' => 'text NOT NULL DEFAULT ""',
'drupal_guid' => 'varchar(255) NOT NULL DEFAULT ""',
'drupal_pubdate' => 'varchar(255) NOT NULL DEFAULT ""',
'description_rss' => 'text NOT NULL DEFAULT ""',
'maj' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
),
'key' => array(
'PRIMARY KEY' => 'id_chapitre',
'KEY id_article' => 'id_article',
),
'titre' => 'titre AS titre, "" AS lang',
#'date' => '',
'champs_editables' => array('titre', 'code', 'code_fichier', 'code_podcast', 'debut', 'fin', 'type_sujet', 'chronique', 'mp3', 'ogg', 'references_sujet', 'drupal_guid', 'drupal_pubdate', 'id_article', 'description_rss'),
'champs_versionnes' => array('titre', 'code', 'code_fichier', 'code_podcast', 'debut', 'fin', 'type_sujet', 'chronique', 'mp3', 'ogg', 'references_sujet', 'drupal_guid', 'drupal_pubdate', 'id_article', 'description_rss'),
'rechercher_champs' => array("titre" => 8, "references_sujet" => 5, "description_rss" => 5),
'tables_jointures' => array(),
);
return $tables;
}