function fetch_categories()
 {
     global $opac_thesaurus, $opac_categories_categ_in_line, $pmb_keyword_sep, $opac_categories_affichage_ordre;
     global $dbh, $opac_thesaurus_defaut;
     global $lang, $opac_categories_show_only_last;
     global $categories_memo, $libelle_thesaurus_memo;
     global $categories_top;
     $categ_repetables = array();
     if (!count($categories_top)) {
         $q = "select num_thesaurus,id_noeud from noeuds where num_parent in(select id_noeud from noeuds where autorite='TOP') ";
         $r = mysql_query($q, $dbh);
         while ($res = mysql_fetch_object($r)) {
             $categories_top[] = $res->id_noeud;
         }
     }
     $requete = "select * from (\n\t\t\tselect libelle_thesaurus, if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, if (catlg.num_noeud is null, catdef.comment_public, catlg.comment_public ) as comment_public, noeuds.id_noeud , noeuds.num_parent, langue_defaut,id_thesaurus, if(catdef.langue = '" . $lang . "',2, if(catdef.langue= thesaurus.langue_defaut ,1,0)) as p, ordre_vedette, ordre_categorie\n\t\t\tFROM ((noeuds\n\t\t\tjoin thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus\n\t\t\tleft join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = thesaurus.langue_defaut\n\t\t\tleft join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "'))\n\t\t\t,notices_categories\n\t\t\twhere ";
     if (!$opac_thesaurus && $opac_thesaurus_defaut) {
         $requete .= " thesaurus.id_thesaurus='" . $opac_thesaurus_defaut . "' AND ";
     }
     $requete .= " notices_categories.num_noeud=noeuds.id_noeud and\n\t\t\tnotices_categories.notcateg_notice=" . $this->notice_id . "\torder by id_thesaurus, noeuds.id_noeud, p desc\n\t\t\t) as list_categ group by id_noeud";
     if ($opac_categories_affichage_ordre == 1) {
         $requete .= " order by ordre_vedette, ordre_categorie";
     }
     $result_categ = @mysql_query($requete);
     if (mysql_num_rows($result_categ)) {
         while ($res_categ = mysql_fetch_object($result_categ)) {
             $libelle_thesaurus = $res_categ->libelle_thesaurus;
             $categ_id = $res_categ->id_noeud;
             $libelle_categ = $res_categ->categ_libelle;
             $comment_public = $res_categ->comment_public;
             $num_parent = $res_categ->num_parent;
             $langue_defaut = $res_categ->langue_defaut;
             $categ_head = 0;
             if (in_array($categ_id, $categories_top)) {
                 $categ_head = 1;
             }
             if ($opac_categories_show_only_last || $categ_head) {
                 if ($opac_thesaurus) {
                     $catalog_form = "[" . $libelle_thesaurus . "] " . $libelle_categ;
                 }
                 // Si il y a présence d'un commentaire affichage du layer
                 $result_com = categorie::zoom_categ($categ_id, $comment_public);
                 $libelle_aff_complet = inslink($libelle_categ, str_replace("!!id!!", $categ_id, $this->lien_rech_categ), $result_com['java_com']);
                 $libelle_aff_complet .= $result_com['zoom'];
                 if ($opac_thesaurus) {
                     $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                 } else {
                     $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                 }
             } else {
                 if (!$categories_memo[$categ_id]) {
                     $anti_recurse[$categ_id] = 1;
                     $path_table = '';
                     $requete = "\n\t\t\t\t\t\tselect id_noeud as categ_id, \n\t\t\t\t\t\tnum_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle,\n\t\t\t\t\t\tnum_renvoi_voir as categ_see, \n\t\t\t\t\t\tnote_application as categ_comment,\n\t\t\t\t\t\tif(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $num_parent . "' \n\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud \n\t\t\t\t\t\torder by p desc limit 1";
                     $result = @mysql_query($requete);
                     if (mysql_num_rows($result)) {
                         $parent = mysql_fetch_object($result);
                         $anti_recurse[$parent->categ_id] = 1;
                         $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                         // on remonte les ascendants
                         while ($parent->categ_parent && !$anti_recurse[$parent->categ_parent]) {
                             $requete = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle,\tnum_renvoi_voir as categ_see, note_application as categ_comment, if(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $parent->categ_parent . "' \n\t\t\t\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud \n\t\t\t\t\t\t\t\t\torder by p desc limit 1";
                             $result = @mysql_query($requete);
                             if (mysql_num_rows($result)) {
                                 $parent = mysql_fetch_object($result);
                                 $anti_recurse[$parent->categ_id] = 1;
                                 $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                             } else {
                                 break;
                             }
                         }
                         $anti_recurse = array();
                     } else {
                         $path_table = array();
                     }
                     // ceci remet le tableau dans l'ordre général->particulier
                     $path_table = array_reverse($path_table);
                     if (sizeof($path_table)) {
                         $temp_table = '';
                         while (list($xi, $l) = each($path_table)) {
                             $temp_table[] = $l['libelle'];
                         }
                         $parent_libelle = join(':', $temp_table);
                         $catalog_form = $parent_libelle . ':' . $libelle_categ;
                     } else {
                         $catalog_form = $libelle_categ;
                     }
                     // pour libellé complet mais sans le nom du thésaurus
                     $libelle_aff_complet = $catalog_form;
                     if ($opac_thesaurus) {
                         $catalog_form = "[" . $libelle_thesaurus . "] " . $catalog_form;
                     }
                     //$categ = new category($categ_id);
                     // Si il y a présence d'un commentaire affichage du layer
                     $result_com = categorie::zoom_categ($categ_id, $comment_public);
                     $libelle_aff_complet = inslink($libelle_aff_complet, str_replace("!!id!!", $categ_id, $this->lien_rech_categ), $result_com['java_com']);
                     $libelle_aff_complet .= $result_com['zoom'];
                     if ($opac_thesaurus) {
                         $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                     }
                     $categories_memo[$categ_id] = $libelle_aff_complet;
                     $libelle_thesaurus_memo[$categ_id] = $libelle_thesaurus;
                 } else {
                     if ($opac_thesaurus) {
                         $categ_repetables[$libelle_thesaurus_memo[$categ_id]][] = $categories_memo[$categ_id];
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $categories_memo[$categ_id];
                     }
                 }
             }
         }
     }
     while (list($nom_tesaurus, $val_lib) = each($categ_repetables)) {
         //c'est un tri par libellé qui est demandé
         if ($opac_categories_affichage_ordre == 0) {
             $tmp = array();
             foreach ($val_lib as $key => $value) {
                 $tmp[$key] = strip_tags($value);
             }
             $tmp = array_map("convert_diacrit", $tmp);
             //On enlève les accents
             $tmp = array_map("strtoupper", $tmp);
             //On met en majuscule
             asort($tmp);
             //Tri sur les valeurs en majuscule sans accent
             foreach ($tmp as $key => $value) {
                 $tmp[$key] = $val_lib[$key];
                 //On reprend les bons couples clé / libellé
             }
             $val_lib = $tmp;
         }
         if ($opac_thesaurus) {
             if (!$opac_categories_categ_in_line) {
                 $categ_repetables_aff = "[" . $nom_tesaurus . "]" . implode("<br />[" . $nom_tesaurus . "]", $val_lib);
             } else {
                 $categ_repetables_aff = "<b>" . $nom_tesaurus . "</b><br />" . implode(" {$pmb_keyword_sep} ", $val_lib);
             }
         } elseif (!$opac_categories_categ_in_line) {
             $categ_repetables_aff = implode("<br />", $val_lib);
         } else {
             $categ_repetables_aff = implode(" {$pmb_keyword_sep} ", $val_lib);
         }
         if ($categ_repetables_aff) {
             $tmpcateg_aff .= "{$categ_repetables_aff}<br />";
         }
     }
     $this->categories_toutes = $tmpcateg_aff;
 }
Exemple #2
0
     if ($mesCategories->num_parent) {
         $bar = categories::listAncestors($mesCategories->num_noeud, $lang);
         $bar = array_reverse($bar);
         if ($bar[3]) {
             print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[3]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>...</a> > ");
         }
         if ($bar[2]) {
             print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[2]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>" . $bar[2]['libelle_categorie'] . '</a> > ');
         }
         if ($bar[1]) {
             print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[1]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>" . $bar[1]['libelle_categorie'] . '</a> > ');
         }
     }
     print "<a href=./index.php?lvl=categ_see&id=" . $mesCategories->num_noeud . ">";
     // Si il y a présence d'un commentaire affichage du layer
     $result_com = categorie::zoom_categ($mesCategories_trouvees->num_noeud, $mesCategories_trouvees->note_application);
     if (category::has_notices($mesCategories_trouvees->num_noeud)) {
         print " <img src='{$base_path}/images/folder_search.gif' border=0 align='middle' />";
     } else {
         print "<img src='./images/folder.gif' border='0' align='middle'>";
     }
     print pmb_bidi("</a><a href=./index.php?lvl=categ_see&id=" . $mesCategories->num_noeud . $result_com['java_com'] . ">" . $mesCategories->libelle_categorie . '</a>' . $result_com['zoom']);
     print "</li>";
 }
 print "</ul>";
 print "\n\t</div></div>";
 if ($opac_allow_affiliate_search) {
     print $catal_navbar;
 } else {
     print "</div>";
 }
 function fetch_categories()
 {
     $this->categories = get_notice_categories($this->notice_id);
     // catégories
     $categ_repetables = array();
     $max_categ = sizeof($this->categories);
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->categories[$i]["categ_id"];
         $categ = new category($categ_id);
         $categ_repetables[$categ->path_table[0]["libelle"]][$categ_id]["libelle"] = $categ->libelle;
         $categ_repetables[$categ->path_table[0]["libelle"]][$categ_id]["commentaire_public"] = $categ->commentaire_public;
     }
     $categ_final_table = array();
     while (list($key, $val) = each($categ_repetables)) {
         $categ_final_table[$key] = $key;
         asort($val);
         reset($val);
         $categ_r = array();
         while (list($categ_id, $libelle) = each($val)) {
             // Si il y a présence d'un commentaire affichage du layer
             $result_com = categorie::zoom_categ($categ_id, $libelle["commentaire_public"]);
             $categ_r[$categ_id] = inslink($libelle["libelle"], str_replace("!!id!!", $categ_id, $this->lien_rech_categ), $result_com['java_com']) . $result_com['zoom'];
         }
         $categ_final_table[$key] .= "<br />&nbsp;" . implode(", ", $categ_r);
     }
     $this->categories_toutes = implode("<br />", $categ_final_table);
 }
Exemple #4
0
 function child_list($image = './images/folder.gif', $css)
 {
     global $css;
     global $dbh;
     global $opac_categories_nb_col_subcat, $opac_categories_sub_mode;
     global $main;
     global $lang;
     global $charset;
     global $base_path;
     $current_col = 0;
     // récupération des enfants
     if ($this->id == $this->thes->num_noeud_racine) {
         $result = categories::listChilds($this->id, $lang, 0, $opac_categories_sub_mode);
     } else {
         $result = categories::listChilds($this->id, $lang, 1, $opac_categories_sub_mode);
     }
     if (mysql_num_rows($result) < $opac_categories_nb_col_subcat) {
         // nombre de sous-catégories réduit
         while ($child = mysql_fetch_object($result)) {
             $libelle = $child->libelle_categorie;
             $note = $child->comment_public;
             $id = $child->num_noeud;
             //$c2_categ = new category($id);
             if ($child->num_renvoi_voir) {
                 $libelle = "<i>{$libelle}</i>@";
                 $id = $child->num_renvoi_voir;
             }
             // Si il y a présence d'un commentaire affichage du layer
             $result_com = $this->zoom_categ($id, $note);
             $l .= "<a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small'>";
             if (category::has_notices($id)) {
                 $l .= " <img src='{$base_path}/images/folder_search.gif' border=0 align='absmiddle' />";
             } else {
                 $l .= "<img src='{$image}' border='0' align='top' />";
             }
             $l .= "<a/>" . $result_com['zoom'];
             $l .= "<a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small' " . $result_com['java_com'] . ">" . $libelle . "</a><br />";
         }
         $l = "<br /><div style='margin-left:48px'>{$l}</div>";
     } else {
         $l = "<table border='0' style='margin-left:48px' cellpadding='3'>";
         while ($child = mysql_fetch_object($result)) {
             $libelle = $child->libelle_categorie;
             $note = $child->comment_public;
             $id = $child->num_noeud;
             //$c_categ =  new category($id);
             if ($child->num_renvoi_voir) {
                 $libelle = "<i>{$libelle}</i>@";
                 $id = $child->num_renvoi_voir;
             }
             // Si il y a présence d'un commentaire affichage du layer
             $result_com = categorie::zoom_categ($id, $note);
             if ($current_col == 0) {
                 $l .= "\n<tr>";
             }
             $l .= "<td align='top'><a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small'>";
             if (category::has_notices($id)) {
                 $l .= " <img src='{$base_path}/images/folder_search.gif' border=0 align='absmiddle' />";
             } else {
                 $l .= "<img src='{$image}' border='0' align='top' />";
             }
             $l .= "</a>" . $result_com['zoom'];
             $l .= "<a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small' " . $result_com['java_com'] . ">" . $libelle . "</a></td>";
             if ($current_col == $opac_categories_nb_col_subcat - 1) {
                 $l .= '</tr>';
                 $current_col = 0;
             } else {
                 $current_col++;
             }
         }
         $l .= '</table>';
     }
     return $l;
 }
        $requete .= "noeuds.num_parent = '" . $level0->num_noeud . "' ";
        $requete .= "and if (catlg.num_noeud is null, catdef.libelle_categorie not like '~%', catlg.libelle_categorie not like '~%') ";
    }
    $requete .= "order by " . $opac_categories_sub_mode . " limit " . $opac_categories_sub_display;
    $result_bis = pmb_mysql_query($requete, $dbh);
    $child = array();
    while ($sub_categ = pmb_mysql_fetch_object($result_bis)) {
        if (!$sub_categ->num_renvoi_voir) {
            $id = $sub_categ->num_noeud;
            $link = $sub_categ->libelle_categorie;
        } else {
            $id = $sub_categ->num_renvoi_voir;
            $link = '<i>' . $sub_categ->libelle_categorie . '@</i>';
        }
        // Si il y a présence d'un commentaire affichage du layer
        $result_com = categorie::zoom_categ($id, $sub_categ->comment_public);
        $child[] = "<a href='./index.php?lvl=categ_see&id={$id}&main=1&id_thes=" . $sub_categ->num_thesaurus . "'" . $result_com['java_com'] . ">" . $link . "</a>" . $result_com['zoom'];
    }
    $categ_array[] = array(categ => $categ, child => $child);
}
//affichage des liens vers les autres thésaurus
$liste_thesaurus = thesaurus::getThesaurusList($opac_show_categ_browser_home_id_thes);
if ($opac_show_categ_browser_home_id_thes_tab) {
    $liste_thesaurus_tmp = array();
    foreach ($opac_show_categ_browser_home_id_thes_tab as $value) {
        if ($liste_thesaurus[$value]) {
            $liste_thesaurus_tmp[$value] = $liste_thesaurus[$value];
            unset($liste_thesaurus[$value]);
        }
    }
    foreach ($liste_thesaurus as $key => $value) {
 $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 {
Exemple #7
0
 $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);
 $see_also = "";
 if (mysql_num_rows($found_see_too)) {
     $deb = 0;
     while ($mesCategories_see_too = mysql_fetch_object($found_see_too)) {
         $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);
         $see_also .= "<li><a href=./index.php?lvl=categ_see&id=" . $mesCategories_see_too->num_noeud . ">";
         if (category::has_notices($mesCategories_see_too->num_noeud)) {
             $see_also .= " <img src='{$base_path}/images/folder_search.gif' border=0 align='absmiddle'>";
         } else {
             $see_also .= " <img src='./images/folder.gif' border='0' align='middle'>";
         }
         $see_also .= pmb_bidi("</a><a href=./index.php?lvl=categ_see&id=" . $mesCategories_see_too->num_noeud . "" . $result_com['java_com'] . ">" . $mesCategories_see_too->libelle_categorie . '</a>' . $result_com['zoom']);
         $see_also .= "</li>";
     }
 }
 if ($see_also) {
     print "\n\t\t<div id='categ_see_also' class='categ_see_also'>\n\n\t\t<h5><span>" . $msg["term_show_see_also"] . "</span></h5>\n\t\t<ul>" . $see_also . "\n\t\t</ul>\n\t\t</div>";
 }
 $aut_link = new aut_link(AUT_TABLE_CATEG, $id);
 $see_aut_link = $aut_link->get_display();