"._T('arty:acces_a_la_page')."

"; fin_page(); exit; } if ($_GET['mode'] == "sauver") { $types = array( "r" => "rubrique", "a" => "article", "g" => "groupe", "m" => "mot", ); $langue_menu=$_GET['langue_menu']; print_r($_POST); print_r($_GET); if ($_GET['niveaux'] == "flat") { $valeurs_menu = array(); if (isset($_POST['selection'])) { foreach($_POST['selection'] as $num => $element) { $morceaux = array(); if ($element{0} == "l") { $element=transcode($element); if (eregi("^l([0-9]+)\|(.*)\|([http://|ftp://|https://].*)", $element, $morceaux)) { $type = "lien"; $id = $morceaux[1]; $nom = $morceaux[2]; $url = $morceaux[3]; $num = (int) $num; $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '$nom', '$url', 0)"; } } else if (eregi("^(r|a|g|m)([0-9]+)$", $element, $morceaux)) { $type = $types[$morceaux[1]]; $id = (int) $morceaux[2]; $num = (int) $num; // ici ajout de la langue $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '', '', 0)"; } } } spip_query("DELETE FROM spip_arty_menu WHERE langue='$langue_menu'"); if (count($valeurs_menu)) { $query = "INSERT INTO spip_arty_menu (ordre, type, id, langue, nom, url, id_parent) VALUES ".implode(", ", $valeurs_menu); spip_query($query); } //die; echo _T("arty:le_changement_a_ete_effectue"); return false; } else if ($_GET['niveaux'] == "nested") { $arty_cpt_lien = 0; $valeurs_menu = array(); if (isset($_POST['selection'])) { foreach($_POST['selection'] as $num => $element) { $morceaux = array(); if ($element['id']{0} == "l") { $element['id']=transcode($element['id']); echo "elem =-".$element['id']."----\n"; if (ereg("^l([0-9]+)\|(.*)\|([http://|ftp://|https://].*)", $element['id'], $morceaux)) { $type = "lien"; $id = $morceaux[1]; $nom = $morceaux[2]; $url = $morceaux[3]; $num = (int) $num; $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '$nom', '$url', 0, '')"; $arty_cpt_lien++; } } else if (eregi("^(r|a|g|m)([0-9]+)$", $element['id'], $morceaux)) { $type = $types[$morceaux[1]]; $id = (int) $morceaux[2]; $num = (int) $num; // ici ajout de la langue $valeurs_menu[] = "($num, '$type', $id, '$langue_menu', '', '', 0, '')"; } // sous_niveaux $enfants = isset($element['children']) ? $element['children'] : false; if (is_array($enfants) && isset($id) && isset($type)) { $retour = valeursNiveauxR($enfants, $id, $type, $arty_cpt_lien); $arty_cpt_lien = $retour[1]; $valeurs_menu = array_merge($valeurs_menu, $retour[0]); } } } spip_query("DELETE FROM spip_arty_menu WHERE langue='$langue_menu'"); if (count($valeurs_menu)) { echo "INSERT INTO spip_arty_menu (ordre, type, id, langue, nom, url, id_parent, type_parent) VALUES ".implode(", ", $valeurs_menu); $query = "INSERT INTO spip_arty_menu (ordre, type, id, langue, nom, url, id_parent, type_parent) VALUES ".implode(", ", $valeurs_menu); spip_query($query); } //die; echo _T("arty:le_changement_a_ete_effectue"); return false; } } traiter_post(); echo debut_page(); echo barre_onglets("arty", "menu"); echo debut_gauche(); echo debut_cadre_relief(_DIR_PLUGIN_ARTY.'/images/aide.png', true, "", _T('arty:choix_de_la_langue_menu')); // selection de la langue du menu // recupérer dans le get //print_r($GLOBALS['codes_langues']); $langue_menu= $_GET['langue_menu']; $leslangues_menu=explode(",",$GLOBALS['meta']['langues_utilisees']); // par defaut ou si la langue passee n'est pas dans la liste: celle de la langue du site //print_r($leslangues_menu); if ($langue_menu=="" or !in_array($langue_menu, $leslangues_menu)) { $langue_menu=$GLOBALS['meta']['langue_site']; } echo "

"._T("arty:si_pas_langue")."

"; echo "
"; echo '"; echo "
"; // choix des niveaux du menu echo "

"._T("arty:nombre_niveaux_menu")."

"; $resultat= spip_query("SELECT * FROM spip_arty_parametres WHERE parametre ='".$fullname."config_niveaux_menu'"); $resultat=spip_fetch_array($resultat); //print_r($_POST); //print_r($resultat); if($resultat) { $niveaux=$resultat['valeur']; $langue=$resultat['valeur2']; $lister_articles=$resultat['valeur3']; } else { $niveaux=1; $langue=$GLOBALS['meta']['langue_site']; } echo "
\n"; echo ""; echo ""; echo "

"._T("arty:intro_niveaux_menu")."

"; echo "

"._T("arty:intro_choix_niveaux")."

"; echo "
"; echo "
"; echo "
"; echo "

"._T("arty:intro_menu_manuel")."

"; echo "
"; echo "

"._T("arty:intro_lister_articles")."

"; echo "
"; echo "
"; echo "
"; echo fin_cadre_relief(true); echo debut_droite(); gros_titre(_T("arty:titre_options_menu")); echo "

"._T("arty:intro_menu")."

"; echo "

"._T("arty:menu_actuel")." : ".$GLOBALS['codes_langues'][$langue_menu]."

"; $noms_type_menu = array( '1' => 'arty:un_niveau', '2' => 'arty:deux_niveaux', 'n' => 'arty:n_niveaux', 'manuel' => 'arty:manuel', ); echo "

"._T('arty:type_de_menu')." : "._T($noms_type_menu[$niveaux])."

"; $tables_spip = array( 'rubrique' => array( "table" => "spip_rubriques", "colonne_id" => "id_rubrique", ), 'article' => array( "table" => "spip_articles", "colonne_id" => "id_article", ), 'groupe' => array( "table" => "spip_groupes_mots", "colonne_id" => "id_groupe", ), 'mot' => array( "table" => "spip_mots", "colonne_id" => "id_mot", ), ); //echo "test"; echo ' '; if ($niveaux != "manuel") { echo ' '; echo ' '; } else if ($niveaux == "manuel") { echo ' '; echo ' '; } if (isset($aucun_menu)){ echo ' '; echo '

'._T('arty:avis_menu_auto').'

'; } echo "
"; echo ""; echo 'sauver'; echo "
"; echo "
"; echo "

"._T("arty:menu_reservoir").":

"; $args = array( "exec" => "menu", "ajouter" => "menu", ); afficher_selecteur($args); afficher_selecteur_mots($args); // ajout d'une url echo "
"; echo "

"._T("arty:ajouter_un_lien").":

"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo "
"; echo ""._T('arty:ajouter_ce_lien').""; echo "
"; echo "
"; echo fin_gauche(); echo fin_page(); } function traiter_post() { //print_r($_POST); if($_POST['action'] == 'config_niveaux_menu') { $niveaux = addslashes($_POST['niveaux']); $langue = addslashes($_POST['langue']); $lister_articles=addslashes($_POST['lister_articles']); $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = '".$langue."config_niveaux_menu'"); if(!spip_num_rows($resultat)) { spip_query("INSERT INTO spip_arty_parametres (parametre, valeur, valeur2, valeur3) VALUES ('".$langue."config_niveaux_menu' ,'$niveaux', '$langue', '$lister_articles')"); } else { spip_query("UPDATE spip_arty_parametres SET valeur= '$niveaux', valeur2='$langue', valeur3='$lister_articles' WHERE parametre = '".$langue."config_niveaux_menu'"); } } } function valeursNiveauxR($elements, $id_parent, $type_parent, $arty_cpt_lien) { $types = array( "r" => "rubrique", "a" => "article", "g" => "groupe", "m" => "mot", ); $langue_menu = $_GET['langue_menu']; $valeurs_menu = array(); foreach($elements as $num_element => $element) { $morceaux = array(); if ($element['id']{0} == "l") { $element['id']=transcode($element['id']); if (ereg("^l([0-9]+)\|(.*)\|(.*)$", $element['id'], $morceaux)) { $type = "lien"; $id = $morceaux[1]; $nom = $morceaux[2]; $url = $morceaux[3]; $num = (int) $num; $valeurs_menu[] = "($num_element, '$type', $id, '$langue_menu', '$nom', '$url', $id_parent, '$type_parent')"; $id = $arty_cpt_lien; $arty_cpt_lien++; } } else if (eregi("^(r|a|g|m)([0-9]+)$", $element['id'], $morceaux)) { $type = $types[$morceaux[1]]; $id = (int) $morceaux[2]; $num = (int) $num; $valeurs_menu[] = "($num_element, '$type', $id, '$langue_menu', '', '', $id_parent, '$type_parent')"; } $enfants = isset($element['children']) ? $element['children'] : false; if (is_array($enfants) && isset($id) && isset($type)) { $retour = valeursNiveauxR($enfants, $id, $type, $arty_cpt_lien); $arty_cpt_lien = $retour[1]; $valeurs_menu = array_merge($valeurs_menu, $retour[0]); } } return array($valeurs_menu, $arty_cpt_lien); } function afficherNiveauxR($id_parent, $type_parent, $langue_menu) { $tables_spip = array( 'rubrique' => array( "table" => "spip_rubriques", "colonne_id" => "id_rubrique", ), 'article' => array( "table" => "spip_articles", "colonne_id" => "id_article", ), 'groupe' => array( "table" => "spip_groupes_mots", "colonne_id" => "id_groupe", ), 'mot' => array( "table" => "spip_mots", "colonne_id" => "id_mot", ), ); $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"); if (spip_num_rows($enfants)) { echo ''; } } ?>