1 | <?php |
---|
2 | |
---|
3 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
4 | include_spip('inc/presentation'); |
---|
5 | |
---|
6 | include_spip('inc/arty_selecteur'); |
---|
7 | |
---|
8 | function transcode($chaine){ |
---|
9 | // dehacke le probleme du hash sur les lien et apostrophes |
---|
10 | $base = array("tttirrr", "aaapooo", "ggguiii"); |
---|
11 | $transcode = array("-", "'", "\""); |
---|
12 | $chaine = addslashes(str_replace($base, $transcode, $chaine)); |
---|
13 | return $chaine; |
---|
14 | } |
---|
15 | |
---|
16 | function transcodeinv($chaine){ |
---|
17 | // dehacke le probleme du hash sur les lien et apostrophes |
---|
18 | $base = array("-", "'", "\""); |
---|
19 | $transcode = array("tttirrr", "aaapooo", "ggguiii"); |
---|
20 | $chaine = str_replace($base, $transcode, $chaine); |
---|
21 | return $chaine; |
---|
22 | } |
---|
23 | |
---|
24 | function exec_menu() { |
---|
25 | |
---|
26 | global $connect_statut; |
---|
27 | if ($connect_statut != "0minirezo" ) { |
---|
28 | echo "<p><b>"._T('arty:acces_a_la_page')."</b></p>"; |
---|
29 | fin_page(); |
---|
30 | exit; |
---|
31 | } |
---|
32 | |
---|
33 | if ($_GET['mode'] == "sauver") { |
---|
34 | $types = array( |
---|
35 | "r" => "rubrique", |
---|
36 | "a" => "article", |
---|
37 | "g" => "groupe", |
---|
38 | "m" => "mot", |
---|
39 | ); |
---|
40 | |
---|
41 | $langue_menu=$_GET['langue_menu']; |
---|
42 | print_r($_POST); |
---|
43 | print_r($_GET); |
---|
44 | if ($_GET['niveaux'] == "flat") { |
---|
45 | $valeurs_menu = array(); |
---|
46 | if (isset($_POST['selection'])) { |
---|
47 | foreach($_POST['selection'] as $num => $element) { |
---|
48 | $morceaux = array(); |
---|
49 | if ($element{0} == "l") { |
---|
50 | $element=transcode($element); |
---|
51 | if (eregi("^l([0-9]+)\|(.*)\|([http://|ftp://|https://].*)", $element, $morceaux)) { |
---|
52 | $type = "lien"; |
---|
53 | $id = $morceaux[1]; |
---|
54 | $nom = $morceaux[2]; |
---|
55 | $url = $morceaux[3]; |
---|
56 | $num = (int) $num; |
---|
57 | $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '$nom', '$url', 0)"; |
---|
58 | } |
---|
59 | } else if (eregi("^(r|a|g|m)([0-9]+)$", $element, $morceaux)) { |
---|
60 | $type = $types[$morceaux[1]]; |
---|
61 | $id = (int) $morceaux[2]; |
---|
62 | $num = (int) $num; |
---|
63 | // ici ajout de la langue |
---|
64 | $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '', '', 0)"; |
---|
65 | } |
---|
66 | } |
---|
67 | } |
---|
68 | spip_query("DELETE FROM spip_arty_menu WHERE langue='$langue_menu'"); |
---|
69 | if (count($valeurs_menu)) { |
---|
70 | $query = "INSERT INTO spip_arty_menu (ordre, type, id, langue, nom, url, id_parent) VALUES ".implode(", ", $valeurs_menu); |
---|
71 | spip_query($query); |
---|
72 | } |
---|
73 | //die; |
---|
74 | echo _T("arty:le_changement_a_ete_effectue"); |
---|
75 | return false; |
---|
76 | |
---|
77 | } else if ($_GET['niveaux'] == "nested") { |
---|
78 | $arty_cpt_lien = 0; |
---|
79 | $valeurs_menu = array(); |
---|
80 | if (isset($_POST['selection'])) { |
---|
81 | |
---|
82 | foreach($_POST['selection'] as $num => $element) { |
---|
83 | $morceaux = array(); |
---|
84 | if ($element['id']{0} == "l") { |
---|
85 | |
---|
86 | $element['id']=transcode($element['id']); |
---|
87 | echo "elem =-".$element['id']."----\n"; |
---|
88 | if (ereg("^l([0-9]+)\|(.*)\|([http://|ftp://|https://].*)", $element['id'], $morceaux)) { |
---|
89 | $type = "lien"; |
---|
90 | $id = $morceaux[1]; |
---|
91 | $nom = $morceaux[2]; |
---|
92 | $url = $morceaux[3]; |
---|
93 | $num = (int) $num; |
---|
94 | $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '$nom', '$url', 0, '')"; |
---|
95 | $arty_cpt_lien++; |
---|
96 | } |
---|
97 | } else if (eregi("^(r|a|g|m)([0-9]+)$", $element['id'], $morceaux)) { |
---|
98 | $type = $types[$morceaux[1]]; |
---|
99 | $id = (int) $morceaux[2]; |
---|
100 | $num = (int) $num; |
---|
101 | // ici ajout de la langue |
---|
102 | $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '', '', 0, '')"; |
---|
103 | } |
---|
104 | // sous_niveaux |
---|
105 | $enfants = isset($element['children']) ? $element['children'] : false; |
---|
106 | if (is_array($enfants) && isset($id) && isset($type)) { |
---|
107 | $retour = valeursNiveauxR($enfants, $id, $type, $arty_cpt_lien); |
---|
108 | $arty_cpt_lien = $retour[1]; |
---|
109 | $valeurs_menu = array_merge($valeurs_menu, $retour[0]); |
---|
110 | } |
---|
111 | } |
---|
112 | } |
---|
113 | |
---|
114 | spip_query("DELETE FROM spip_arty_menu WHERE langue='$langue_menu'"); |
---|
115 | if (count($valeurs_menu)) { |
---|
116 | echo "INSERT INTO spip_arty_menu (ordre, type, id, langue, nom, url, id_parent, type_parent) VALUES ".implode(", ", $valeurs_menu); |
---|
117 | $query = "INSERT INTO spip_arty_menu (ordre, type, id, langue, nom, url, id_parent, type_parent) VALUES ".implode(", ", $valeurs_menu); |
---|
118 | spip_query($query); |
---|
119 | } |
---|
120 | //die; |
---|
121 | |
---|
122 | echo _T("arty:le_changement_a_ete_effectue"); |
---|
123 | return false; |
---|
124 | |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | traiter_post(); |
---|
129 | |
---|
130 | echo debut_page(); |
---|
131 | |
---|
132 | echo barre_onglets("arty", "menu"); |
---|
133 | echo debut_gauche(); |
---|
134 | echo debut_cadre_relief(_DIR_PLUGIN_ARTY.'/images/aide.png', true, "", _T('arty:choix_de_la_langue_menu')); |
---|
135 | // selection de la langue du menu |
---|
136 | // recupérer dans le get |
---|
137 | //print_r($GLOBALS['codes_langues']); |
---|
138 | $langue_menu= $_GET['langue_menu']; |
---|
139 | $leslangues_menu=explode(",",$GLOBALS['meta']['langues_utilisees']); |
---|
140 | |
---|
141 | // par defaut ou si la langue passee n'est pas dans la liste: celle de la langue du site |
---|
142 | //print_r($leslangues_menu); |
---|
143 | if ($langue_menu=="" or !in_array($langue_menu, $leslangues_menu)) { |
---|
144 | $langue_menu=$GLOBALS['meta']['langue_site']; |
---|
145 | } |
---|
146 | echo "<p>"._T("arty:si_pas_langue")."</p>"; |
---|
147 | echo "<form action='".generer_url_ecrire("menu")."' method='get'>"; |
---|
148 | echo '<select name="langue_menu" onchange="window.location.href=\'?exec=menu&langue_menu=\'+this.options[this.selectedIndex].value;">'; |
---|
149 | |
---|
150 | |
---|
151 | foreach($leslangues_menu as $fullname) { |
---|
152 | echo "<option value='$fullname' ".(($langue_menu==$fullname)?'selected="selected"':'').">".$GLOBALS['codes_langues'][$fullname]."</option>"; |
---|
153 | } |
---|
154 | echo "</select>"; |
---|
155 | |
---|
156 | echo "</form>"; |
---|
157 | |
---|
158 | // choix des niveaux du menu |
---|
159 | echo "<br /><p>"._T("arty:nombre_niveaux_menu")."</p>"; |
---|
160 | |
---|
161 | |
---|
162 | $resultat= spip_query("SELECT * FROM spip_arty_parametres WHERE parametre ='".$fullname."config_niveaux_menu'"); |
---|
163 | $resultat=spip_fetch_array($resultat); |
---|
164 | //print_r($_POST); |
---|
165 | //print_r($resultat); |
---|
166 | if($resultat) { |
---|
167 | $niveaux=$resultat['valeur']; |
---|
168 | $langue=$resultat['valeur2']; |
---|
169 | $lister_articles=$resultat['valeur3']; |
---|
170 | } else { |
---|
171 | $niveaux=1; |
---|
172 | $langue=$GLOBALS['meta']['langue_site']; |
---|
173 | } |
---|
174 | |
---|
175 | echo "<form action='".generer_url_ecrire('menu')."' method='post'>\n"; |
---|
176 | echo "<input type='hidden' name='action' value='config_niveaux_menu' />"; |
---|
177 | echo "<input type='hidden' name='langue' value='$langue_menu' />"; |
---|
178 | echo "<p>"._T("arty:intro_niveaux_menu")."</p>"; |
---|
179 | echo "<br /><p>"._T("arty:intro_choix_niveaux")."</p>"; |
---|
180 | echo "<input id='niv1' type='radio' name='niveaux' value='1' ".(($niveaux=="1")?'checked="checked"':'')."> <label for='niv1'>"._T("arty:un_niveau")."</label><br />"; |
---|
181 | echo "<input id='niv2' type='radio' name='niveaux' value='2' ".(($niveaux=="2")?'checked="checked"':'')."> <label for='niv2'>"._T("arty:deux_niveaux")."</label><br />"; |
---|
182 | echo "<input id='nivn' type='radio' name='niveaux' value='n' ".(($niveaux=="n")?'checked="checked"':'')."> <label for='nivn'>"._T("arty:n_niveaux")."</label><br />"; |
---|
183 | echo "<br /><p>"._T("arty:intro_menu_manuel")."</p>"; |
---|
184 | echo "<input id='manuel' type='radio' name='niveaux' value='manuel' ".(($niveaux=="manuel")?'checked="checked"':'')."> <label for='manuel'>"._T("arty:manuel")."</label><br />"; |
---|
185 | |
---|
186 | echo "<br /><p>"._T("arty:intro_lister_articles")."</p>"; |
---|
187 | echo "<input id='lister_articles' type='checkbox' name='lister_articles' ".(($lister_articles=='on')?'checked="checked"':'')."> <label for='lister_articles'>"._T("arty:lister_articles")."</label><br />"; |
---|
188 | |
---|
189 | echo "<br /><input type='submit' value='"._T("arty:enregistrer")."' class='fondo' />"; |
---|
190 | |
---|
191 | echo "</form>"; |
---|
192 | |
---|
193 | echo fin_cadre_relief(true); |
---|
194 | |
---|
195 | echo debut_droite(); |
---|
196 | gros_titre(_T("arty:titre_options_menu")); |
---|
197 | echo "<p class='intro'>"._T("arty:intro_menu")."</p>"; |
---|
198 | |
---|
199 | echo "<p class='titre' style='font-weight:bold;'>"._T("arty:menu_actuel")." : ".$GLOBALS['codes_langues'][$langue_menu]."</p>"; |
---|
200 | |
---|
201 | $noms_type_menu = array( |
---|
202 | '1' => 'arty:un_niveau', |
---|
203 | '2' => 'arty:deux_niveaux', |
---|
204 | 'n' => 'arty:n_niveaux', |
---|
205 | 'manuel' => 'arty:manuel', |
---|
206 | ); |
---|
207 | |
---|
208 | echo "<p class='titre' style='font-weight:bold;'>"._T('arty:type_de_menu')." : "._T($noms_type_menu[$niveaux])."</p>"; |
---|
209 | |
---|
210 | $tables_spip = array( |
---|
211 | 'rubrique' => array( |
---|
212 | "table" => "spip_rubriques", |
---|
213 | "colonne_id" => "id_rubrique", |
---|
214 | ), |
---|
215 | 'article' => array( |
---|
216 | "table" => "spip_articles", |
---|
217 | "colonne_id" => "id_article", |
---|
218 | ), |
---|
219 | 'groupe' => array( |
---|
220 | "table" => "spip_groupes_mots", |
---|
221 | "colonne_id" => "id_groupe", |
---|
222 | ), |
---|
223 | 'mot' => array( |
---|
224 | "table" => "spip_mots", |
---|
225 | "colonne_id" => "id_mot", |
---|
226 | ), |
---|
227 | ); |
---|
228 | |
---|
229 | //echo "test"; |
---|
230 | |
---|
231 | echo ' |
---|
232 | <script type="text/javascript"> |
---|
233 | var traductions = new Object(); |
---|
234 | traductions["rubrique"] = "'._T('arty:rubrique').'"; |
---|
235 | traductions["article"] = "'._T('arty:article').'"; |
---|
236 | traductions["groupe"] = "'._T('arty:groupe').'"; |
---|
237 | traductions["mot"] = "'._T('arty:mot').'"; |
---|
238 | </script> |
---|
239 | '; |
---|
240 | |
---|
241 | if ($niveaux != "manuel") { |
---|
242 | |
---|
243 | echo ' |
---|
244 | <script type="text/javascript"> |
---|
245 | var type_sortable = "flat"; |
---|
246 | </script> |
---|
247 | '; |
---|
248 | |
---|
249 | echo ' |
---|
250 | <ul id="selection"> |
---|
251 | '; |
---|
252 | |
---|
253 | $result = spip_query("SELECT * FROM spip_arty_menu WHERE id_parent = 0 AND langue='$langue_menu' ORDER BY ordre ASC"); |
---|
254 | if (!spip_num_rows($result)){ |
---|
255 | $aucun_menu = true; |
---|
256 | } |
---|
257 | while ($row = spip_fetch_array($result)) { |
---|
258 | if ($row['type'] != 'lien') { |
---|
259 | $result2 = spip_query("SELECT titre FROM ".$tables_spip[$row['type']]['table']." WHERE ".$tables_spip[$row['type']]['colonne_id']." = ".$row['id']); |
---|
260 | if (spip_num_rows($result2)) { |
---|
261 | $row2 = spip_fetch_array($result2); |
---|
262 | echo '<li id="'.substr($row['type'], 0, 1).$row['id'].'" class="sortable">'; |
---|
263 | echo $row2["titre"]; |
---|
264 | echo " <span class='url_petit'>("._T('arty:'.$row['type']).")</span>"; |
---|
265 | echo ' <a href="javascript:supprimer(\'#'.substr($row['type'], 0, 1).$row['id'].'\')">x</a>'; |
---|
266 | echo "</li>"; |
---|
267 | } else { |
---|
268 | spip_query("DELETE FROM spip_arty_menu WHERE id_menu = ".$row["id_menu"]); |
---|
269 | } |
---|
270 | } else { |
---|
271 | |
---|
272 | echo '<li id="l'.$row['id'].'|'.transcodeinv($row['nom']).'|'.transcodeinv($row['url']).'" class="sortable">'; |
---|
273 | echo $row["nom"]; |
---|
274 | |
---|
275 | echo " <span class='url_petit'>(".$row["url"].")</span>"; |
---|
276 | echo ' <a href="javascript:supprimer_lien(\'l'.$row['id'] |
---|
277 | .'|'.transcodeinv($row['nom']).'|' |
---|
278 | . transcodeinv($row['url']) |
---|
279 | .'\')">x</a>'; |
---|
280 | echo "</li>"; |
---|
281 | } |
---|
282 | } |
---|
283 | |
---|
284 | echo '</ul>'; |
---|
285 | |
---|
286 | } else if ($niveaux == "manuel") { |
---|
287 | |
---|
288 | echo ' |
---|
289 | <script type="text/javascript"> |
---|
290 | var type_sortable = "nested"; |
---|
291 | </script> |
---|
292 | '; |
---|
293 | |
---|
294 | echo ' |
---|
295 | <ul id="selection">'; |
---|
296 | $result = spip_query("SELECT * FROM spip_arty_menu WHERE id_parent = 0 AND type_parent = '' AND langue='$langue_menu' ORDER BY ordre ASC"); |
---|
297 | if (!spip_num_rows($result)){ |
---|
298 | $aucun_menu = true; |
---|
299 | } |
---|
300 | while ($row = spip_fetch_array($result)) { |
---|
301 | if ($row['type'] != 'lien') { |
---|
302 | $result2 = spip_query("SELECT titre FROM ".$tables_spip[$row['type']]['table']." WHERE ".$tables_spip[$row['type']]['colonne_id']." = ".$row['id']); |
---|
303 | if (spip_num_rows($result2)) { |
---|
304 | $row2 = spip_fetch_array($result2); |
---|
305 | echo '<li id="'.substr($row['type'], 0, 1).$row['id'].'" class="sortable">'; |
---|
306 | echo $row2["titre"]; |
---|
307 | echo " <span class='url_petit'>("._T('arty:'.$row['type']).")</span>"; |
---|
308 | echo ' <a href="javascript:supprimer(\'#'.substr($row['type'], 0, 1).$row['id'].'\')">x</a>'; |
---|
309 | |
---|
310 | afficherNiveauxR($row['id'], $row['type'], $langue_menu); |
---|
311 | |
---|
312 | echo "</li>"; |
---|
313 | } else { |
---|
314 | spip_query("DELETE FROM spip_arty_menu WHERE id_menu = ".$row["id_menu"]); |
---|
315 | } |
---|
316 | } else { |
---|
317 | |
---|
318 | $row['id']=transcodeinv($row['id']); |
---|
319 | echo '<li id="l'.$row['id'].'|'.transcodeinv($row['nom']).'|'.transcodeinv($row['url']).'" class="sortable">'; |
---|
320 | |
---|
321 | echo $row["nom"]; |
---|
322 | echo " <span class='url_petit'>(".$row["url"].")</span>"; |
---|
323 | echo ' <a href="javascript:supprimer_lien(\'l'.$row['id'].'|'.transcodeinv($row['nom']).'|'.transcodeinv($row['url']).'\')">x</a>'; |
---|
324 | |
---|
325 | afficherNiveauxR($row['id'], $row['type'], $langue_menu); |
---|
326 | |
---|
327 | echo "</li>"; |
---|
328 | } |
---|
329 | } |
---|
330 | echo '</ul>'; |
---|
331 | |
---|
332 | } |
---|
333 | |
---|
334 | if (isset($aucun_menu)){ |
---|
335 | echo ' |
---|
336 | <script type="text/javascript"> |
---|
337 | var type_sortable = "aucun"; |
---|
338 | </script> |
---|
339 | '; |
---|
340 | echo '<p id="avis_menu_auto">'._T('arty:avis_menu_auto').'</p>'; |
---|
341 | } |
---|
342 | |
---|
343 | echo "<div id='bloc_sauver'>"; |
---|
344 | echo "<img src='"._DIR_IMG_PACK."searching.gif' id='search' style='visibility:hidden' />"; |
---|
345 | echo '<a href="javascript:sauver(\''.$langue_menu.'\');">sauver</a>'; |
---|
346 | echo "<div id='reponse'></div>"; |
---|
347 | echo "</div>"; |
---|
348 | |
---|
349 | echo "<p class='titre' style='font-weight:bold;'>"._T("arty:menu_reservoir").":</p>"; |
---|
350 | |
---|
351 | $args = array( |
---|
352 | "exec" => "menu", |
---|
353 | "ajouter" => "menu", |
---|
354 | ); |
---|
355 | afficher_selecteur($args); |
---|
356 | afficher_selecteur_mots($args); |
---|
357 | |
---|
358 | // ajout d'une url |
---|
359 | echo "<form><div id='ajout_lien'><div id='ajout_lien_contenu'>"; |
---|
360 | echo "<p>"._T("arty:ajouter_un_lien").":</p>"; |
---|
361 | echo "<label for='nom_lien'>"._T("arty:nom_lien")."</label>"; |
---|
362 | echo "<input id='nom_lien' type='text' size='30' name='nom' />"; |
---|
363 | echo "<br />"; |
---|
364 | echo "<label for='url_lien'>"._T("arty:url_lien")."</label>"; |
---|
365 | echo "<input id='url_lien' type='text' size='53' name='url' />"; |
---|
366 | echo "<br />"; |
---|
367 | echo "<a href='javascript:ajouter_lien()'>"._T('arty:ajouter_ce_lien')."</a>"; |
---|
368 | echo "</div></div>"; |
---|
369 | echo "</form>"; |
---|
370 | |
---|
371 | echo fin_gauche(); |
---|
372 | echo fin_page(); |
---|
373 | |
---|
374 | } |
---|
375 | |
---|
376 | function traiter_post() { |
---|
377 | //print_r($_POST); |
---|
378 | |
---|
379 | if($_POST['action'] == 'config_niveaux_menu') { |
---|
380 | $niveaux = addslashes($_POST['niveaux']); |
---|
381 | $langue = addslashes($_POST['langue']); |
---|
382 | $lister_articles=addslashes($_POST['lister_articles']); |
---|
383 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = '".$langue."config_niveaux_menu'"); |
---|
384 | if(!spip_num_rows($resultat)) { |
---|
385 | spip_query("INSERT INTO spip_arty_parametres (parametre, valeur, valeur2, valeur3) VALUES ('".$langue."config_niveaux_menu' ,'$niveaux', '$langue', '$lister_articles')"); |
---|
386 | } else { |
---|
387 | spip_query("UPDATE spip_arty_parametres SET valeur= '$niveaux', valeur2='$langue', valeur3='$lister_articles' WHERE parametre = '".$langue."config_niveaux_menu'"); |
---|
388 | } |
---|
389 | } |
---|
390 | } |
---|
391 | |
---|
392 | function valeursNiveauxR($elements, $id_parent, $type_parent, $arty_cpt_lien) |
---|
393 | { |
---|
394 | $types = array( |
---|
395 | "r" => "rubrique", |
---|
396 | "a" => "article", |
---|
397 | "g" => "groupe", |
---|
398 | "m" => "mot", |
---|
399 | ); |
---|
400 | $langue_menu = $_GET['langue_menu']; |
---|
401 | $valeurs_menu = array(); |
---|
402 | |
---|
403 | foreach($elements as $num_element => $element) { |
---|
404 | $morceaux = array(); |
---|
405 | if ($element['id']{0} == "l") { |
---|
406 | $element['id']=transcode($element['id']); |
---|
407 | if (ereg("^l([0-9]+)\|(.*)\|(.*)$", $element['id'], $morceaux)) { |
---|
408 | $type = "lien"; |
---|
409 | $id = $morceaux[1]; |
---|
410 | $nom = $morceaux[2]; |
---|
411 | $url = $morceaux[3]; |
---|
412 | $num = (int) $num; |
---|
413 | $valeurs_menu[] = "($num_element, '$type', $id, '$langue_menu', '$nom', '$url', $id_parent, '$type_parent')"; |
---|
414 | $id = $arty_cpt_lien; |
---|
415 | $arty_cpt_lien++; |
---|
416 | } |
---|
417 | } else if (eregi("^(r|a|g|m)([0-9]+)$", $element['id'], $morceaux)) { |
---|
418 | $type = $types[$morceaux[1]]; |
---|
419 | $id = (int) $morceaux[2]; |
---|
420 | $num = (int) $num; |
---|
421 | $valeurs_menu[] = "($num_element, '$type', $id, '$langue_menu', '', '', $id_parent, '$type_parent')"; |
---|
422 | } |
---|
423 | $enfants = isset($element['children']) ? $element['children'] : false; |
---|
424 | if (is_array($enfants) && isset($id) && isset($type)) { |
---|
425 | $retour = valeursNiveauxR($enfants, $id, $type, $arty_cpt_lien); |
---|
426 | $arty_cpt_lien = $retour[1]; |
---|
427 | $valeurs_menu = array_merge($valeurs_menu, $retour[0]); |
---|
428 | } |
---|
429 | } |
---|
430 | return array($valeurs_menu, $arty_cpt_lien); |
---|
431 | } |
---|
432 | |
---|
433 | function afficherNiveauxR($id_parent, $type_parent, $langue_menu) |
---|
434 | { |
---|
435 | $tables_spip = array( |
---|
436 | 'rubrique' => array( |
---|
437 | "table" => "spip_rubriques", |
---|
438 | "colonne_id" => "id_rubrique", |
---|
439 | ), |
---|
440 | 'article' => array( |
---|
441 | "table" => "spip_articles", |
---|
442 | "colonne_id" => "id_article", |
---|
443 | ), |
---|
444 | 'groupe' => array( |
---|
445 | "table" => "spip_groupes_mots", |
---|
446 | "colonne_id" => "id_groupe", |
---|
447 | ), |
---|
448 | 'mot' => array( |
---|
449 | "table" => "spip_mots", |
---|
450 | "colonne_id" => "id_mot", |
---|
451 | ), |
---|
452 | ); |
---|
453 | |
---|
454 | $enfants = spip_query("SELECT * FROM spip_arty_menu WHERE id_parent = $id_parent AND type_parent='$type_parent' AND langue='$langue_menu' ORDER BY ordre ASC"); |
---|
455 | if (spip_num_rows($enfants)) { |
---|
456 | echo '<ul style="padding-left: 30px; padding-right: 0pt;">'; |
---|
457 | while($row_enfant = spip_fetch_array($enfants)) { |
---|
458 | if ($row_enfant['type'] != 'lien') { |
---|
459 | $result2 = spip_query("SELECT titre FROM ".$tables_spip[$row_enfant['type']]['table']." WHERE ".$tables_spip[$row_enfant['type']]['colonne_id']." = ".$row_enfant['id']); |
---|
460 | if (spip_num_rows($result2)) { |
---|
461 | $row2 = spip_fetch_array($result2); |
---|
462 | echo '<li id="'.substr($row_enfant['type'], 0, 1).$row_enfant['id'].'" class="sortable">'; |
---|
463 | echo $row2["titre"]; |
---|
464 | echo " <span class='url_petit'>("._T('arty:'.$row_enfant['type']).")</span>"; |
---|
465 | echo ' <a href="javascript:supprimer(\'#'.substr($row_enfant['type'], 0, 1).$row_enfant['id'].'\')">x</a>'; |
---|
466 | afficherNiveauxR($row_enfant['id'], $row_enfant['type'], $langue_menu); |
---|
467 | echo "</li>"; |
---|
468 | } else { |
---|
469 | spip_query("DELETE FROM spip_arty_menu WHERE id_menu = ".$row_enfant["id_menu"]); |
---|
470 | } |
---|
471 | } else { |
---|
472 | echo '<li id="l'.$row_enfant['id'].'|'.transcodeinv($row_enfant['nom']).'|'.transcodeinv($row_enfant['url']).'" class="sortable">'; |
---|
473 | echo $row_enfant["nom"]; |
---|
474 | echo " <span class='url_petit'>(".$row_enfant["url"].")</span>"; |
---|
475 | echo ' <a href="javascript:supprimer_lien(\'l'.$row_enfant['id'].transcodeinv($row_enfant['nom']).'|'.transcodeinv($row_enfant['url']).'\')">x</a>'; |
---|
476 | afficherNiveauxR($row_enfant['id'], $row_enfant['type'], $langue_menu); |
---|
477 | echo "</li>"; |
---|
478 | } |
---|
479 | } |
---|
480 | echo '</ul>'; |
---|
481 | } |
---|
482 | } |
---|
483 | |
---|
484 | ?> |
---|