Mise en route du suivi.
[aidenligne_francais_universite.git] / ecrire / exec / articles_forum.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2007 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
8 * *
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 \***************************************************************************/
12
13 if (!defined("_ECRIRE_INC_VERSION")) return;
14 include_spip('inc/presentation');
15 include_spip('inc/forum'); // pour boutons_controle_forum
16
17 // http://doc.spip.org/@exec_articles_forum_dist
18 function exec_articles_forum_dist()
19 {
20 $id_article = intval(_request('id_article'));
21
22 if (!autoriser('modererforum', 'article', $id_article))
23 return;
24
25 $debut = intval(_request('debut'));
26 $pack = intval(_request('pack'));
27 $enplus = intval(_request('enplus'));
28
29 if (!$pack) $pack = 5; // nb de forums affiches par page
30 if (!$enplus) $enplus = 200; // intervalle affiche autour du debut
31
32 $result = spip_query("SELECT titre, id_rubrique FROM spip_articles WHERE id_article=$id_article");
33
34 if ($row = spip_fetch_array($result)) {
35 $titre = $row["titre"];
36 $id_rubrique = $row["id_rubrique"];
37 }
38
39 $limitdeb = ($debut > $enplus) ? $debut-$enplus : 0;
40 $limitnb = $debut + $enplus - $limitdeb;
41
42 $ancre = 'navigation-forum';
43 $result = spip_query("SELECT id_forum FROM spip_forum WHERE id_article='$id_article' AND id_parent=0 AND statut IN ('publie', 'off', 'prop')" . " LIMIT $limitdeb, $limitnb");
44 # " LIMIT $limitnb OFFSET $limitdeb" # PG
45
46 $res = spip_query("SELECT pied.*, max(thread.date_heure) AS date FROM spip_forum AS pied, spip_forum AS thread WHERE pied.id_article='$id_article' AND pied.id_parent=0 AND pied.statut IN ('publie', 'off', 'prop') AND thread.id_thread=pied.id_forum GROUP BY id_thread ORDER BY date DESC LIMIT $debut, $pack");
47
48 $mess = affiche_navigation_forum("articles_forum", "id_article=$id_article", $debut, $limitdeb, $pack, $ancre, $result)
49 . '<br />'
50 . afficher_forum($res,"", '', $id_article);
51
52 if (_request('var_ajaxcharset'))
53 ajax_retour($mess);
54 else {
55
56 pipeline('exec_init',array('args'=>array('exec'=>'articles_forum','id_article'=>$id_article),'data'=>''));
57
58 $commencer_page = charger_fonction('commencer_page', 'inc');
59 echo $commencer_page($titre, "naviguer", "articles", $id_rubrique);
60
61 articles_forum_cadres($id_rubrique, $id_article, $titre, 'articles', "id_article=$id_article");
62
63 echo "<div class='serif2' id='$ancre'>";
64 echo $mess;
65 echo '</div>';
66
67 echo fin_gauche(), fin_page();
68 }
69 }
70
71 // http://doc.spip.org/@articles_forum_cadres
72 function articles_forum_cadres($id_rubrique, $id_article, $titre, $script, $args)
73 {
74 debut_grand_cadre();
75
76 echo afficher_hierarchie($id_rubrique);
77
78 fin_grand_cadre();
79
80 debut_gauche();
81
82 debut_boite_info();
83
84 echo "<p style='text-align: left; ' class='verdana1 spip_x-small'>",
85 _T('info_gauche_suivi_forum'),
86 aide ("suiviforum"),
87 "</p>";
88
89 echo "<div style='text-align: "
90 . $GLOBALS['spip_lang_right']
91 . ";'>"
92 . bouton_spip_rss('forum', array('id_article' => $id_article))
93 . "</div>";
94
95 fin_boite_info();
96
97 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'articles_forum','id_article'=>$id_article),'data'=>''));
98 creer_colonne_droite();
99 echo pipeline('affiche_droite',array('args'=>array('exec'=>'articles_forum','id_article'=>$id_article),'data'=>''));
100 debut_droite();
101
102 echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
103 echo "<tr>";
104 echo "<td>";
105 icone(_T('icone_retour'),
106 generer_url_ecrire($script, $args),
107 "article-24.gif", "rien.gif");
108 echo "</td>";
109 echo "<td>" . http_img_pack('rien.gif', " ", "width='10'") ."</td>\n";
110 echo "<td style='width: 100%'>";
111 echo _T('texte_messages_publics');
112 gros_titre($titre);
113 echo "</td></tr></table>";
114 }
115 ?>