[SPIP] +2.1.12
[velocampus/web/www.git] / www / ecrire / inc / formater_article.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2011 *
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/afficher_objets');
15 // Fonction appelee dans une boucle, calculer les invariants au premier appel.
16
17 // http://doc.spip.org/@inc_formater_article_dist
18 function inc_formater_article_dist($row, $own='')
19 {
20 global $spip_lang_right, $spip_display;
21 static $pret = false;
22 static $chercher_logo, $img_admin, $formater_auteur, $nb, $langue_defaut, $afficher_langue, $puce_statut;
23
24 $id_article = $row['id_article'];
25
26 if (!autoriser('voir','article',$id_article)) return '';
27
28 if (!$pret) {
29 $chercher_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non");
30 if ($chercher_logo)
31 $chercher_logo = charger_fonction('chercher_logo', 'inc');
32 $formater_auteur = charger_fonction('formater_auteur', 'inc');
33 $img_admin = http_img_pack("admin-12.gif", "", " width='12' height='12'", _T('titre_image_admin_article'));
34
35 if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR $GLOBALS['meta']['multi_articles'] == 'oui') {
36 $afficher_langue = true;
37 $langue_defaut = !isset($GLOBALS['langue_rubrique'])
38 ? $GLOBALS['meta']['langue_site']
39 : $GLOBALS['langue_rubrique'];
40 }
41 $puce_statut = charger_fonction('puce_statut', 'inc');
42 $pret = true;
43 }
44
45 if ($chercher_logo) {
46 if ($logo = $chercher_logo($id_article, 'id_article', 'on')) {
47 list($fid, $dir, $nom, $format) = $logo;
48 include_spip('inc/filtres_images_mini');
49 $logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
50 }
51 } else $logo ='';
52
53 $titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
54 $id_rubrique = $row['id_rubrique'];
55 $date = $row['date'];
56 $statut = $row['statut'];
57 $descriptif = $row['descriptif'];
58 $lang_dir = lang_dir(($lang = $row['lang']) ? changer_typo($lang):'');
59
60 $lien = "<div>"
61 . "<a href='"
62 . generer_url_ecrire("articles","id_article=$id_article")
63 . "'"
64 . (!$descriptif ? '' :
65 (' title="'.attribut_html(typo($descriptif)).'"'))
66 . " dir='$lang_dir'>"
67 . (!$logo ? '' :
68 ("<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>" . $logo . "</span>"))
69 . (acces_restreint_rubrique($id_rubrique) ? $img_admin : '')
70 . typo(supprime_img($titre,''))
71 . (!($afficher_langue AND $lang != $GLOBALS['meta']['langue_site'] AND strlen($lang)) ? '' :
72 (" <span class='spip_xx-small' style='color: #666666' dir='$lang_dir'>(".traduire_nom_langue($lang).")</span>"))
73 . (!$row['petition'] ? '' :
74 ("</a> <a href='" . generer_url_ecrire('controle_petition', "id_article=$id_article") . "' class='spip_xx-small' style='color: red'>"._T('lien_petitions')))
75 . "</a>"
76 . "</div>";
77
78 if ($spip_display == 4) return array($lien);
79
80 $puce = $puce_statut($id_article, $statut, $id_rubrique,'article');
81
82 $auteurs = auteurs_article($id_article);
83 foreach ($auteurs as $k => $r) {
84 list(, $mail, $nom,,) = $formater_auteur($r['id_auteur']);
85 $auteurs[$k]= "$mail&nbsp;$nom";
86 }
87
88 $date = affdate_jourcourt($date);
89 if (!$date) $date = '&nbsp;';
90
91 $num = afficher_numero_edit($id_article, 'id_article', 'article');
92
93 // Afficher le numero (JMB)
94
95 return array($puce, $lien, join('<br />', $auteurs), $date, $num);
96 }
97
98 ?>