setDomain(2); } $requete = "SELECT bulletin_id, bulletin_numero, bulletin_notice, mention_date, date_date, bulletin_titre, bulletin_cb, date_format(date_date, '".$msg["format_date_sql"]."') as aff_date_date,num_notice FROM bulletins WHERE bulletin_id='$id'"; $res = @mysql_query($requete, $dbh); while(($obj=mysql_fetch_array($res))) { //on regarde tout de suite les droits de la notice de périodique... $perio_id = $obj["bulletin_notice"]; //droits d'acces emprunteur/notice $acces_v=TRUE; if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $acces_v = $dom_2->getRights($_SESSION['id_empr_session'],$perio_id,4); } else { $requete = "SELECT notice_visible_opac, expl_visible_opac, notice_visible_opac_abon, expl_visible_opac_abon, explnum_visible_opac, explnum_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='".$perio_id."' and id_notice_statut=statut "; $myQuery = mysql_query($requete, $dbh); if(mysql_num_rows($myQuery)) { $statut_temp = mysql_fetch_object($myQuery); if(!$statut_temp->notice_visible_opac) $acces_v=FALSE; if($statut_temp->notice_visible_opac_abon && !$_SESSION['id_empr_session']) $acces_v=FALSE; } else $acces_v=FALSE; } if($id && $acces_v) { //on peut voir les bulletins de ce périodique... //on regarde si on a vraiment de voir ce bulletin en particulier (si on a une notice de bulletin) if($obj['num_notice']){ if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $acces_v = $dom_2->getRights($_SESSION['id_empr_session'],$obj['num_notice'],4); } else { $requete = "SELECT notice_visible_opac, notice_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='".$obj['num_notice']."' and id_notice_statut=statut "; $myQuery = mysql_query($requete, $dbh); if(mysql_num_rows($myQuery)) { $statut_temp = mysql_fetch_object($myQuery); if(!$statut_temp->notice_visible_opac) $acces_v=FALSE; if($statut_temp->notice_visible_opac_abon && !$_SESSION['id_empr_session']) $acces_v=FALSE; } else $acces_v=FALSE; } } if($acces_v){ //on est maintenant sur que ce bulletin est visible ! $id_for_right = $perio_id; if($obj['num_notice']){ $id_for_right = $obj['num_notice']; } //est-ce que je peux voir les exemplaires $expl_visible = true; if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $expl_visible = $dom_2->getRights($_SESSION['id_empr_session'],$id_for_right,8); } else { $requete = "SELECT expl_visible_opac, expl_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='".$id_for_right."' and id_notice_statut=statut "; $myQuery = mysql_query($requete, $dbh); if(mysql_num_rows($myQuery)) { $statut_temp = mysql_fetch_object($myQuery); if(!$statut_temp->expl_visible_opac) $expl_visible=false; if($statut_temp->expl_visible_opac_abon && !$_SESSION['id_empr_session']) $expl_visible=false; } else $expl_visible=false; } //est-ce que je peux voir les documents numériques $docnum_visible = true; if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $docnum_visible = $dom_2->getRights($_SESSION['id_empr_session'],$id_for_right,16); } else { $requete = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='".$id_for_right."' and id_notice_statut=statut "; $myQuery = mysql_query($requete, $dbh); if(mysql_num_rows($myQuery)) { $statut_temp = mysql_fetch_object($myQuery); if(!$statut_temp->explnum_visible_opac) $docnum_visible=false; if($statut_temp->explnum_visible_opac_abon && !$_SESSION['id_empr_session']) $docnum_visible=false; } else $docnum_visible=false; } $nb_docnum = 0; if($docnum_visible || $opac_show_links_invisible_docnums){ //on cherches des documents numériques $req = "select explnum_id from explnum where explnum_bulletin = ".$obj["bulletin_id"]; $resultat = mysql_query($req, $dbh) or die ($req." ".mysql_error()); $nb_docnum = mysql_num_rows($resultat); //on met le nécessaire pour la visionneuse if($opac_visionneuse_allow && $nb_docnum){ //print "   ".$link_to_visionneuse; print " "; } } $typdocchapeau="a"; $icon=""; $requete3 = "SELECT notice_id,typdoc FROM notices WHERE notice_id='".$perio_id."' "; $res3 = @mysql_query($requete3, $dbh); while(($obj3=mysql_fetch_object($res3))) { $notice3 = new notice($obj3->notice_id); $typdocchapeau=$obj3->typdoc; } $notice3->fetch_visibilite(); if (!$icon) $icon="icon_per.gif"; $icon = $icon_doc["b".$typdocchapeau]; //carrousel pour la navigation if($opac_show_bulletin_nav) $res_print = do_carroussel($obj); else $res_print=""; $res_print .= "

".$notice3->print_resume(1,$css)."."." ".$obj["bulletin_numero"]."".($nb_docnum ? " ".($nb_docnum > 1 ? "" : "")."" : "")."

\n"; $num_notice=$obj['num_notice']; if ($obj['bulletin_titre']) { $res_print .= htmlentities($obj['bulletin_titre'],ENT_QUOTES, $charset)."
"; } if ($obj['mention_date']) $res_print .= $msg['bull_mention_date']."  ".$obj['mention_date']."\n"; if ($obj['date_date']) $res_print .= "
".$msg['bull_date_date']."  ".$obj['aff_date_date']." \n"; if ($obj['bulletin_cb']) { $res_print .= "
".$msg["code_start"]." ".htmlentities($obj['bulletin_cb'],ENT_QUOTES, $charset)."\n"; $code_cb_bulletin = $obj['bulletin_cb']; } do_image(&$res_print, $code_cb_bulletin, 0 ) ; if ($num_notice) { // Il y a une notice de bulletin print $res_print ; $opac_notices_depliable = 0; $seule=1; print pmb_bidi(aff_notice($num_notice,0,0)) ; } else { // construction des dépouillements $depouill= "

".$msg['bull_dep']."

"; $requete = "SELECT * FROM analysis, notices, notice_statut WHERE analysis_bulletin='$id' AND notice_id = analysis_notice 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)":"").") "; $res = @mysql_query($requete, $dbh); if (mysql_num_rows($res)) { if ($opac_notices_depliable) $depouill .= $begin_result_liste; if ($opac_cart_allow) $depouill.="".$msg["cart_add_result_in"].""; $depouill.= "
"; while(($obj=mysql_fetch_array($res))) { $depouill.= pmb_bidi(aff_notice($obj["analysis_notice"])); } $depouill.= "
"; } else $depouill = $msg["no_analysis"]; print $res_print ; print $depouill ; if ($expl_visible) { if (!$opac_resa_planning) { $resa_check=check_statut(0,$id) ; if ($resa_check) { $requete_resa = "SELECT count(1) FROM resa WHERE resa_idbulletin='$id'"; $nb_resa_encours = mysql_result(mysql_query($requete_resa,$dbh), 0, 0) ; if ($nb_resa_encours) $message_nbresa = str_replace("!!nbresa!!", $nb_resa_encours, $msg["resa_nb_deja_resa"]) ; if (($_SESSION["user_code"] && $allow_book) && $opac_resa && !$popup_resa) { $ret_resa .= "

".$msg["bulletin_display_resa"]."

"; if ($opac_max_resa==0 || $opac_max_resa>$nb_resa_encours) { if ($opac_resa_popup) $ret_resa .= "".$msg["bulletin_display_place_resa"]."" ; else $ret_resa .= "".$msg["bulletin_display_place_resa"]."" ; $ret_resa .= $message_nbresa ; } else $ret_resa .= str_replace("!!nb_max_resa!!", $opac_max_resa, $msg["resa_nb_max_resa"]) ; $ret_resa.= "
"; } elseif (!($_SESSION["user_code"]) && $opac_resa && !$popup_resa) { // utilisateur pas connecté // préparation lien réservation sans être connecté $ret_resa .= "

".$msg["bulletin_display_resa"]."

"; if ($opac_resa_popup) $ret_resa .= "".$msg["bulletin_display_place_resa"]."" ; else $ret_resa .= "".$msg["bulletin_display_place_resa"]."" ; $ret_resa .= $message_nbresa ; $ret_resa .= "
"; } elseif ($fonction=='notice_affichage_custom_bretagne') { if ($opac_resa_popup) $reserver = "notice_id."&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;}else return false;\" id=\"bt_resa\">".$msg["bulletin_display_place_resa"]."" ; else $reserver = "".$msg["bulletin_display_place_resa"]."" ; $reservernbre = $message_nbresa ; } else $ret_resa = ""; print pmb_bidi($ret_resa) ; } } if ($opac_show_exemplaires) { if($fonction=='notice_affichage_custom_bretagne') print pmb_bidi(notice_affichage_custom_bretagne::expl_list("m",0,$id)); else print pmb_bidi(notice_affichage::expl_list("m",0,$id)); } } if ($docnum_visible || $opac_show_links_invisible_docnums) { if (($explnum = show_explnum_per_notice(0, $id, ''))) print pmb_bidi("

".$msg["explnum"]."

".$explnum); } } mysql_free_result($res); print notice_affichage::autres_lectures (0,$id); } } } function do_carroussel($bull){ global $gestion_acces_active,$gestion_acces_empr_notice; global $msg; if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $ac = new acces(); $dom_2= $ac->setDomain(2); $join_noti = $dom_2->getJoin($_SESSION["user_code"],4,"bulletins.num_notice"); $join_bull = $dom_2->getJoin($_SESSION["user_code"],4,"bulletins.bulletin_notice"); }else{ $join_noti = "join notices on bulletins.num_notice = notices.notice_id join notice_statut on notices.statut = notice_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)":"").")"; $join_bull = "join notices on bulletins.bulletin_notice = notices.notice_id join notice_statut on notices.statut = notice_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)":"").")"; } $requete_noti = "select bulletin_id, bulletin_numero, bulletin_notice, mention_date, date_date, bulletin_titre, bulletin_cb, date_format(date_date, '".$msg["format_date_sql"]."') as aff_date_date,num_notice from bulletins ".$join_noti." where bulletins.num_notice != 0 and bulletin_notice = ".$bull['bulletin_notice'].""; $requete_bull = "select bulletin_id, bulletin_numero, bulletin_notice, mention_date, date_date, bulletin_titre, bulletin_cb, date_format(date_date, '".$msg["format_date_sql"]."') as aff_date_date,num_notice from bulletins ".$join_bull." where bulletins.num_notice = 0 and bulletin_notice = ".$bull['bulletin_notice'].""; $requete = "select * from (".$requete_noti." union ".$requete_bull.") as uni"; $requete = "(".$requete." where date_date < '".$bull['date_date']."' order by date_date desc limit 0,3) union (".$requete." where date_date >= '".$bull['date_date']."' order by date_date asc limit 0,4)"; $res_caroussel = mysql_query($requete); if(mysql_num_rows($res_caroussel)){ $prev = true; $current = $previous = $next = array(); while (($bullForNav=mysql_fetch_array($res_caroussel))) { if($bullForNav['bulletin_id'] == $bull['bulletin_id']){ $prev = false; $current = $bullForNav; }else{ if($prev == true){ $previous[] = $bullForNav; }else{ $next[] = $bullForNav; } } } $carroussel = " "; $taille = 100; //on a des bulletins précédent if (sizeof($previous)>0){ $taille =$taille - 4; } //on a des bulletins suivant if(sizeof($next)>0){ $taille =$taille - 4; } //ceux d'avant //on égalise : 3 de chaque coté if(sizeof($previous)>0)$carroussel .= ""; for($i=0 ; $i<(3-sizeof($previous)) ; $i++){ $carroussel .=""; } if(sizeof($previous)>0){ for($i=sizeof($previous)-1 ; $i>=0 ; $i--){ $carroussel .=""; } } //le bull courant en évidence $carroussel .=""; //la suite if(sizeof($next)>0){ for($i=0 ; $i".$next[$i]['bulletin_numero'].($next[$i]['bulletin_titre'] ? " - ".$next[$i]['bulletin_titre'] : "")."
".($next[$i]['mention_date'] ? $next[$i]['mention_date'] :$next[$i]['aff_date_date'] )."
"; } } //on égalise : 3 de chaque coté for($i=0 ; $i<(3-sizeof($next)) ; $i++){ $carroussel .="
"; } if(sizeof($next)>0)$carroussel .= ""; //on ferme le tout $carroussel .= "
 ".$previous[$i]['bulletin_numero'].($previous[$i]['bulletin_titre'] ? " - ".$previous[$i]['bulletin_titre'] : "")."
".($previous[$i]['mention_date'] ? $previous[$i]['mention_date'] :$previous[$i]['aff_date_date'] )."
".$current['bulletin_numero'].($current['bulletin_titre'] ? " - ".$current['bulletin_titre'] : "")."
".($current['mention_date'] ? $current['mention_date'] :$current['aff_date_date'] )."
 
"; } return $carroussel; }