3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2016 *
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;
15 include_spip('inc/diff');
18 * Afficher le diff d'un champ texte generique
19 * @param string $champ
22 * @param string $format
23 * apercu, diff ou complet
26 function afficher_diff_jointure_dist($champ,$old,$new,$format='diff'){
27 $join = substr($champ,9);
28 $objet = objet_type($join);
30 $old = explode(',',$old);
31 $new = explode(',',$new);
36 $intersection = array_intersect($new,$old);
37 foreach($intersection as $id)
38 if ($id=intval(trim($id)))
39 $liste[$id] = "<a href='".generer_url_entite($id,$objet)."' title='"._T(objet_info($objet,'texte_objet'))." $id'>".generer_info_entite($id,$objet,'titre')."</a>";
42 $old = array_diff($old,$intersection);
44 if ($id=intval(trim($id)))
45 $liste[$id] = "<span class='diff-supprime'>"
46 . "<a href='".generer_url_entite($id,$objet)."' title='"._T(objet_info($objet,'texte_objet'))." $id'>".generer_info_entite($id,$objet,'titre')."</a>"
50 $new = array_diff($new,$intersection);
52 if ($id=intval(trim($id)))
53 $liste[$id] = "<span class='diff-ajoute'>"
54 . "<a href='".generer_url_entite($id,$objet)."' title='"._T(objet_info($objet,'texte_objet'))." $id'>".generer_info_entite($id,$objet,'titre')."</a>"
58 $liste = implode(', ',$liste);