num_noeud_racine;
//FIL D'ARIANNE DANS LE THESAURUS
$context['authority']['breadcrumb'] = "";
$ourCateg = new categorie($id);
// affichage du path de la catégorie
if ($opac_thesaurus) $thes_lib_to_print = "thes->num_noeud_racine."\">".$ourCateg->thes->libelle_thesaurus."";
else $thes_lib_to_print = "thes->num_noeud_racine."\">";
$context['authority']['breadcrumb'] = $thes_lib_to_print;
$context['authority']['breadcrumb'].= pmb_bidi($ourCateg->categ_path($opac_categories_categ_path_sep,$css));
//SYNONYMES
$context['authority']['synonyms'] = array();
$synonymes=categories::listSynonymes($id, $lang);
while($row = pmb_mysql_fetch_object($synonymes)){
$context['authority']['synonyms'][] =$row->libelle_categorie;
}
//VOIR
if($ourCateg->voir){
$context['authority']['voir'] = new categories($ourCateg->voir, $lang);
}
//VOIR AUSSI
$context['authority']['see_also'] = array();
$q = "select ";
$q.= "distinct catdef.num_noeud,catdef.note_application, catdef.comment_public,";
$q.= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
$q.= "from voir_aussi left join noeuds on noeuds.id_noeud=voir_aussi.num_noeud_dest ";
$q.= "left join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = '".$thes->langue_defaut."' ";
$q.= "left join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '".$lang."' ";
$q.= "where ";
$q.= "voir_aussi.num_noeud_orig = '".$id."' ";
$q.= "order by libelle_categorie limit ".$opac_categories_max_display;
$found_see_too = pmb_mysql_query($q, $dbh);
$see_also="";
if (pmb_mysql_num_rows($found_see_too)) {
$deb = 0 ;
while (($mesCategories_see_too = pmb_mysql_fetch_object($found_see_too))) {
$mesCategories_see_too->zoom = categorie::zoom_categ($mesCategories_see_too->num_noeud, $mesCategories_see_too->comment_public);
$mesCategories_see_too->has_notice = category::has_notices($mesCategories_see_too->num_noeud);
$context['authority']['see_also'][] = $mesCategories_see_too;
}
}
//LISTE DES NOTICES ASSOCIEES
//Lire le champ path du noeud pour étendre la recherche éventuellement au fils et aux père de la catégorie
// lien Etendre auto_postage
if (!isset($nb_level_enfants)) {
// non defini, prise des valeurs par défaut
if (isset($_SESSION["nb_level_enfants"]) && $opac_auto_postage_etendre_recherche) $nb_level_descendant=$_SESSION["nb_level_enfants"];
else $nb_level_descendant=$opac_auto_postage_nb_descendant;
} else {
$nb_level_descendant=$nb_level_enfants;
}
// lien Etendre auto_postage
if(!isset($nb_level_parents)) {
// non defini, prise des valeurs par défaut
if(isset($_SESSION["nb_level_parents"]) && $opac_auto_postage_etendre_recherche) $nb_level_montant=$_SESSION["nb_level_parents"];
else $nb_level_montant=$opac_auto_postage_nb_montant;
} else {
$nb_level_montant=$nb_level_parents;
}
$_SESSION["nb_level_enfants"]= $nb_level_descendant;
$_SESSION["nb_level_parents"]= $nb_level_montant;
$q = "select path from noeuds where id_noeud = '".$id."' ";
$r = pmb_mysql_query($q, $dbh);
if($r && pmb_mysql_num_rows($r)){
$path=pmb_mysql_result($r, 0, 0);
$nb_pere=substr_count($path,'/');
}else{
$path="";
$nb_pere=0;
}
$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,'notcateg_notice');
}
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;
}
// Si un path est renseigné et le paramètrage activé
if ($path && ($opac_auto_postage_descendant || $opac_auto_postage_montant || $opac_auto_postage_etendre_recherche) && ($nb_level_montant || $nb_level_descendant)){
//Recherche des fils
if(($opac_auto_postage_descendant || $opac_auto_postage_etendre_recherche)&& $nb_level_descendant) {
if($nb_level_descendant != '*' && is_numeric($nb_level_descendant))
$liste_fils=" path regexp '^$path(\\/[0-9]*){0,$nb_level_descendant}$' ";
else
//$liste_fils=" path regexp '^$path(\\/[0-9]*)*' ";
$liste_fils=" path like '$path/%' or path = '$path' ";
} else {
$liste_fils=" id_noeud='".$id."' ";
}
// recherche des pères
if(($opac_auto_postage_montant || $opac_auto_postage_etendre_recherche) && $nb_level_montant ) {
$id_list_pere=explode('/',$path);
$stop_pere=0;
if($nb_level_montant != '*' && is_numeric($nb_level_montant)) $stop_pere=$nb_pere-$nb_level_montant;
if($stop_pere<0) $stop_pere=0;
for($i=$nb_pere;$i>=$stop_pere; $i--) {
$liste_pere.= " or id_noeud='".$id_list_pere[$i]."' ";
}
}
$suite_req = " FROM noeuds STRAIGHT_JOIN notices_categories on id_noeud=num_noeud join notices on notcateg_notice=notice_id $acces_j $statut_j ";
$suite_req.= "WHERE ($liste_fils $liste_pere) $statut_r ";
} else {
// cas normal d'avant
$suite_req = " FROM notices_categories join notices on notcateg_notice=notice_id $acces_j $statut_j ";
$suite_req.= "WHERE num_noeud='".$id."' $statut_r ";
}
if ($path) {
if ($opac_auto_postage_etendre_recherche == 1 || ($opac_auto_postage_etendre_recherche == 2 && !$nb_pere)) {
$input_txt="";
$auto_postage_form=str_replace("!!nb_level_enfants!!",$input_txt,$msg["categories_autopostage_enfants"]);
} elseif ($opac_auto_postage_etendre_recherche == 2 && $nb_pere) {
$input_txt="";
$auto_postage_form=str_replace("!!nb_level_enfants!!",$input_txt,$msg["categories_autopostage_parents_enfants"]);
$input_txt="";
$auto_postage_form=str_replace("!!nb_level_parents!!",$input_txt,$auto_postage_form);
} elseif ($opac_auto_postage_etendre_recherche == 3 ) {
if($nb_pere) {
$input_txt="";
$auto_postage_form=str_replace("!!nb_level_parents!!",$input_txt,$msg["categories_autopostage_parents"]);
}
}
}
// comptage des notices associées
if (!$nbr_lignes) {
$requete = "SELECT count(distinct notice_id) ".$suite_req;
$res = pmb_mysql_query($requete, $dbh);
$nbr_lignes = pmb_mysql_result($res, 0, 0);
//Recherche des types doc
$requete="select distinct typdoc ";
if($opac_visionneuse_allow){
$requete.= ",count(explnum_id) as nbexplnum ";
if ($path && ($opac_auto_postage_descendant || $opac_auto_postage_montant || $opac_auto_postage_etendre_recherche) && ($nb_level_montant || $nb_level_descendant)){
$suite_req_type_doc_noti = "FROM noeuds STRAIGHT_JOIN notices_categories on id_noeud=num_noeud join notices on notcateg_notice=notice_id left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_notice = notice_id $acces_j $statut_j ";
$suite_req_type_doc_bull = "FROM noeuds STRAIGHT_JOIN notices_categories on id_noeud=num_noeud join notices on notcateg_notice=notice_id left join bulletins on bulletins.num_notice = notice_id and bulletins.num_notice != 0 left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_bulletin != 0 and explnum_bulletin = bulletin_id $acces_j $statut_j ";
$suite_req_type_doc= "WHERE ($liste_fils $liste_pere) $statut_r group by typdoc";
}else {
$suite_req_type_doc_noti = "FROM notices_categories join notices on notcateg_notice=notice_id left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_notice = notice_id $acces_j $statut_j ";
$suite_req_type_doc_bull = "FROM notices_categories join notices on notcateg_notice=notice_id left join bulletins on bulletins.num_notice = notice_id and bulletins.num_notice != 0 left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_bulletin != 0 and explnum_bulletin = bulletin_id $acces_j $statut_j ";
$suite_req_type_doc= "WHERE num_noeud='".$id."' $statut_r group by typdoc";
}
$requete_noti = $requete.$suite_req_type_doc_noti.$suite_req_type_doc;
$requete_bull = $requete.$suite_req_type_doc_bull.$suite_req_type_doc;
$requete = "select distinct uni.typdoc, sum(nbexplnum) as nbexplnum from (($requete_noti) union ($requete_bull)) as uni group by typdoc";
}else{
$requete .= $suite_req;
}
$res = pmb_mysql_query($requete, $dbh);
$t_typdoc=array();
$nbexplnum_to_photo=0;
if ($res) {
while (($tpd=pmb_mysql_fetch_object($res))) {
$t_typdoc[]=$tpd->typdoc;
if($opac_visionneuse_allow)
$nbexplnum_to_photo += $tpd->nbexplnum;
}
}
$l_typdoc=implode(",",$t_typdoc);
}else if($opac_visionneuse_allow){
$requete="select count(explnum_id) as nbexplnum ";
if ($path && ($opac_auto_postage_descendant || $opac_auto_postage_montant || $opac_auto_postage_etendre_recherche) && ($nb_level_montant || $nb_level_descendant)){
$suite_req_type_doc_noti = "FROM noeuds STRAIGHT_JOIN notices_categories on id_noeud=num_noeud join notices on notcateg_notice=notice_id left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_notice = notice_id $acces_j $statut_j ";
$suite_req_type_doc_bull = "FROM noeuds STRAIGHT_JOIN notices_categories on id_noeud=num_noeud join notices on notcateg_notice=notice_id left join bulletins on bulletins.num_notice = notice_id and bulletins.num_notice != 0 left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_bulletin != 0 and explnum_bulletin = bulletin_id $acces_j $statut_j ";
$suite_req_type_doc= "WHERE ($liste_fils $liste_pere) $statut_r";
}else {
$suite_req_type_doc_noti = "FROM notices_categories join notices on notcateg_notice=notice_id left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_notice = notice_id $acces_j $statut_j ";
$suite_req_type_doc_bull = "FROM notices_categories join notices on notcateg_notice=notice_id left join bulletins on bulletins.num_notice = notice_id and bulletins.num_notice != 0 left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_bulletin != 0 and explnum_bulletin = bulletin_id $acces_j $statut_j ";
$suite_req_type_doc= "WHERE num_noeud='".$id."' $statut_r";
}
$requete_noti = $requete.$suite_req_type_doc_noti.$suite_req_type_doc;
$requete_bull = $requete.$suite_req_type_doc_bull.$suite_req_type_doc;
$requete = "select sum(nbexplnum) as nbexplnum from (($requete_noti) union ($requete_bull)) as uni";
$res = pmb_mysql_query($requete, $dbh);
$nbexplnum_to_photo=0;
if ($res) {
while (($tpd=pmb_mysql_fetch_object($res))) {
$nbexplnum_to_photo += $tpd->nbexplnum;
}
}
}
// pour la DSI
if ($nbr_lignes && $opac_allow_bannette_priv && $allow_dsi_priv && ($_SESSION['abon_cree_bannette_priv']==1 || $opac_allow_bannette_priv==2)) {
$recordslist= " ";
}
// Ouverture du div resultatrech_liste
$recordslist.= "
\n"; // on lance la vraie requête $requete = "SELECT distinct notices.notice_id $suite_req"; //gestion du tri if ($_SESSION["last_sortnotices"]!="") { $requete = $sort->appliquer_tri($_SESSION["last_sortnotices"], $requete, "notice_id", $debut, $opac_nb_aut_rec_per_page); } else { $sort=new sort('notices','session'); $requete = $sort->appliquer_tri("default", $requete, "notice_id", $debut, $opac_nb_aut_rec_per_page); } //fin gestion du tri $res = @pmb_mysql_query($requete, $dbh); $recordslist.= aff_notice(-1); $nb=0; $recherche_ajax_mode=0; while (($obj=pmb_mysql_fetch_object($res))) { global $infos_notice; if($nb++>4) $recherche_ajax_mode=1; $recordslist.= pmb_bidi(aff_notice($obj->notice_id, 0, 1, 0, "", "", 0, 0, $recherche_ajax_mode)); $infos_notice['nb_pages'] = ceil($nbr_lignes/$opac_nb_aut_rec_per_page); } $recordslist.= aff_notice(-2); pmb_mysql_free_result($res); // constitution des liens $nbepages = ceil($nbr_lignes/$opac_nb_aut_rec_per_page); $recordslist.= "\n"; // $recordslist.= "