3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2019 *
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')) {
17 include_spip('inc/texte');
19 // http://code.spip.net/@inc_plonger_dist
20 function inc_plonger_dist($id_rubrique, $idom = "", $list = array(), $col = 1, $exclu = 0, $do = 'aff') {
23 $id_rubrique = $list[$col - 1];
28 # recherche les filles et petites-filles de la rubrique donnee
29 # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on
30 # deplace une rubrique, on peut la deplacer partout a partir de la
31 # racine... sauf vers elle-meme ou sa propre branche)
35 $res = sql_select("rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant",
36 "spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)",
37 "rub1.id_parent = " . sql_quote($id_rubrique) . "
38 AND rub1.id_rubrique!=" . sql_quote($exclu) . "
39 AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=" . sql_quote($exclu) . ")", "", "0+rub1.titre,rub1.titre");
41 while ($row = sql_fetch($res)) {
42 if (autoriser('voir', 'rubrique', $row['id_rubrique'])) {
43 $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant'];
44 if ($row['id_parent'] == $id_rubrique) {
45 $t = trim(typo(supprimer_numero($row['titre'])));
46 if ($row['langue_choisie'] != 'oui') {
47 $t .= ' <small title="'
48 . traduire_nom_langue($row['lang'])
49 . '">[' . $row['lang'] . ']</small>';
51 $ordre[$row['id_rubrique']] = $t;
55 $next = isset($list[$col]) ?
$list[$col] : 0;
57 $rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col +
1));
58 $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
59 $args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event";
61 foreach ($ordre as $id => $titrebrut) {
62 $titre = supprimer_numero($titrebrut);
64 $classe1 = $id_rubrique ?
'petite-rubrique' : "petit-secteur";
65 if (isset($rub[$id]["enfants"])) {
66 $classe2 = " class='rub-ouverte'";
67 $url = "\nhref='$rec&id=$id'";
70 $url = "\nhref='javascript:void(0)'";
73 $js_func = $do . '_selection_titre';
74 $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
75 . (!is_array($list) ?
' false'
76 : "aff_selection_provisoire($id,$args)")
77 # ce lien provoque la selection (directe) de la rubrique cliquee
78 # et l'affichage de son titre dans le bandeau
81 . "firstChild.nodeValue,"
83 . ",'selection_rubrique','id_parent');"
84 . "\nreturn aff_selection_provisoire($id,$args);"
87 $ret .= "<div class='"
88 . (($id == $next) ?
"item on" : "item")
96 . "</a></div></div></div>";
100 $idom2 = $idom . "_col_" . ($col +
1);
101 $left = ($col * 150);
103 return http_img_pack("searching.gif", "*",
104 "style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ": "
106 . "px; top: 2px; z-index: 2;' id='img_$idom2'")
107 . "<div style='width: 150px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ": "
111 . "\n</div>\n<div id='$idom2'>"
113 ?
inc_plonger_dist($id_rubrique, $idom, $list, $col +
1, $exclu)