3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined("_ECRIRE_INC_VERSION")) return; #securite
15 include_spip('inc/acces');
16 include_spip('inc/texte');
17 include_spip('inc/forum');
19 /*******************************/
20 /* GESTION DU FORMULAIRE FORUM */
21 /*******************************/
24 * Contexte du formulaire
25 * Mots-cles dans les forums :
26 * Si la variable de personnalisation $afficher_groupe[] est definie
27 * dans le fichier d'appel, et si la table de reference est OK, proposer
28 * la liste des mots-cles
29 * #FORMULAIRE_FORUM_PRIVE seul calcule (objet, id_objet) depuis la boucle parente
30 * #FORMULAIRE_FORUM_PRIVE{#SELF} pour forcer l'url de retour
31 * #FORMULAIRE_FORUM_PRIVE{#SELF, article, 3} pour forcer l'objet et son identifiant
32 * http://doc.spip.org/@balise_FORMULAIRE_FORUM_PRIVE
37 function balise_FORMULAIRE_FORUM_PRIVE ($p) {
40 * On recupere $objet et $id_objet depuis une boucle englobante si possible
41 * Sinon, on essaie aussi de recuperer des id_xx dans l'URL qui pourraient indiquer
42 * sur quoi le formulaire porte.
43 * Enfin, on pourra aussi forcer objet et id_objet depuis l'appel du formulaire
45 $i_boucle = $p->nom_boucle ?
$p->nom_boucle
: $p->id_boucle
;
46 if (isset($p->boucles
[$i_boucle])) {
47 $_id_objet = $p->boucles
[$i_boucle]->primary
;
48 $_type = $p->boucles
[$i_boucle]->id_table
;
50 $_id_objet = $_type = '';
54 * On essaye de trouver les forums en fonction de l'environnement
55 * pour cela, on recupere l'ensemble des id_xxx possibles dans l'env
57 $ids = forum_get_objets_depuis_env();
58 $ids = array_values($ids);
69 $obtenir = array_merge($obtenir, $ids);
72 $p = calculer_balise_dynamique($p,'FORMULAIRE_FORUM_PRIVE', $obtenir,
73 array("'$_type'", count($ids))
80 * Chercher l'objet/id_objet et la configuration du forum
82 * http://doc.spip.org/@balise_FORMULAIRE_FORUM_PRIVE_stat
85 * @param array $context_compil
88 function balise_FORMULAIRE_FORUM_PRIVE_stat($args, $context_compil) {
89 // un arg peut contenir l'url sur lequel faire le retour
90 // exemple dans un squelette article.html : [(#FORMULAIRE_FORUM_PRIVE{#SELF})]
91 // recuperer les donnees du forum auquel on repond.
92 // deux autres a la suite pour forcer objet et id_objet
93 // [(#FORMULAIRE_FORUM_PRIVE{#SELF, article, 8})]
96 // $args = (obtenir) + (ids) + (url, objet, id_objet)
97 $ido = array_shift($args);
98 $id_forum = intval(array_shift($args));
99 $afficher_texte = array_shift($args);
100 $statut = array_shift($args);
102 include_spip('balise/formulaire_forum');
103 // si statut privrac ou privadm, pas besoin d'objet !
104 $r = balise_forum_retrouve_objet($ido,$id_forum,$args,$context_compil,!in_array($statut,array('privrac','privadm')));
108 list($objet, $id_objet, $retour) = $r;
111 array($objet, $id_objet, $id_forum, $afficher_texte, $statut, $retour);