libreavous/base/libreavous.php

218 lines
5.8 KiB
PHP
Raw Normal View History

<?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_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' => '5',
'cols' => '40',
'sql' => 'text DEFAULT \'\' NOT NULL',
),
'verifier' => array(
),
);
$champs['spip_articles']['podcast_galeriephotos'] = array(
'saisie' => 'textarea',
'options' => array(
'nom' => 'podcast_galeriephotos',
'label' => 'Galerie Photos',
'rows' => '5',
'cols' => '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',
),
'verifier' => array(
),
);
$champs['spip_articles']['drupal_guid'] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'drupal_guid',
'label' => 'GUID Drupral',
'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(
),
);
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 ""',
'drupal_guid' => 'varchar(255) NOT NULL DEFAULT ""',
'drupal_pubdate' => 'varchar(255) NOT NULL DEFAULT ""',
'references_sujet' => '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', 'drupal_guid', 'drupal_pubdate', 'id_article'),
'champs_versionnes' => array('titre', 'code', 'code_fichier', 'code_podcast', 'debut', 'fin', 'type_sujet', 'chronique', 'mp3', 'ogg', 'drupal_guid', 'drupal_pubdate', 'id_article'),
'rechercher_champs' => array("titre" => 5),
'tables_jointures' => array(),
);
return $tables;
}