Mise en route du suivi.
[aidenligne_francais_universite.git] / ecrire / exec / accueil.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
15 include_spip('inc/presentation');
16
17 // http://doc.spip.org/@encours_accueil
18 function encours_accueil()
19 {
20 global $connect_statut;
21
22 // Les articles a valider
23 //
24
25 $res = afficher_articles(_T('info_articles_proposes'), array("WHERE" => "statut='prop'", 'ORDER BY' => "date DESC"));
26
27 //
28 // Les breves a valider
29 //
30 $res .= afficher_breves(afficher_plus(generer_url_ecrire('breves'))._T('info_breves_valider'), array("FROM" => 'spip_breves', 'WHERE' => "statut='prepa' OR statut='prop'", 'ORDER BY' => "date_heure DESC"), true);
31
32 //
33 // Les sites references a valider
34 //
35 if ($GLOBALS['meta']['activer_sites'] != 'non') {
36 include_spip('inc/sites_voir');
37 $res .= afficher_sites(afficher_plus(generer_url_ecrire('sites_tous')).'<b>' . _T('info_site_valider') . '</b>', array("FROM" => 'spip_syndic', 'WHERE' => "statut='prop'", 'ORDER BY'=> "nom_site"));
38 }
39
40 if ($connect_statut == '0minirezo') {
41 //
42 // Les sites a probleme
43 //
44 if ($GLOBALS['meta']['activer_sites'] != 'non') {
45 include_spip('inc/sites_voir');
46 $res .= afficher_sites(afficher_plus(generer_url_ecrire('sites_tous')). '<b>' . _T('avis_sites_syndiques_probleme') . '</b>', array('FROM' => 'spip_syndic', 'WHERE' => "(syndication='off' OR syndication='sus') AND statut='publie'", 'ORDER BY' => 'nom_site'));
47 }
48
49 // Les articles syndiques en attente de validation
50 $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE statut='dispo'"));
51 if ($cpt = $cpt['n'])
52 $res .= "\n<br /><small><a href='"
53 . generer_url_ecrire("sites_tous","")
54 . "' style='color: black;'>"
55 . $cpt
56 . " "
57 . _T('info_liens_syndiques_1')
58 . " "
59 . _T('info_liens_syndiques_2')
60 . "</a></small>";
61
62 // Les forums en attente de moderation
63
64 $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_forum WHERE statut='prop'"));
65 if ($cpt = $cpt['n']) {
66 $res .= "\n<br /><small> <a href='" . generer_url_ecrire("controle_forum","") . "' style='color: black;'>".$cpt;
67 if ($cpt>1)
68 $res .= " "._T('info_liens_syndiques_3')." "._T('info_liens_syndiques_4');
69 else
70 $res .= " "._T('info_liens_syndiques_5')." "._T('info_liens_syndiques_6');
71 $res .= " "._T('info_liens_syndiques_7').".</a></small>";
72 }
73 }
74
75 if (!$res) return '';
76
77 return debut_cadre_couleur_foncee("",true, "", _T('texte_en_cours_validation'))
78 . $res
79 . "\n<div style='text-align: "
80 . $GLOBALS['spip_lang_right']
81 . ";'>"
82 . bouton_spip_rss('a-suivre',array())
83 . "</div>"
84 . fin_cadre_couleur_foncee(true);
85 }
86
87 //
88 // Raccourcis pour malvoyants
89 //
90
91 // http://doc.spip.org/@colonne_droite_eq4
92 function colonne_droite_eq4($activer_breves)
93 {
94 global $spip_display, $connect_statut, $connect_toutes_rubriques, $connect_id_auteur, $connect_login;
95
96 $res = spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1"));
97 if ($res) {
98 $res = icone_horizontale(_T('icone_ecrire_article'), generer_url_ecrire("articles_edit","new=oui"), "article-24.gif","creer.gif", false);
99
100 if ($activer_breves != "non") {
101 $res .= icone_horizontale(_T('icone_nouvelle_breve'), generer_url_ecrire("breves_edit","new=oui"), "breve-24.gif","creer.gif", false);
102 }
103 }
104 else {
105 if ($connect_statut == '0minirezo') {
106 $res = "<div class='verdana2'>"._T('info_ecrire_article')."</div>";
107 }
108 }
109 if ($connect_toutes_rubriques) {
110 $res .= icone_horizontale(_T('icone_creer_rubrique_2'), generer_url_ecrire("rubriques_edit","new=oui"), "rubrique-24.gif","creer.gif", false);
111 }
112 return bloc_des_raccourcis($res);
113 }
114
115 //
116 // Raccourcis pour voyants ...
117 //
118
119 // http://doc.spip.org/@colonne_droite_neq4
120 function colonne_droite_neq4($id_rubrique, $activer_breves,
121 $activer_sites, $articles_mots)
122 {
123 global $spip_display, $connect_statut, $connect_toutes_rubriques, $connect_id_auteur, $connect_login;
124
125 $gadget = '';
126
127 if ($id_rubrique > 0) {
128 $dans_rub = "&id_rubrique=$id_rubrique";
129 $dans_parent = "&id_parent=$id_rubrique";
130 } else $dans_rub = $dans_parent = '';
131
132 if ($connect_statut == "0minirezo") {
133 $gadget .= "<td>"
134 . icone_horizontale(_T('icone_creer_rubrique'), generer_url_ecrire("rubriques_edit","new=oui"), "rubrique-24.gif", "creer.gif", false)
135 . "</td>";
136 }
137 $n = spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1"));
138 if ($n) {
139 $gadget .= "<td>"
140 . icone_horizontale(_T('icone_ecrire_article'), generer_url_ecrire("articles_edit","new=oui$dans_rub"), "article-24.gif","creer.gif", false)
141 . "</td>";
142
143 if ($activer_breves != "non") {
144 $gadget .= "<td>";
145 $gadget .= icone_horizontale(_T('icone_nouvelle_breve'), generer_url_ecrire("breves_edit","new=oui$dans_rub"), "breve-24.gif","creer.gif", false);
146 $gadget .= "</td>";
147 }
148
149 if ($activer_sites == 'oui') {
150 if ($connect_statut == '0minirezo' OR $GLOBALS['meta']["proposer_sites"] > 0) {
151 $gadget .= "<td>";
152 $gadget .= icone_horizontale(_T('info_sites_referencer'), generer_url_ecrire("sites_edit","new=oui$dans_parent"), "site-24.gif","creer.gif", false);
153 $gadget .= "</td>";
154 }
155 }
156 }
157 $gadget = "<table><tr>$gadget</tr></table>\n";
158
159 if ($connect_statut != "0minirezo") {
160
161 $gadget .= "<table><tr>";
162
163 $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_articles AS art, spip_auteurs_articles AS lien WHERE lien.id_auteur = '$connect_id_auteur' AND art.id_article = lien.id_article LIMIT 1"));
164 if ($cpt['n'] > 0) {
165 $gadget .= "<td>"
166 . icone_horizontale (_T('icone_tous_articles'), generer_url_ecrire("articles_page",""), "article-24.gif", "", false)
167 . "</td>";
168 }
169
170 if ($activer_breves != "non"){
171 $gadget .= "<td>"
172 . icone_horizontale (_T('icone_breves'), generer_url_ecrire("breves",""), "breve-24.gif", "", false)
173 . "</td>";
174 }
175
176 if ($articles_mots != "non") {
177 $gadget .= "<td>"
178 . icone_horizontale (_T('icone_mots_cles'), generer_url_ecrire("mots_tous",""), "mot-cle-24.gif", "", false)
179 . "</td>";
180 }
181
182 if ($activer_sites<>'non') {
183 $gadget .= "<td>"
184 . icone_horizontale (_T('icone_sites_references'), generer_url_ecrire("sites_tous",""), "site-24.gif", "", false)
185 . "</td>";
186 }
187 $gadget .= "</tr></table>\n";
188 }
189
190 //
191 // Modification du cookie
192 //
193
194 if (!$_COOKIE['spip_admin']) {
195 $cookie = rawurlencode("@$connect_login");
196 $gadget .= "<div>&nbsp;</div>".
197 "<table width='95%'><tr>".
198 "<td style='width: 100%'>".
199 _T('info_activer_cookie').
200 aide ("cookie").
201 "</td>".
202 "<td style='width: 10px'>".
203 http_img_pack("rien.gif", ' ', "width='10'") .
204 "</td>".
205 "<td style='width: 250px'>".
206 icone_horizontale(_T('icone_activer_cookie'), generer_url_public('spip_cookie', "cookie_admin=$cookie&url=".rawurlencode(_DIR_RESTREINT_ABS)), "cookie-24.gif", "", false).
207 "</td></tr></table>";
208 }
209
210 if (strlen($gadget) > 0) {
211 $gadget = "<div>&nbsp;</div>"
212 . debut_cadre_trait_couleur('', true)
213 . $gadget
214 . fin_cadre_trait_couleur(true);
215 }
216
217 $gadget .= "<div>&nbsp;</div>";
218 return $gadget;
219 }
220
221 // Cartouche d'identification, avec les rubriques administrees
222
223 // http://doc.spip.org/@personnel_accueil
224 function personnel_accueil($coockcookie)
225 {
226 global $spip_lang_left, $connect_id_auteur, $connect_id_rubrique ;
227
228 $res = '';
229
230 if ($connect_id_rubrique) {
231
232 $q = spip_query("SELECT R.id_rubrique, R.titre, R.descriptif FROM spip_rubriques AS R, spip_auteurs_rubriques AS A WHERE A.id_auteur=$connect_id_auteur AND A.id_rubrique=R.id_rubrique ORDER BY titre");
233
234 $rubs = array();
235 while ($r = spip_fetch_array($q)) {
236 $rubs[] = "<a title='" .
237 typo($r['descriptif']) .
238 "' href='" .
239 generer_url_ecrire('naviguer', "id_rubrique=" .$r['id_rubrique']) . "'>" .
240 typo($r['titre']) .
241 '</a>';
242 }
243
244 $res .= "<ul style='margin:0px; padding-$spip_lang_left: 20px; margin-bottom: 5px;'>\n<li>" . join("</li>\n<li>", $rubs) . "\n</li></ul>";
245 }
246
247 //
248 // Supprimer le cookie, se deconnecter...
249 //
250
251 if ($coockcookie) {
252 $t = _T('icone_supprimer_cookie');
253 $t = icone_horizontale($t, generer_url_public("spip_cookie", "cookie_admin=non&url=".rawurlencode(_DIR_RESTREINT_ABS)), "cookie-24.gif", "", false);
254 if ($GLOBALS['spip_display'] != 1)
255 $t = str_replace('</td></tr></table>',
256 aide("cookie").'</td></tr></table>',
257 $t);
258 $res .= $t;
259 }
260 $titre_cadre = afficher_plus(generer_url_ecrire("auteur_infos","id_auteur=$connect_id_auteur"));
261 $titre_cadre .= majuscules(typo($GLOBALS['auteur_session']['nom']));
262
263 return debut_cadre_relief("fiche-perso-24.gif",true, '',$titre_cadre)
264 . $res
265 . fin_cadre_relief(true);
266 }
267
268 // Cartouche du site, avec le nombre d'aricles, breves et messages de forums
269
270 // http://doc.spip.org/@etat_base_accueil
271 function etat_base_accueil()
272 {
273 global $spip_display, $spip_lang_left, $connect_statut, $connect_id_rubrique;
274
275 $ids = join(",", $connect_id_rubrique);
276 $where = $ids ? (" WHERE id_rubrique IN ($ids)") : '';
277
278 $res = '';
279
280 if ($spip_display != 1) {
281 $chercher_logo = charger_fonction('chercher_logo', 'inc');
282 if ($r = $chercher_logo(0, 'id_syndic', 'on')) {
283 list($fid, $dir, $nom, $format) = $r;
284 include_spip('inc/filtres_images');
285 $r = image_reduire("<img src='$fid' alt='' />", 170, 170);
286 if ($r)
287 $res ="<div style='text-align:center; margin-bottom: 5px;'>$r</div>";
288 }
289 }
290 $res .= "<div class='verdana1'>";
291
292 $d = propre($GLOBALS['meta']["descriptif_site"]);
293 if ($d) $res .= "<div>$d</div><br />";
294
295 $q = spip_query("SELECT COUNT(*) AS cnt, statut FROM spip_articles GROUP BY statut HAVING cnt <>0");
296
297 $cpt = array();
298 $cpt2 = array();
299 $defaut = $where ? '0/' : '';
300 while($row = spip_fetch_array($q)) {
301 $cpt[$row['statut']] = $row['cnt'];
302 $cpt2[$row['statut']] = $defaut;
303 }
304 if ($cpt) {
305 if ($where) {
306 $q = spip_query("SELECT COUNT(*) AS cnt, statut FROM spip_articles$where GROUP BY statut");
307 while($row = spip_fetch_array($q)) {
308 $r = $row['statut'];
309 $cpt2[$r] = intval($row['cnt']) . '/';
310 }
311 }
312 $res .= afficher_plus(generer_url_ecrire("articles_page",""))."<b>"._T('info_articles')."</b>";
313 $res .= "<ul style='margin:0px; padding-$spip_lang_left: 20px; margin-bottom: 5px;'>";
314 if (isset($cpt['prepa'])) $res .= "<li>"._T("texte_statut_en_cours_redaction").": ".$cpt2['prepa'] . $cpt['prepa'] .'</li>';
315 if (isset($cpt['prop'])) $res .= "<li>"._T("texte_statut_attente_validation").": ".$cpt2['prop'] . $cpt['prop'] . '</li>';
316 if (isset($cpt['publie'])) $res .= "<li><b>"._T("texte_statut_publies").": ".$cpt2['publie'].$cpt['publie'] ."</b>" . '</li>';
317 $res .= "</ul>";
318 }
319
320 $q = spip_query("SELECT COUNT(*) AS cnt, statut FROM spip_breves GROUP BY statut HAVING cnt <>0");
321
322 $cpt = array();
323 $cpt2 = array();
324 $defaut = $where ? '0/' : '';
325 while($row = spip_fetch_array($q)) {
326 $cpt[$row['statut']] = $row['cnt'];
327 $cpt2[$row['statut']] = $defaut;
328 }
329
330 if ($cpt) {
331 if ($where) {
332 $q = spip_query("SELECT COUNT(*) AS cnt, statut FROM spip_breves$where GROUP BY statut");
333 while($row = spip_fetch_array($q)) {
334 $r = $row['statut'];
335 $cpt2[$r] = intval($row['cnt']) . '/';
336 }
337 }
338 $res .= afficher_plus(generer_url_ecrire("breves",""))."<b>"._T('info_breves_02')."</b>";
339 $res .= "<ul style='margin:0px; padding-$spip_lang_left: 20px; margin-bottom: 5px;'>";
340 if (isset($cpt['prop'])) $res .= "<li>"._T("texte_statut_attente_validation").": ".$cpt2['prop'].$cpt['prop'] . '</li>';
341 if (isset($cpt['publie'])) $res .= "<li><b>"._T("texte_statut_publies").": ".$cpt2['publie'] .$cpt['publie'] . "</b>" .'</li>';
342 $res .= "</ul>";
343 }
344
345 $q = spip_query("SELECT COUNT(*) AS cnt, statut FROM spip_forum WHERE statut IN ('publie', 'prop') GROUP BY statut HAVING cnt <>0");
346
347 $cpt = array();
348 $cpt2 = array();
349 $defaut = $where ? '0/' : '';
350 while($row = spip_fetch_array($q)) {
351 $cpt[$row['statut']] = $row['cnt'];
352 $cpt2[$row['statut']] = $defaut;
353 }
354
355 if ($cpt) {
356 if ($where) {
357 include_spip('inc/forum');
358 list($f, $w) = critere_statut_controle_forum('public',$ids);
359 $q = spip_query("SELECT COUNT(*) AS cnt, F.statut FROM $f WHERE $w GROUP BY F.statut");
360 while($row = spip_fetch_array($q)) {
361 $r = $row['statut'];
362 $cpt2[$r] = intval($row['cnt']) . '/';
363 }
364 }
365
366 if ($connect_statut == "0minirezo") $res .= afficher_plus(generer_url_ecrire("controle_forum",""));
367 $res .= "<b>" ._T('onglet_messages_publics') ."</b>";
368 $res .= "<ul style='margin:0px; padding-$spip_lang_left: 20px; margin-bottom: 5px;'>";
369 if (isset($cpt['prop'])) $res .= "<li>"._T("texte_statut_attente_validation").": ".$cpt2['prop'] .$cpt['prop'] . '</li>';
370 if (isset($cpt['publie'])) $res .= "<li><b>"._T("texte_statut_publies").": ".$cpt2['publie'] .$cpt['publie'] . "</b>" .'</li>';
371 $res .= "</ul>";
372 }
373
374 $q = spip_query("SELECT COUNT(*) AS cnt, statut FROM spip_auteurs GROUP BY statut HAVING cnt <>0");
375
376 $cpt = array();
377 while($row=spip_fetch_array($q)) $cpt[$row['statut']] = $row['cnt'];
378
379 if ($cpt) {
380 $res .= afficher_plus(generer_url_ecrire("auteurs",""))."<b>"._T('icone_auteurs')."</b>";
381 $res .= "<ul style='margin:0px; padding-$spip_lang_left: 20px; margin-bottom: 5px;'>";
382 if (isset($cpt['0minirezo'])) $res .= "<li>" ._T("info_administrateurs") .": " .$cpt['0minirezo'] . '</li>';
383 if (isset($cpt['1comite'])) $res .= "<li>" ._T("info_redacteurs") .": " .$cpt['1comite'] . '</li>';
384 if (isset($cpt['6forum'])) $res .= "<li>" ._T("info_visiteurs") .": " .$cpt['6forum'] . '</li>';
385 $res .= "</ul>";
386 }
387
388 $res .= "</div>";
389
390 return $res ;
391 }
392
393 // http://doc.spip.org/@exec_accueil_dist
394 function exec_accueil_dist()
395 {
396 global $id_rubrique, $meta, $connect_statut, $options, $connect_id_auteur, $spip_display, $connect_id_rubrique;
397
398 $id_rubrique = intval($id_rubrique);
399 pipeline('exec_init',array('args'=>array('exec'=>'accueil','id_rubrique'=>$id_rubrique),'data'=>''));
400
401 $commencer_page = charger_fonction('commencer_page', 'inc');
402 echo $commencer_page(_T('titre_page_index'), "accueil", "accueil");
403
404 debut_gauche();
405
406 if ($spip_display != 4) {
407 echo personnel_accueil($_COOKIE['spip_admin']);
408 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'accueil','id_rubrique'=>$id_rubrique),'data'=>''));
409 echo "\n<div>&nbsp;</div>";
410 $nom = propre($GLOBALS['meta']["nom_site"]);
411 if (!$nom) $nom= _T('info_mon_site_spip');
412 echo debut_cadre_relief("racine-site-24.gif", true, "", $nom),
413 etat_base_accueil(),
414 fin_cadre_relief(true);
415 }
416
417 creer_colonne_droite();
418 list($evtm, $evtt, $evtr) = http_calendrier_messages(date("Y"), date("m"), date("d")," 23:59:59");
419
420 echo "<div>&nbsp;</div>", $evtt, $evtm, $evtr;
421
422 echo pipeline('affiche_droite',array('args'=>array('exec'=>'accueil','id_rubrique'=>$id_rubrique),'data'=>''));
423
424 debut_droite();
425
426 if ($GLOBALS['meta']["post_dates"] == "non" AND $connect_statut == '0minirezo' AND $options == 'avancees') {
427 echo afficher_articles(_T('info_article_a_paraitre'), array("WHERE" => "statut='publie' AND date>NOW()", 'ORDER BY' => "date"));
428 }
429
430 //
431 // Vos articles en cours
432 //
433
434 echo afficher_articles(afficher_plus(generer_url_ecrire('articles_page'))._T('info_en_cours_validation'), array('FROM' => "spip_articles AS articles, spip_auteurs_articles AS lien", "WHERE" => "articles.id_article=lien.id_article AND lien.id_auteur=$connect_id_auteur AND articles.statut='prepa'", "ORDER BY" => "articles.date DESC"));
435
436 if ($spip_display == 4)
437 echo colonne_droite_eq4($GLOBALS['meta']["activer_breves"]);
438 else {
439 echo colonne_droite_neq4($id_rubrique,
440 $GLOBALS['meta']["activer_breves"],
441 $GLOBALS['meta']["activer_sites"],
442 $GLOBALS['meta']['articles_mots']);
443 echo encours_accueil();
444 }
445
446 if (!$connect_id_rubrique)
447 echo afficher_enfant_rub(0, false, true);
448
449 echo pipeline('affiche_milieu',array('args'=>array('exec'=>'accueil'),'data'=>''));
450
451 // Dernieres modifications d'articles
452 if ($options == 'avancees'
453 AND ($GLOBALS['meta']['articles_versions'] == 'oui')) {
454 include_spip('inc/suivi_versions');
455 echo afficher_suivi_versions (0, 0, false, "", true);
456 }
457
458 echo fin_gauche(), fin_page();
459 }
460 ?>