";
$admin_expl_nagopac="
";
function show_navigopac($dbh){
global $msg,$thesaurus_classement_mode_pmb,$thesaurus_classement_defaut;
global $charset;
global $admin_expl_nagopac,$admin_expl_nagopac_new_ligne,$admin_expl_nagopac_ligne_loc;// les templates utilisés
$requete = "SELECT location_libelle,section_libelle,num_pclass,idsection,idlocation,show_a2z FROM docsloc_section JOIN docs_location ON num_location=idlocation JOIN docs_section ON num_section=idsection ORDER BY location_libelle,section_libelle";
$res = mysql_query($requete, $dbh);
$nbr = mysql_num_rows($res);
$requete_pclass = "SELECT id_pclass,name_pclass FROM pclassement";
$res_pclass = mysql_query($requete_pclass, $dbh);
$tabl_pclass=array();
if(mysql_num_rows($res_pclass)){
while ($ligne=mysql_fetch_object($res_pclass)) {
$tabl_pclass[$ligne->id_pclass]=$ligne->name_pclass;
}
}
$parity=1;
$old_localisation="";
for($i=0;$i<$nbr;$i++) {
$row=mysql_fetch_object($res);
//on met dans le formulaire les champs caché
$new_ligne=$admin_expl_nagopac_new_ligne;
$new_ligne=str_replace("!!num_ligne!!",$i,$new_ligne);
$new_ligne=str_replace("!!location_id!!",$row->idlocation,$new_ligne);
$new_ligne=str_replace("!!section_id!!",$row->idsection,$new_ligne);
//Localisation
if($row->location_libelle != $old_localisation){//Si on a changé de localisation
$new_ligne=str_replace("",$admin_expl_nagopac_ligne_loc,$new_ligne);
$new_ligne=str_replace("!!libelle_localisation!!",htmlentities($row->location_libelle,ENT_QUOTES,$charset),$new_ligne);
$new_ligne=str_replace("!!location_id!!",$row->idlocation,$new_ligne);
$new_ligne=str_replace("!!checked!!",(($row->show_a2z)?'checked="checked"':''),$new_ligne);
$old_localisation=$row->location_libelle;//On enregistre le dernier libellé
$parity=1;
}
//alternance des lignes
if ($parity % 2) {
$pair_impair = "even";
}else{
$pair_impair = "odd";
}
$new_ligne=str_replace("!!pair_impair!!",$pair_impair,$new_ligne);
$parity+=1;
//Section
$new_ligne=str_replace("!!libelle_section!!",htmlentities($row->section_libelle,ENT_QUOTES,$charset),$new_ligne);
//Plan de classement
//On affiche un selecteur
$selector= "";
$new_ligne=str_replace("!!plan_classement!!",$selector,$new_ligne);
//On ajoute la nouvelle ligne au formulaire
$admin_expl_nagopac=str_replace("",$new_ligne,$admin_expl_nagopac);
}
print pmb_bidi($admin_expl_nagopac);
}
switch($action) {
case 'save':
$i=0;
$id_pclass="pclass_".$i;
while(isset($$id_pclass)){
//On enregistre la valeur
$idsection="id_section_".$i;
$idlocalisation="id_localisation_".$i;
$requete="UPDATE docsloc_section SET num_pclass='".$$id_pclass."' WHERE num_location='".$$idlocalisation."' AND num_section='".$$idsection."' ";
mysql_query($requete,$dbh);
$i++;
$id_pclass="pclass_".$i;
}
//a2z
$q = "update docs_location set show_a2z='0'";
mysql_query($q,$dbh);
if (is_array($a2z) && count($a2z)) {
$q = "update docs_location set show_a2z='1' where idlocation in (".implode(',',array_keys($a2z)).")";
mysql_query($q,$dbh);
}
$admin_expl_nagopac=str_replace("","