#PHP
[(#INCLURE{fond=fabrique/entetes/php,env,
description=Déclarations relatives à la base de données,
package=Pipelines})]
/**
* 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 [(#PREFIXE)]_declarer_tables_interfaces($interfaces) {
$interfaces['table_des_tables']['#OBJET'] = '#OBJET';
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 [(#PREFIXE)]_declarer_tables_objets_sql($tables) {
[(#SET{_id_parent,#VALEUR{parent/id_objet}})
] $tables['#TABLE'] = array(
'type' => '#TYPE',
'principale' => 'oui',[(#OBJETS_SURNOMS|oui)
'table_objet_surnoms' => [(#OBJETS_SURNOMS|ecrire_tableau)], // table_objet('#TYPE') => '#LOBJET' ]
'field'=> array(
[(#VAL{['(#ID_OBJET)']} |espacer)] => '#CLE_PRIMAIRE_SQL',[
[(#GET{_id_parent}|_q |espacer)] => 'bigint(21) NOT NULL DEFAULT 0',(#GET{_id_parent}|oui)][
[(#VAL{"'id_secteur'"} |espacer)] => 'bigint(21) NOT NULL DEFAULT 0',(#VALEUR|champ_present{id_secteur})]
[(#VAL{['(#CHAMP)']} |espacer)] => '[(#SQL|replace{"'",'"'})]',[
[(#VAL{['(#CHAMP_DATE)']} |espacer)] => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',(#CHAMP_DATE|oui)][
[(#VAL{"'statut'"} |espacer)] => 'varchar(20) DEFAULT "0" NOT NULL',(#STATUT|oui)][
[(#VAL{"'lang'"} |espacer)] => 'VARCHAR(10) NOT NULL DEFAULT ""',
[(#VAL{"'langue_choisie'"}|espacer)] => 'VARCHAR(3) DEFAULT "non"',(#VALEUR|champ_present{lang})][
[(#VAL{"'id_trad'"} |espacer)] => 'bigint(21) NOT NULL DEFAULT 0',(#VALEUR|champ_present{id_trad})]
[(#VAL{"'maj'"} |espacer)] => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'
),
'key' => array(
[(#VAL{"'PRIMARY KEY'"} |espacer)] => '#ID_OBJET',[
[(#VAL{"'KEY "}|concat{#GET{_id_parent}}|concat{"'"} |espacer)] => '(#GET{_id_parent})',][
[(#VAL{"'KEY id_secteur'"} |espacer)] => 'id_secteur',(#VALEUR|champ_present{id_secteur})][
[(#VAL{"'KEY lang'"} |espacer)] => 'lang',(#VALEUR|champ_present{lang})][
[(#VAL{"'KEY id_trad'"} |espacer)] => 'id_trad',(#VALEUR|champ_present{id_trad})][
[(#VAL{"'KEY statut'"} |espacer)] => 'statut',(#VALEUR|champ_present{statut})]
),
'titre' => '[(#CHAMP_TITRE|sinon{'""'})] AS titre, [(#VALEUR|champ_present{lang}|?{lang,'""'})] AS lang',
[(#CHAMP_DATE|non)#]'date' => '[(#CHAMP_DATE)]',
'champs_editables' => [(#VALEUR|fabrique_lister_objet_champs{editable}|ecrire_tableau)],
'champs_versionnes' => [(#VALEUR|fabrique_lister_objet_champs{versionne}|ecrire_tableau)],
'rechercher_champs' => array(=1 }{", "}>["(#VALEUR{champ})"] => #VALEUR{recherche}),
'tables_jointures' => array(['(#NOM_TABLE_LIENS)']),[
'statut_textes_instituer' => array(
'prepa' => 'texte_statut_en_cours_redaction',
'prop' => 'texte_statut_propose_evaluation',
'publie' => 'texte_statut_publie',
'refuse' => 'texte_statut_refuse',
'poubelle' => 'texte_statut_poubelle',
),
'statut'=> array(
array(
'champ' => 'statut',
'publie' => 'publie',
'previsu' => 'publie,prop,prepa',
'post_date' => 'date',
'exception' => array('statut','tout')
)
),
'texte_changer_statut' => '#TYPE:texte_changer_statut_#TYPE',(#STATUT|oui)]
#SET{roles,#VALEUR|fabrique_description_roles}
'roles_colonne' => '#GET{roles/roles_colonne}',
'roles_titres' => array(
'#CLE'=>'#VALEUR',
),
'roles_objets' => array(
'#CLE' => array(
'choix' => [(#VALEUR|ecrire_tableau)],
'defaut' => '#GET{roles/roles_defaut}'),
),
);
return $tables;
}
/**
* Déclaration des tables secondaires (liaisons)
*
* @pipeline declarer_tables_auxiliaires
* @param array $tables
* Description des tables
* @return array
* Description complétée des tables
*/
function [(#PREFIXE)]_declarer_tables_auxiliaires($tables) {
$tables['#NOM_TABLE_LIENS'] = array(
'field' => array(
[(#VAL{['(#ID_OBJET)']} |espacer)] => 'bigint(21) DEFAULT "0" NOT NULL',
[(#VAL{"'id_objet'"} |espacer)] => 'bigint(21) DEFAULT "0" NOT NULL',
[(#VAL{"'objet'"} |espacer)] => 'VARCHAR(25) DEFAULT "" NOT NULL',[
[(#VAL{"'role'"} |espacer)] => 'VARCHAR(25) DEFAULT ""',(#VALEUR|options_presentes{#LISTE{table_liens,roles}})]
[(#VAL{"'vu'"} |espacer)] => 'VARCHAR(6) DEFAULT "non" NOT NULL',
),
'key' => array(
[(#VAL{"'PRIMARY KEY'"} |espacer)] => '#ID_OBJET,id_objet,objet[(#VALEUR|options_presentes{#LISTE{table_liens,roles}}|?{",role"})]',
[(#VAL{['KEY (#ID_OBJET)']} |espacer)] => '#ID_OBJET',
)
);
return $tables;
}
[
(#ENV*{paquet/inserer/base/tables/fin})
]