\n";
if ($id) {
// instanciation de la catégorie
$ourCateg = new categorie($id);
// affichage du path de la catégorie
if ($opac_thesaurus) $thes_lib_to_print = "
\n".$thes_lib_to_print."\n";
print pmb_bidi($ourCateg->categ_path($opac_categories_categ_path_sep,$css));
// si la catégorie à des enfants, on les affiche
if ($ourCateg->has_child) print pmb_bidi($ourCateg->child_list('./images/folder.gif',$css));
$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 = mysql_query($q, $dbh);
if (mysql_num_rows($found_see_too)) {
print "
".$msg['term_show_see_also']." " ;
$deb = 0 ;
while (($mesCategories_see_too = mysql_fetch_object($found_see_too))) {
if ($deb) print " / " ;
$note = $mesCategories_see_too->comment_public;
//$c_categ = new category($mesCategories_see_too->num_noeud);
// Affichage du commentaire par le layer sur les "Voir aussi"
$result_com = categorie::zoom_categ($mesCategories_see_too->num_noeud, $note);
print "
num_noeud.">";
if (category::has_notices($mesCategories_see_too->num_noeud)) print " ";
else print " ";
print pmb_bidi("num_noeud."".$result_com['java_com'].">".$mesCategories_see_too->libelle_categorie.''.$result_com['zoom']);
$deb = 1 ;
}
}
$aut_link= new aut_link(AUT_TABLE_CATEG,$id);
print pmb_bidi($aut_link->get_display());
print "
\n";
//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 = mysql_query($q, $dbh);
$path=mysql_result($r, 0, 0);
$nb_pere=substr_count($path,'/');
$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"]){
$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]."' ";
}
}
// requete permettant de remonter les notices associées à la liste des catégories trouvées;
//$suite_req = " FROM noeuds inner join notices_categories on id_noeud=num_noeud inner join notices on notcateg_notice=notice_id, notice_statut
// WHERE ($liste_fils $liste_pere) and (notices.statut = notice_statut.id_notice_statut
// and ((notice_statut.notice_visible_opac = 1 and notice_statut.notice_visible_opac_abon=0)".($_SESSION["user_code"]?" or (notice_statut.notice_visible_opac_abon=1 and notice_statut.notice_visible_opac = 1)":"").")) ";
$suite_req = " FROM noeuds 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, notices, notice_statut WHERE (notices_categories.num_noeud = '".$id."' and notices_categories.notcateg_notice = notices.notice_id) and (notices.statut = notice_statut.id_notice_statut and ((notice_statut.notice_visible_opac = 1 and notice_statut.notice_visible_opac_abon=0)".($_SESSION["user_code"]?" or (notice_statut.notice_visible_opac_abon=1 and notice_statut.notice_visible_opac = 1)":"").")) ";
$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)) {
//$base_path/index.php?lvl=categ_see&id=$id&main=$main&
$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 = mysql_query($requete, $dbh);
$nbr_lignes = 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 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 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 = mysql_query($requete, $dbh);
$t_typdoc=array();
$nbexplnum_to_photo=0;
while (($tpd=mysql_fetch_object($res))) {
$t_typdoc[]=$tpd->typdoc;
if($opac_visionneuse_allow)
$nbexplnum_to_photo += $tpd->nbexplnum;
}
$l_typdoc=implode(",",$t_typdoc);
}
if (!$page) $page=1;
$debut =($page-1)*$opac_nb_aut_rec_per_page;
print pmb_bidi(str_replace("!!categ_libelle!!",$ourCateg->libelle,$categ_notices));
if ($nbr_lignes) {
if ($opac_notices_depliable) print $begin_result_liste;
//gestion du tri
if (isset($_GET["sort"])) {
$_SESSION["last_sortnotices"]=$_GET["sort"];
}
if ($nbr_lignes>$opac_nb_max_tri) {
$_SESSION["last_sortnotices"]="";
print " ";
} else {
$pos=strpos($_SERVER['REQUEST_URI'],"?");
$pos1=strpos($_SERVER['REQUEST_URI'],"get");
if ($pos1==0) $pos1=strlen($_SERVER['REQUEST_URI']);
else $pos1=$pos1-3;
$para=urlencode(substr($_SERVER['REQUEST_URI'],$pos+1,$pos1-$pos+1));
$affich_tris_result_liste=str_replace("!!page_en_cours!!",$para,$affich_tris_result_liste);
print $affich_tris_result_liste;
if ($_SESSION["last_sortnotices"]!="") {
$sort = new sort('notices','session');
print " ".$msg['tri_par']." ".$sort->descriptionTriParId($_SESSION["last_sortnotices"])." ";
}
}
//fin gestion du tri
print $add_cart_link;
if($opac_visionneuse_allow && $nbexplnum_to_photo){
print " ".$link_to_visionneuse;
$sendToVisionneuseByGet = str_replace("!!mode!!","categ_see",$sendToVisionneuseByGet);
$sendToVisionneuseByGet = str_replace("!!idautorite!!",$id,$sendToVisionneuseByGet);
print $sendToVisionneuseByGet;
}
if ($opac_show_suggest) {
$bt_sugg = "
".$msg[empr_bt_make_sugg]."";
print $bt_sugg;
}
//affinage
if ($main) {
//enregistrement de l'endroit actuel dans la session
$_SESSION["last_module_search"]["search_mod"]="categ_see";
$_SESSION["last_module_search"]["search_id"]=$id;
$_SESSION["last_module_search"]["search_page"]=$page;
//affichage
print "
".$msg["affiner_recherche"]."";
//Etendre
if ($opac_allow_external_search) print "
".$msg["connecteurs_external_search_sources"]."";
//fin etendre
} else {
//enregistrement de l'endroit actuel dans la session
if ($_SESSION["last_query"]) { $n=$_SESSION["last_query"]; } else { $n=$_SESSION["nb_queries"]; }
$_SESSION["notice_view".$n]["search_mod"]="categ_see";
$_SESSION["notice_view".$n]["search_id"]=$id;
$_SESSION["notice_view".$n]["search_page"]=$page;
//affichage
print "
".$msg["affiner_recherche"]."";
//Etendre
if ($opac_allow_external_search) print "
".$msg["connecteurs_external_search_sources"]."";
//fin etendre
}
//fin affinage
if ($auto_postage_form) print "
".$auto_postage_form."
";
print "
\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 {
$requete .= " ORDER BY $opac_categories_categ_sort_records";
$requete .= " LIMIT $debut,$opac_nb_aut_rec_per_page ";
}
//fin gestion du tri
$res = @mysql_query($requete, $dbh);
print aff_notice(-1);
$nb=0;
$recherche_ajax_mode=0;
while (($obj=mysql_fetch_object($res))) {
global $infos_notice;
if($nb++>4) $recherche_ajax_mode=1;
print 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);
}
print aff_notice(-2);
mysql_free_result($res);
// constitution des liens
$nbepages = ceil($nbr_lignes/$opac_nb_aut_rec_per_page);
print "
\n";
print "