|
|
|
@ -18,11 +18,13 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_formulaire_fond($flux) { |
|
|
|
|
if (($env = $flux['args']['contexte']) |
|
|
|
|
and ($flux['args']['form'] == 'editer_mot') |
|
|
|
|
and isset($env['id_groupe']) |
|
|
|
|
and ($id_groupe = (int) ($env['id_groupe']))) { |
|
|
|
|
function svptype_formulaire_fond(array $flux) : array { |
|
|
|
|
if ( |
|
|
|
|
($env = $flux['args']['contexte']) |
|
|
|
|
and ($flux['args']['form'] === 'editer_mot') |
|
|
|
|
and isset($env['id_groupe']) |
|
|
|
|
and ($id_groupe = (int) ($env['id_groupe'])) |
|
|
|
|
) { |
|
|
|
|
// Formulaire d'édition d'un mot : |
|
|
|
|
// -- on teste si c'est un mot plugin (catégorie ou tag) |
|
|
|
|
include_spip('inc/svptype_mot'); |
|
|
|
@ -92,7 +94,7 @@ function svptype_formulaire_fond($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_formulaire_verifier($flux) { |
|
|
|
|
function svptype_formulaire_verifier(array $flux) : array { |
|
|
|
|
if ($flux['args']['form'] == 'editer_mot') { |
|
|
|
|
// Formulaire d'édition d'un mot : |
|
|
|
|
// -- on récupère l'id du groupe. |
|
|
|
@ -110,8 +112,10 @@ function svptype_formulaire_verifier($flux) {
|
|
|
|
|
// il faut exclure de la liste le mot lui-même si il existe déjà. |
|
|
|
|
$where[] = 'id_mot!=' . $id_mot; |
|
|
|
|
} |
|
|
|
|
if (($identifiants = sql_allfetsel('identifiant', $from, $where)) |
|
|
|
|
and (in_array($identifiant, array_map('reset', $identifiants)))) { |
|
|
|
|
if ( |
|
|
|
|
($identifiants = sql_allfetsel('identifiant', $from, $where)) |
|
|
|
|
and (in_array($identifiant, array_map('reset', $identifiants))) |
|
|
|
|
) { |
|
|
|
|
$flux['data']['identifiant'] = _T('svptype:identifiant_erreur_duplication'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -134,12 +138,14 @@ function svptype_formulaire_verifier($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_pre_insertion($flux) { |
|
|
|
|
if ($flux['args']['table'] == 'spip_mots') { |
|
|
|
|
function svptype_pre_insertion(array $flux) : array { |
|
|
|
|
if ($flux['args']['table'] === 'spip_mots') { |
|
|
|
|
// Création d'un mot : |
|
|
|
|
// -- L'identifiant et l'id du groupe doivent être fournis |
|
|
|
|
if ($identifiant = _request('identifiant') |
|
|
|
|
and ($id_groupe = (int) (_request('id_groupe')))) { |
|
|
|
|
if ( |
|
|
|
|
$identifiant = _request('identifiant') |
|
|
|
|
and ($id_groupe = (int) (_request('id_groupe'))) |
|
|
|
|
) { |
|
|
|
|
include_spip('inc/svptype_mot'); |
|
|
|
|
// On teste si c'est un mot plugin (catégorie ou tag) |
|
|
|
|
if (groupe_est_typologie_plugin($id_groupe)) { |
|
|
|
@ -163,13 +169,17 @@ function svptype_pre_insertion($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_pre_edition($flux) { |
|
|
|
|
if ($flux['args']['table'] == 'spip_mots' |
|
|
|
|
and $flux['args']['action'] == 'modifier') { |
|
|
|
|
function svptype_pre_edition(array $flux) : array { |
|
|
|
|
if ( |
|
|
|
|
($flux['args']['table'] === 'spip_mots') |
|
|
|
|
and ($flux['args']['action'] === 'modifier') |
|
|
|
|
) { |
|
|
|
|
// Edition d'un mot : |
|
|
|
|
// -- L'identifiant et l'id du groupe doivent être fournis |
|
|
|
|
if ($identifiant = _request('identifiant') |
|
|
|
|
and ($id_groupe = (int) (_request('id_groupe')))) { |
|
|
|
|
if ( |
|
|
|
|
($identifiant = _request('identifiant')) |
|
|
|
|
and ($id_groupe = (int) (_request('id_groupe'))) |
|
|
|
|
) { |
|
|
|
|
// On teste si c'est un mot plugin (catégorie ou tag) |
|
|
|
|
include_spip('inc/svptype_mot'); |
|
|
|
|
if (groupe_est_typologie_plugin($id_groupe)) { |
|
|
|
@ -185,17 +195,23 @@ function svptype_pre_edition($flux) {
|
|
|
|
|
* Exclure les groupes de mots et les mots-clés relatifs à une typologie de plugin si le critère typologie_plugin |
|
|
|
|
* n'est pas explicitement utilisé. |
|
|
|
|
* |
|
|
|
|
* @param object $boucle Description de la boucle. |
|
|
|
|
* @param Boucle $boucle Description de la boucle. |
|
|
|
|
* |
|
|
|
|
* @return object Description complétée de la boucle. |
|
|
|
|
* @return Boucle Description complétée de la boucle. |
|
|
|
|
**/ |
|
|
|
|
function svptype_pre_boucle($boucle) { |
|
|
|
|
function svptype_pre_boucle(Boucle $boucle) : Boucle { |
|
|
|
|
// Vérifier qu'on n'a pas un critère utilisant l'id de la table auquel cas on ne fait. |
|
|
|
|
if ((($boucle->type_requete == 'mots') |
|
|
|
|
and (!isset($boucle->modificateur['criteres']['id_mot'])) |
|
|
|
|
and (!isset($boucle->modificateur['criteres']['id_groupe']))) |
|
|
|
|
or (($boucle->type_requete == 'groupes_mots') |
|
|
|
|
and (!isset($boucle->modificateur['criteres']['id_groupe'])))) { |
|
|
|
|
if ( |
|
|
|
|
( |
|
|
|
|
($boucle->type_requete === 'mots') |
|
|
|
|
and !isset($boucle->modificateur['criteres']['id_mot']) |
|
|
|
|
and !isset($boucle->modificateur['criteres']['id_groupe']) |
|
|
|
|
) |
|
|
|
|
or ( |
|
|
|
|
($boucle->type_requete === 'groupes_mots') |
|
|
|
|
and !isset($boucle->modificateur['criteres']['id_groupe']) |
|
|
|
|
) |
|
|
|
|
) { |
|
|
|
|
// Vérification de l'existence ou pas du critère {typologie_plugin} |
|
|
|
|
$typologie_plugin = false; |
|
|
|
|
foreach ($boucle->criteres as $_critere) { |
|
|
|
@ -240,19 +256,24 @@ function svptype_pre_boucle($boucle) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_afficher_contenu_objet($flux) { |
|
|
|
|
function svptype_afficher_contenu_objet(array $flux) : array { |
|
|
|
|
// On est bien en présence d'un objet |
|
|
|
|
if (isset($flux['args']['type'], $flux['args']['id_objet'])) { |
|
|
|
|
// Détermination de l'objet affiché |
|
|
|
|
$objet = $flux['args']['type']; |
|
|
|
|
$id_objet = $flux['args']['id_objet']; |
|
|
|
|
|
|
|
|
|
if (($objet == 'mot') and $id_objet) { |
|
|
|
|
if ( |
|
|
|
|
($objet === 'mot') |
|
|
|
|
and $id_objet |
|
|
|
|
) { |
|
|
|
|
// On est bien en présence d'un mot: |
|
|
|
|
// -- on teste si c'est un mot plugin (catégorie ou tag) |
|
|
|
|
include_spip('inc/svptype_mot'); |
|
|
|
|
if (($id_groupe = mot_lire_groupe($id_objet)) |
|
|
|
|
and groupe_est_typologie_plugin($id_groupe)) { |
|
|
|
|
if ( |
|
|
|
|
($id_groupe = mot_lire_groupe($id_objet)) |
|
|
|
|
and groupe_est_typologie_plugin($id_groupe) |
|
|
|
|
) { |
|
|
|
|
// On affiche l'identifiant du mot |
|
|
|
|
$contexte = ['id_mot' => $id_objet]; |
|
|
|
|
$html_identifiant = recuperer_fond('prive/squelettes/inclure/inc-type_plugin_identifiant', $contexte); |
|
|
|
@ -275,12 +296,13 @@ function svptype_afficher_contenu_objet($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline mise à jour. |
|
|
|
|
*/ |
|
|
|
|
function svptype_affiche_milieu($flux) { |
|
|
|
|
function svptype_affiche_milieu(array $flux) : array { |
|
|
|
|
// Si on est sur la page d'un plugin, il faut inserer les formulaires d'affectations des types de plugin. |
|
|
|
|
if (($exec = trouver_objet_exec($flux['args']['exec'])) |
|
|
|
|
if ( |
|
|
|
|
($exec = trouver_objet_exec($flux['args']['exec'])) |
|
|
|
|
and ($exec['edition'] !== true) // page visu |
|
|
|
|
and ($type = $exec['type']) |
|
|
|
|
and ($type == 'plugin') |
|
|
|
|
and ($type === 'plugin') |
|
|
|
|
and ($id_table_objet = $exec['id_table_objet']) |
|
|
|
|
and isset($flux['args'][$id_table_objet]) |
|
|
|
|
and ($id_plugin = (int) ($flux['args'][$id_table_objet])) |
|
|
|
@ -322,9 +344,9 @@ function svptype_affiche_milieu($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Flux mis à jour |
|
|
|
|
*/ |
|
|
|
|
function svptype_affiche_droite($flux) { |
|
|
|
|
function svptype_affiche_droite(array $flux) : array { |
|
|
|
|
if ( |
|
|
|
|
($flux['args']['exec'] == 'plugin') |
|
|
|
|
($flux['args']['exec'] === 'plugin') |
|
|
|
|
and isset($flux['args']['id_plugin']) |
|
|
|
|
and ($id_plugin = (int) ($flux['args']['id_plugin'])) |
|
|
|
|
) { |
|
|
|
@ -375,7 +397,7 @@ function svptype_affiche_droite($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Collections complétées. |
|
|
|
|
*/ |
|
|
|
|
function svptype_liste_ezcollection($collections) { |
|
|
|
|
function svptype_liste_ezcollection(array $collections) : array { |
|
|
|
|
// Les index désignent les collections. SVP Typologie rajoute : |
|
|
|
|
// -- les collections correspondant aux typologies supportées |
|
|
|
|
include_spip('inc/config'); |
|
|
|
@ -435,7 +457,7 @@ function svptype_liste_ezcollection($collections) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_post_ezcollection($flux) { |
|
|
|
|
function svptype_post_ezcollection(array $flux) : array { |
|
|
|
|
// Extraction des informations sur la collection. |
|
|
|
|
// La collection et la configuration existent toujours. |
|
|
|
|
$collection = $flux['args']['collection']; |
|
|
|
@ -485,7 +507,7 @@ function svptype_post_ezcollection($flux) {
|
|
|
|
|
* |
|
|
|
|
* @return array Données du pipeline complétées |
|
|
|
|
**/ |
|
|
|
|
function svptype_post_ezressource($flux) { |
|
|
|
|
function svptype_post_ezressource(array $flux) : array { |
|
|
|
|
// Extraction des informations sur la collection. |
|
|
|
|
// La collection et la configuration existent toujours. |
|
|
|
|
$collection = $flux['args']['collection']; |
|
|
|
|