Commit | Line | Data |
---|---|---|
c495c100 P |
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 | // 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) | |
19 | { | |
20 | global $dir_lang, $options, $spip_lang_right, $spip_display; | |
21 | static $pret = false; | |
22 | static $chercher_logo, $img_admin, $formater_auteur, $nb, $langue_defaut, $afficher_langue; | |
23 | ||
24 | if (!$pret) { | |
25 | $chercher_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non"); | |
26 | if ($chercher_logo) | |
27 | $chercher_logo = charger_fonction('chercher_logo', 'inc'); | |
28 | $formater_auteur = charger_fonction('formater_auteur', 'inc'); | |
29 | $img_admin = http_img_pack("admin-12.gif", "", " width='12' height='12'", _T('titre_image_admin_article')); | |
30 | $nb = ($options == "avancees"); | |
31 | if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR $GLOBALS['meta']['multi_articles'] == 'oui') { | |
32 | $afficher_langue = true; | |
33 | $langue_defaut = !isset($GLOBALS['langue_rubrique']) | |
34 | ? $GLOBALS['meta']['langue_site'] | |
35 | : $GLOBALS['langue_rubrique']; | |
36 | } | |
37 | $pret = true; | |
38 | } | |
39 | ||
40 | $id_article = $row['id_article']; | |
41 | ||
42 | if ($chercher_logo) { | |
43 | if ($logo = $chercher_logo($id_article, 'id_article', 'on')) { | |
44 | list($fid, $dir, $nom, $format) = $logo; | |
45 | include_spip('inc/filtres_images'); | |
46 | $logo = image_reduire("<img src='$fid' alt='' />", 26, 20); | |
47 | } | |
48 | } else $logo =''; | |
49 | ||
50 | $vals = array(); | |
51 | ||
52 | $titre = sinon($row['titre'], _T('ecrire:info_sans_titre')); | |
53 | $id_rubrique = $row['id_rubrique']; | |
54 | $date = $row['date']; | |
55 | $statut = $row['statut']; | |
56 | $descriptif = $row['descriptif']; | |
57 | if ($lang = $row['lang']) changer_typo($lang); | |
58 | ||
59 | $vals[]= puce_statut_article($id_article, $statut, $id_rubrique); | |
60 | ||
61 | $vals[]= "<div>" | |
62 | . "<a href='" | |
63 | . generer_url_ecrire("articles","id_article=$id_article") | |
64 | . "'" | |
65 | . (!$descriptif ? '' : | |
66 | (' title="'.attribut_html(typo($descriptif)).'"')) | |
67 | . $dir_lang | |
68 | . " style=\"display:block;\">" | |
69 | . (!$logo ? '' : | |
70 | ("<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>" . $logo . "</span>")) | |
71 | . (acces_restreint_rubrique($id_rubrique) ? $img_admin : '') | |
72 | . typo($titre) | |
73 | . (!($afficher_langue AND $lang != $GLOBALS['meta']['langue_site']) ? '' : | |
74 | (" <span class='spip_xx-small' style='color: #666666'$dir_lang>(".traduire_nom_langue($lang).")</span>")) | |
75 | . (!$row['petition'] ? '' : (" <span class='spip_xx-small' style='color: red'>"._T('lien_petitions')."</span>")) | |
76 | . "</a>" | |
77 | . "</div>"; | |
78 | ||
79 | $result = auteurs_article($id_article); | |
80 | $les_auteurs = array(); | |
81 | while ($r = spip_fetch_array($result)) { | |
82 | list($s, $mail, $nom, $w, $p) = $formater_auteur($r['id_auteur']); | |
83 | $les_auteurs[]= "$mail $nom"; | |
84 | } | |
85 | $vals[] = join('<br />', $les_auteurs); | |
86 | ||
87 | $s = affdate_jourcourt($date); | |
88 | $vals[] = $s ? $s : ' '; | |
89 | ||
90 | if ($nb) $vals[]= afficher_numero_edit($id_article, 'id_article', 'article'); | |
91 | ||
92 | if ($options == "avancees") { // Afficher le numero (JMB) | |
93 | $largeurs = array(11, '', 80, 100, 50); | |
94 | $styles = array('', 'arial2', 'arial1', 'arial1', 'arial1'); | |
95 | } else { | |
96 | $largeurs = array(11, '', 100, 100); | |
97 | $styles = array('', 'arial2', 'arial1', 'arial1'); | |
98 | } | |
99 | ||
100 | return ($spip_display != 4) | |
101 | ? afficher_liste_display_neq4($largeurs, $vals, $styles) | |
102 | : afficher_liste_display_eq4($largeurs, $vals, $styles); | |
103 | } | |
104 | ||
105 | ?> |