\n";
if($opac_view_filter_class){
$requete="select idlocation, location_libelle, location_pic, css_style from docs_location where location_visible_opac=1
and idlocation in(". implode(",",$opac_view_filter_class->params["nav_sections"]).") order by location_libelle ";
}
else
$requete="select idlocation, location_libelle, location_pic from docs_location where location_visible_opac=1 order by location_libelle ";
$resultat=mysql_query($requete);
if (mysql_num_rows($resultat)>1) {
print "
";
$npl=0;
while ($r=mysql_fetch_object($resultat)) {
if ($npl==0) print "";
if ($r->location_pic) $image_src = $r->location_pic ;
else $image_src = "images/bibli-small.png" ;
if ($back_section_see) $param_section_see="&back_section_see=".$back_section_see;
else $param_section_see="";
print "
".$r->location_libelle." | ";
$npl++;
if ($npl==$opac_nb_localisations_per_line) {
print "
";
$npl=0;
}
}
if ($npl!=0) {
while ($npl<$opac_nb_localisations_per_line) {
print " | ";
$npl++;
}
print "";
}
print "
";
} else {
// zéro ou une seule localisation
if (mysql_num_rows($resultat)) {
$location=mysql_result($resultat,0,0);
$requete="select idsection, section_libelle, section_pic from docs_section, exemplaires where expl_location=$location and section_visible_opac=1 and expl_section=idsection group by idsection order by section_libelle ";
$resultat=mysql_query($requete);
print "
";
$npl=0;
while ($r=mysql_fetch_object($resultat)) {
if ($npl==0) print "";
if ($r->section_pic) $image_src = $r->section_pic ;
else $image_src = "images/rayonnage-small.png" ;
print "
".$r->section_libelle." | ";
$npl++;
if ($npl==$opac_nb_localisations_per_line) {
print "
";
$npl=0;
}
}
if ($npl!=0) {
while ($npl<$opac_nb_localisations_per_line) {
print " | ";
$npl++;
}
print "";
}
print "
";
}
}
} else {
// id localisation fournie
$location+=0;
$requete="select location_libelle,surloc_num, location_pic, name, adr1, adr2, cp, town, state, country, phone, email, website, commentaire, show_a2z from docs_location where idlocation='$location' and location_visible_opac=1";
$resultat=mysql_query($requete);
$objloc=mysql_fetch_object($resultat);
if ($back_surloc) $param_surloc = "&back_surloc=".rawurlencode($back_surloc);
else $param_surloc="";
$url_loc ="index.php?lvl=section_see&location=".$location;
if ($back_section_see) $param_section_see = "&back_section_see=".$back_section_see;
else $param_section_see="";
if ($back_loc) $location_link="
". htmlentities($objloc->location_libelle,ENT_QUOTES,$charset)."";
else $location_link=" ".htmlentities($objloc->location_libelle,ENT_QUOTES,$charset);
if ($opac_sur_location_activate==1){
$requete="select surloc_id, surloc_libelle, surloc_pic, surloc_css_style from sur_location where surloc_id='$objloc->surloc_num'";
$resultat=mysql_query($requete);
if (mysql_num_rows($resultat)) {
if ($r=mysql_fetch_object($resultat)) {
if ($back_surloc) $url_surloc = $back_surloc;
else $url_surloc = "index.php?lvl=section_see&surloc=".$r->surloc_id;
$sur_location_link="
". htmlentities( $r->surloc_libelle,ENT_QUOTES,$charset)."";
}
}
}
print "
\n";
if ($back_section_see) $url_section_see = $back_section_see;
else $url_section_see = "index.php?lvl=section_see";
print "
$sur_location_link.$location_link
";
if ($objloc->commentaire || $objloc->location_pic) {
print "";
}
$Fnm = "includes/mw_liste_type.inc.php";
if (file_exists($Fnm)) { include($Fnm);}
print "
\n";
//Il n'y a pas de section sélectionnée
if (!$id) {
$location+=0;
$requete="select idsection, section_libelle, section_pic from docs_section, exemplaires where expl_location=$location and section_visible_opac=1 and expl_section=idsection group by idsection order by section_libelle ";
$resultat=mysql_query($requete);
print "
".sprintf($msg["l_title_search"],"","")."";
print "
";
$n=0;
while ($r=mysql_fetch_object($resultat)) {
if ($n==0) print "";
if ($r->section_pic) $image_src = $r->section_pic ;
else $image_src = "images/rayonnage-small.png" ;
if ($back_section_see) $param_section_see = "&back_section_see=index.php";
else $param_section_see = "";
if ($back_surloc) {
$url = "./index.php?lvl=section_see&location=".$location."&id=".$r->idsection."&back_surloc=".rawurlencode($back_surloc)."&back_loc=".rawurlencode($url_loc).$param_section_see;
} else {
$url = "./index.php?lvl=section_see&location=".$location."&id=".$r->idsection;
}
print "
".htmlentities($r->section_libelle,ENT_QUOTES,$charset)." | ";
$n++;
if ($n==$opac_nb_sections_per_line) { print "
"; $n=0; }
}
if ($n!=0) {
while ($n<$opac_nb_sections_per_line) {
print " | ";
$n++;
}
print "";
}
print "
";
if ($objloc->show_a2z) {
require_once($base_path."/classes/perio_a2z.class.php");
$a2z=new perio_a2z(0,$opac_perio_a2z_abc_search,$opac_perio_a2z_max_per_onglet);
print $perio_a2z=$a2z->get_form();
}
} else {
$id+=0;
$location+=0;
$requete="select section_libelle, section_pic from docs_section where idsection=$id";
$section_libelle=mysql_result(mysql_query($requete),0,0);
$section_pic=mysql_result(mysql_query($requete),0,1);
if ($section_pic) $image_src = $section_pic ;
else $image_src = "images/rayonnage-small.png" ;
print "
";
if (!file_exists($Fnm)) print " ";
$requete="SELECT num_pclass FROM docsloc_section WHERE num_location='".$location."' AND num_section='".$id."' ";
$res=mysql_query($requete);
$type_aff_navigopac=0;
if(mysql_num_rows($res)){
$type_aff_navigopac=mysql_result($res,0,0);
}
//droits d'acces emprunteur/notice
$acces_j='';
if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) {
require_once("$class_path/acces.class.php");
$ac= new acces();
$dom_2= $ac->setDomain(2);
$acces_j = $dom_2->getJoin($_SESSION['id_empr_session'],4,'notice_id');
}
if($acces_j) {
$statut_j='';
$statut_r='';
} else {
$statut_j=',notice_statut';
$statut_r="and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)".($_SESSION["user_code"]?" or (notice_visible_opac_abon=1 and notice_visible_opac=1)":"").")";
}
if($_SESSION["opac_view"] && $_SESSION["opac_view_query"] ){
$opac_view_restrict=" notice_id in (select opac_view_num_notice from opac_view_notices_".$_SESSION["opac_view"].") ";
$statut_r.=" and ".$opac_view_restrict;
}
if($type_aff_navigopac == 0){//Pas de navigation
print pmb_bidi($section_libelle);
print "
\n";
print "
";
//On récupère les notices de monographie avec au moins un exemplaire dans la localisation et la section
$requete="create temporary table temp_n_id ENGINE=MyISAM ( SELECT notice_id FROM notices ".$acces_j." JOIN exemplaires ON expl_section='".$id."' and expl_location='".$location."' and expl_notice=notice_id ".$statut_j." WHERE 1 ".$statut_r." GROUP BY notice_id)";
mysql_query($requete);
//On récupère les notices de périodique avec au moins un exemplaire d'un bulletin dans la localisation et la section
$requete="INSERT INTO temp_n_id (SELECT notice_id FROM exemplaires JOIN bulletins ON expl_section='".$id."' and expl_location='".$location."' and expl_bulletin=bulletin_id JOIN notices ON notice_id=bulletin_notice ".$acces_j." ".$statut_j." WHERE 1 ".$statut_r." GROUP BY notice_id)";
mysql_query($requete);
@mysql_query("alter table temp_n_id add index(notice_id)");
$requete = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
$nbr_lignes=mysql_num_rows(mysql_query($requete));
affiche_notice_navigopac($requete);
}elseif($type_aff_navigopac == -1){//Navigation par auteurs
//On récupère les notices de monographie avec au moins un exemplaire dans la localisation et la section
$requete="create temporary table temp_n_id ENGINE=MyISAM ( SELECT notice_id FROM notices ".$acces_j." JOIN exemplaires ON expl_section='".$id."' and expl_location='".$location."' and expl_notice=notice_id ".$statut_j." WHERE 1 ".$statut_r." GROUP BY notice_id)";
mysql_query($requete);
//On récupère les notices de périodique avec au moins un exemplaire d'un bulletin dans la localisation et la section
$requete="INSERT INTO temp_n_id (SELECT notice_id FROM exemplaires JOIN bulletins ON expl_section='".$id."' and expl_location='".$location."' and expl_bulletin=bulletin_id JOIN notices ON notice_id=bulletin_notice ".$acces_j." ".$statut_j." WHERE 1 ".$statut_r." GROUP BY notice_id)";
mysql_query($requete);
@mysql_query("alter table temp_n_id add index(notice_id)");
if(!$plettreaut){
$nb_auteur_max=18;
//On a pas encore choisi de première lettre d'auteur
print pmb_bidi($section_libelle);
print " > ".$msg["navigopac_aut"];
print "\n";
//On va chercher tous les auteurs des notices
$requete = "SELECT IF(SUBSTRING(TRIM(index_author),1,1) != '' ,SUBSTRING(TRIM(index_author),1,1),'vide') as plettre, COUNT(1) as nb FROM temp_n_id LEFT JOIN responsability ON responsability_notice=notice_id LEFT JOIN authors ON author_id=responsability_author GROUP BY IF(index_author IS NOT NULL and TRIM(index_author) !='',SUBSTRING(TRIM(index_author),1,1),index_author) ORDER BY 1";
$res=mysql_query($requete);
$tab_aut=array();
while ($ligne = mysql_fetch_object($res)) {
//echo " Lettre : ".$ligne->plettre." Nombre : ".$ligne->nb."
";
if($ligne->plettre == "vide"){
if($tab_aut[$ligne->plettre]){
$nb=$tab_aut[$ligne->plettre][0]+$ligne->nb;
$tab_aut[$ligne->plettre]=array($nb,$msg["navigopac_ss_aut"]);
}else{
$tab_aut[$ligne->plettre]=array($ligne->nb,$msg["navigopac_ss_aut"]);
}
}elseif(preg_match("#[0-9]#",$ligne->plettre)){
if($tab_aut["num"]){
$nb=$tab_aut["num"][0]+$ligne->nb;
$tab_aut["num"]=array($nb,"0-9");
}else{
$tab_aut["num"]=array($ligne->nb,"0-9");
}
}else{
$tab_aut[mb_strtoupper($ligne->plettre)]=array($ligne->nb,mb_strtoupper($ligne->plettre));
}
}
while(count($tab_aut) > $nb_auteur_max){//Pour minimiser le nombre d'étagère à afficher
//Je vais chercher deux valeurs qui peuvent être regroupées
$coupl_plus_petit=10000000;
$ancienne_valeur=0;
$ancienne_lettre="";
$lettre_a_regoupe=array();
foreach ($tab_aut as $key => $value ) {
if($key != "num" && $key != "vide"){
if($ancienne_valeur && ($ancienne_valeur + $value[0] < $coupl_plus_petit)){
$coupl_plus_petit=$ancienne_valeur + $value[0];
$lettre_a_regoupe=array($ancienne_lettre,$key);
}
$ancienne_valeur=$value[0];
$ancienne_lettre=$key;
}
}
//J'en regroupe deux
$new_key=substr($lettre_a_regoupe[0],0,1)."-".substr($lettre_a_regoupe[1],-1);
$tab_aut[$new_key]=array(($tab_aut[$lettre_a_regoupe[0]][0]*1+$tab_aut[$lettre_a_regoupe[1]][0]*1),$new_key);
unset($tab_aut[$lettre_a_regoupe[0]]);
unset($tab_aut[$lettre_a_regoupe[1]]);
ksort($tab_aut);
}
print "
";
$n=0;
foreach ( $tab_aut as $key => $value ) {
if ($n==0) print "";
print "".htmlentities($value[1],ENT_QUOTES,$charset)." | ";
$n++;
if ($n==$opac_nb_sections_per_line) { print "
"; $n=0; }
}
if ($n!=0) {
while ($n<$opac_nb_sections_per_line) {
print " | ";
$n++;
}
print "";
}
print "
";
print "
";
$requete = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
$nbr_lignes=mysql_num_rows(mysql_query($requete));
affiche_notice_navigopac($requete);
}else{
//On sait par quoi doit commencer le nom de l'auteur
print "
";
print pmb_bidi($section_libelle);
print "";
if($plettreaut == "num"){
$requete = "SELECT notices.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[0-9]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
print " > ".$msg["navigopac_aut_com_par_chiffre"];
}elseif($plettreaut == "vide"){
$requete = "SELECT notices.notice_id FROM temp_n_id LEFT JOIN responsability ON responsability_notice=temp_n_id.notice_id LEFT JOIN notices ON notices.notice_id=temp_n_id.notice_id WHERE responsability_author IS NULL GROUP BY notices.notice_id";
print " > ".$msg["navigopac_ss_aut"];
}else{
$requete = "SELECT notices.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[".$plettreaut."]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
print " > ".$msg["navigopac_aut_com_par"]." ".$plettreaut;
}
$nbr_lignes=mysql_num_rows(mysql_query($requete));
print "\n";
print "
";
affiche_notice_navigopac($requete);
}
}else{//Navigation par un plan de classement
if (strlen($dcote)||($nc==1)) print "
";
print pmb_bidi($section_libelle);
if (strlen($dcote)||($nc==1)) print "";
//Calcul du chemin
if (strlen($dcote)) {
if (!$ssub) {
for ($i=0; $i
0) {
$cote_n_1=substr($dcote,0,$i);
$compl_n_1=str_repeat("0",$lcote-$i);
if (($ccote)==($cote_n_1.$compl_n_1)) $chemin=$msg["l_general"];
}
if (!$chemin) {
$requete="select indexint_name,indexint_comment from indexint where indexint_name='".$ccote."' and num_pclass='".$type_aff_navigopac."'";
$res_ch=mysql_query($requete);
if (mysql_num_rows($res_ch))
$chemin=mysql_result(mysql_query($requete),0,1);
else
$chemin=$msg["l_unclassified"];
}
print " > ";
if ((($i+1)";
print pmb_bidi($chemin);
if ((($i+1)"; else $theme=$chemin;
}
} else {
$t_dcote=explode(",",$dcote);
$requete="select indexint_comment from indexint where indexint_name='".stripslashes($t_dcote[0])."' and num_pclass='".$type_aff_navigopac."'";
$res_ch=mysql_query($requete);
if (mysql_num_rows($res_ch))
$chemin=mysql_result(mysql_query($requete),0,0);
else
$chemin=$msg["l_unclassified"];
print pmb_bidi(" > ".$chemin);
}
}
if ($nc==1) { print " > ".$msg["l_unclassified"]; $theme=$msg["l_unclassified"]; }
print "\n";
if ($ssub) {
$t_expl_cote_cond=array();
for ($i=0; $i0) {
$zendKey = substr($ct->expl_cote, 0, $lf);
if ($zendIndexInt[$zendKey]) {
if (!$nc) {
$t["comment"]=$zendIndexInt[$zendKey];
$t["dcote"]=$zendKey;
$t["ssub"]=1;
$index[$t["dcote"]]=$t;
break;
} else {
$rq_del="select distinct notice_id from notices, exemplaires where expl_cote='".$ct->expl_cote."' and expl_notice=notice_id ";
$rq_del.=" union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='".$ct->expl_cote."' and expl_bulletin=bulletin_id and bulletin_notice=notice_id ";
$res_del=mysql_query($rq_del) ;
while (list($n_id)=mysql_fetch_row($res_del)) {
mysql_query("delete from temp_n_id where notice_id=".$n_id);
}
}
}
$lf--;
}
if ($lf==0) {
if (preg_match("/[0-9][0-9][0-9]/",$ct->expl_cote,$c)) {
$found=false;
$lcote=3;
$level=$level_ref;
while ((!$found)&&($level<=$lcote)) {
$cote=substr($c[0],0,$level);
$compl=str_repeat("0",$lcote-$level);
$rq_index="select indexint_name,indexint_comment from indexint where indexint_name='".$cote.$compl."' and length(indexint_name)>=$lcote and indexint_comment!='' and num_pclass='".$type_aff_navigopac."' order by indexint_name limit 1 ";
$res_index_1=mysql_query($rq_index);
if (mysql_num_rows($res_index_1)) {
$name=mysql_result($res_index_1,0,0);
if (!$nc) {
if (substr($name,0,$level-1)==$dcote) {
$t["comment"]=mysql_result($res_index_1,0,1);
if ($level>1) {
$cote_n_1=substr($c[0],0,$level-1);
$compl_n_1=str_repeat("0",$lcote-$level+1);
if (($cote.$compl)==($cote_n_1.$compl_n_1))
$t["comment"]="Généralités";
}
$t["lcote"]=$lcote;
$t["dcote"]=$cote;
$index[$name]=$t;
$found=true;
} else $level++;
} else {
if (substr($name,0,$level-1)==$dcote) {
$rq_del="select distinct notice_id from notices, exemplaires where expl_cote='".$ct->expl_cote."' and expl_notice=notice_id ";
$rq_del.=" union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='".$ct->expl_cote."' and expl_bulletin=bulletin_id and bulletin_notice=notice_id ";
$res_del=mysql_query($rq_del);
while (list($n_id)=mysql_fetch_row($res_del)) {
mysql_query("delete from temp_n_id where notice_id=".$n_id);
}
$found=true;
} else $level++;
}
} else $level++;
}
if (($level>$lcote)&&($lf==0)) {
$t["comment"]=$msg["l_unclassified"];
$t["lcote"]=$lcote;
$t["dcote"]=$dcote;
$index["NC"]=$t;
}
} else {
$t["comment"]=$msg["l_unclassified"];
$t["lcote"]=$lcote;
$t["dcote"]=$dcote;
$index["NC"]=$t;
}
}
}
}
if ($nc) {
$nbr_lignes=mysql_result(mysql_query("select count(1) from temp_n_id"),0,0);
}
if ($nbr_lignes) {
//Affichage des sous catégories
if (count($index)>1) {
if (!strlen($dcote))
print pmb_bidi(sprintf($msg["l_etageres"],htmlentities($section_libelle,ENT_QUOTES,$charset)));
else if (strlen($dcote)==1)
print pmb_bidi(sprintf($msg["l_themes"],htmlentities($theme,ENT_QUOTES,$charset)));
else
pmb_bidi(print sprintf($msg["l_sub_themes"],htmlentities($theme,ENT_QUOTES,$charset)));
reset($index);
$ssub_val=array();
//Regroupement des libellés identiques hors dewey
while (list($key,$val)=each($index)) {
if ($val["ssub"]) {
if ($ssub_val[$val["comment"]]) {
$ssub_val[$val["comment"]]["dcote"].=",".$val["dcote"];
} else {
$ssub_val[$val["comment"]]=$val;
}
} else {
$ssub_val[$val["comment"]."@ssub"]=$val;
}
}
//Affichage du classement si il reste suffisamment de catégories
if (count($ssub_val)>1) {
$opac_categories_nb_col_subcat;
$cur_col=0;
reset($ssub_val);
asort($ssub_val);
print "";
while (list($key,$val)=each($ssub_val)) {
if ($cur_col==0) print "";
if (($key=="NC")||($key==$msg["l_unclassified"]."@ssub")) $nc1=1; else $nc1=0;
print "".htmlentities($val["comment"],ENT_QUOTES,$charset)." | ";
$cur_col++;
if ($cur_col==$opac_categories_nb_col_subcat) {
print "
";
$cur_col=0;
}
}
if ($cur_col<$opac_categories_nb_col_subcat) {
for ($i=$curl_col; $i<$opac_categories_nb_col_subcat; $i++) {
print " | ";
}
print "";
}
print "
";
}
}
print "";
$requete = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id ";
affiche_notice_navigopac($requete);
} else {
print "