Beispiel #1
0
 static function majNoticesGlobalIndex($notice, $NoIndex = 1)
 {
     global $dbh;
     pmb_mysql_query("delete from notices_global_index where num_notice = " . $notice . " AND no_index = " . $NoIndex, $dbh);
     $titres = pmb_mysql_query("select index_serie, tnvol, index_wew, index_sew, index_l, index_matieres, n_gen, n_contenu, n_resume, index_n_gen, index_n_contenu, index_n_resume, eformat, niveau_biblio from notices where notice_id = " . $notice, $dbh);
     $mesNotices = pmb_mysql_fetch_assoc($titres);
     $tit = $mesNotices['index_wew'];
     $indTit = $mesNotices['index_sew'];
     $indMat = $mesNotices['index_matieres'];
     $indL = $mesNotices['index_l'];
     $indResume = $mesNotices['index_n_resume'];
     $indGen = $mesNotices['index_n_gen'];
     $indContenu = $mesNotices['index_n_contenu'];
     $resume = $mesNotices['n_resume'];
     $gen = $mesNotices['n_gen'];
     $contenu = $mesNotices['n_contenu'];
     $indSerie = $mesNotices['index_serie'];
     $tvol = $mesNotices['tnvol'];
     $eformatlien = $mesNotices['eformat'];
     $infos_global = ' ' . $tvol . ' ' . $tit . ' ' . $resume . ' ' . $gen . ' ' . $contenu . ' ' . $indL . ' ';
     $infos_global_index = ' ' . $indSerie . ' ' . $indTit . ' ' . $indResume . ' ' . $indGen . ' ' . $indContenu . ' ' . $indMat . ' ';
     // Authors :
     $auteurs = pmb_mysql_query("select author_id, author_type, author_name, author_rejete, author_date, author_lieu,author_ville,author_pays,author_numero,author_subdivision, index_author from authors, responsability WHERE responsability_author = author_id AND responsability_notice = {$notice}", $dbh);
     $numA = pmb_mysql_num_rows($auteurs);
     $aut_pperso = new aut_pperso("author");
     for ($j = 0; $j < $numA; $j++) {
         $mesAuteurs = pmb_mysql_fetch_assoc($auteurs);
         $infos_global .= $mesAuteurs['author_name'] . ' ' . $mesAuteurs['author_rejete'] . ' ' . $mesAuteurs['author_lieu'] . ' ' . $mesAuteurs['author_ville'] . ' ' . $mesAuteurs['author_pays'] . ' ' . $mesAuteurs['author_numero'] . ' ' . $mesAuteurs['author_subdivision'] . ' ';
         if ($mesAuteurs['author_type'] == "72") {
             $infos_global .= ' ' . $mesAuteurs['author_date'] . ' ';
         }
         $infos_global_index .= strip_empty_chars($mesAuteurs['author_name'] . ' ' . $mesAuteurs['author_rejete'] . ' ' . $mesAuteurs['author_lieu'] . ' ' . $mesAuteurs['author_ville'] . ' ' . $mesAuteurs['author_pays'] . ' ' . $mesAuteurs['author_numero'] . ' ' . $mesAuteurs['author_subdivision']) . ' ';
         if ($mesAuteurs['author_type'] == "72") {
             $infos_global_index .= strip_empty_chars($mesAuteurs['author_date'] . " ");
         }
         $mots_perso = $aut_pperso->get_fields_recherche($mesAuteurs['author_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     pmb_mysql_free_result($auteurs);
     // Nom du periodique
     //cas d'un article
     if ($mesNotices['niveau_biblio'] == 'a') {
         $temp = pmb_mysql_query("select bulletin_notice, bulletin_titre, index_titre, index_wew, index_sew from analysis, bulletins, notices  WHERE analysis_notice=" . $notice . " and analysis_bulletin = bulletin_id and bulletin_notice=notice_id", $dbh);
         $numP = pmb_mysql_num_rows($temp);
         if ($numP) {
             // La notice appartient a un periodique, on selectionne le titre de periodique :
             $mesTemp = pmb_mysql_fetch_assoc($temp);
             $infos_global .= $mesTemp['index_wew'] . ' ' . $mesTemp['bulletin_titre'] . ' ' . $mesTemp['index_titre'] . ' ';
             $infos_global_index .= strip_empty_words($mesTemp['index_wew'] . ' ' . $mesTemp['bulletin_titre'] . ' ' . $mesTemp['index_titre']) . ' ';
         }
         pmb_mysql_free_result($temp);
         //cas d'un bulletin
     } else {
         if ($mesNotices['niveau_biblio'] == 'b') {
             $temp = pmb_mysql_query("select serial.index_wew from notices join bulletins on bulletins.num_notice = notices.notice_id join notices as serial on serial.notice_id = bulletins.bulletin_notice where notices.notice_id = " . $notice);
             $numP = pmb_mysql_num_rows($temp);
             if ($numP) {
                 // La notice appartient a un periodique, on selectionne le titre de periodique :
                 $mesTemp = pmb_mysql_fetch_assoc($temp);
                 $infos_global .= $mesTemp['index_wew'] . ' ';
                 $infos_global_index .= strip_empty_words($mesTemp['index_wew']);
             }
             pmb_mysql_free_result($temp);
         }
     }
     // Categories :
     $aut_pperso = new aut_pperso("categ");
     $noeud = pmb_mysql_query("select notices_categories.num_noeud as categ_id, libelle_categorie from notices_categories,categories where notcateg_notice = " . $notice . " and notices_categories.num_noeud=categories.num_noeud order by ordre_categorie", $dbh);
     $numNoeuds = pmb_mysql_num_rows($noeud);
     // Pour chaque noeud trouve on cherche les noeuds parents et les noeuds fils :
     for ($j = 0; $j < $numNoeuds; $j++) {
         // On met a jour la table notices_global_index avec le noeud trouve:
         $mesNoeuds = pmb_mysql_fetch_assoc($noeud);
         $infos_global .= $mesNoeuds['libelle_categorie'] . ' ';
         $infos_global_index .= strip_empty_words($mesNoeuds['libelle_categorie']) . ' ';
         $mots_perso = $aut_pperso->get_fields_recherche($mesNoeuds['categ_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     // Sous-collection :
     $aut_pperso = new aut_pperso("subcollection");
     $subColls = pmb_mysql_query("select subcoll_id, sub_coll_name, index_sub_coll from notices, sub_collections WHERE subcoll_id = sub_coll_id AND notice_id = " . $notice, $dbh);
     $numSC = pmb_mysql_num_rows($subColls);
     for ($j = 0; $j < $numSC; $j++) {
         $mesSubColl = pmb_mysql_fetch_assoc($subColls);
         $infos_global .= $mesSubColl['index_sub_coll'] . ' ' . $mesSubColl['sub_coll_name'] . ' ';
         $infos_global_index .= strip_empty_words($mesSubColl['index_sub_coll'] . ' ' . $mesSubColl['sub_coll_name']) . ' ';
         $mots_perso = $aut_pperso->get_fields_recherche($mesSubColl['subcoll_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     pmb_mysql_free_result($subColls);
     // Indexation numerique :
     $aut_pperso = new aut_pperso("indexint");
     $indexNums = pmb_mysql_query("select indexint_id, indexint_name, indexint_comment from notices, indexint WHERE indexint = indexint_id AND notice_id = " . $notice, $dbh);
     $numIN = pmb_mysql_num_rows($indexNums);
     for ($j = 0; $j < $numIN; $j++) {
         $mesindexNums = pmb_mysql_fetch_assoc($indexNums);
         $infos_global .= $mesindexNums['indexint_name'] . ' ' . $mesindexNums['indexint_comment'] . ' ';
         $infos_global_index .= strip_empty_words($mesindexNums['indexint_name'] . ' ' . $mesindexNums['indexint_comment']) . ' ';
         $mots_perso = $aut_pperso->get_fields_recherche($mesindexNums['indexint_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     pmb_mysql_free_result($indexNums);
     // Collection :
     $aut_pperso = new aut_pperso("collection");
     $Colls = pmb_mysql_query("select coll_id, collection_name ,collection_issn from notices, collections WHERE coll_id = collection_id AND notice_id = " . $notice, $dbh);
     $numCo = pmb_mysql_num_rows($Colls);
     for ($j = 0; $j < $numCo; $j++) {
         $mesColl = pmb_mysql_fetch_assoc($Colls);
         $infos_global .= $mesColl['collection_name'] . ' ' . $mesColl['collection_issn'] . ' ';
         $infos_global_index .= strip_empty_words($mesColl['collection_name']) . ' ' . strip_empty_words($mesColl['collection_issn']) . ' ';
         $mots_perso = $aut_pperso->get_fields_recherche($mesColl['coll_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     pmb_mysql_free_result($Colls);
     // Editeurs :
     $aut_pperso = new aut_pperso("publisher");
     $editeurs = pmb_mysql_query("select ed_id, ed_name from notices, publishers WHERE (ed1_id = ed_id OR ed2_id = ed_id) AND notice_id = " . $notice, $dbh);
     $numE = pmb_mysql_num_rows($editeurs);
     for ($j = 0; $j < $numE; $j++) {
         $mesEditeurs = pmb_mysql_fetch_assoc($editeurs);
         $infos_global .= $mesEditeurs['ed_name'] . ' ';
         $infos_global_index .= strip_empty_chars($mesEditeurs['ed_name']) . ' ';
         $mots_perso = $aut_pperso->get_fields_recherche($mesEditeurs['ed_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     pmb_mysql_free_result($editeurs);
     pmb_mysql_free_result($titres);
     // Titres Uniformes :
     $aut_pperso = new aut_pperso("tu");
     $tu = pmb_mysql_query("select tu_id, ntu_titre, tu_name, tu_tonalite, tu_sujet, tu_lieu, tu_contexte from notices_titres_uniformes,titres_uniformes WHERE tu_id=ntu_num_tu and ntu_num_notice=" . $notice, $dbh);
     if (pmb_mysql_error() == "" && pmb_mysql_num_rows($tu)) {
         $numtu = pmb_mysql_num_rows($tu);
         for ($j = 0; $j < $numtu; $j++) {
             $mesTu = pmb_mysql_fetch_assoc($tu);
             $infos_global .= $mesTu['ntu_titre'] . ' ' . $mesTu['tu_name'] . ' ' . $mesTu['tu_tonalite'] . ' ' . $mesTu['tu_sujet'] . ' ' . $mesTu['tu_lieu'] . ' ' . $mesTu['tu_contexte'] . ' ';
             $infos_global_index .= strip_empty_words($mesTu['ntu_titre'] . ' ' . $mesTu['tu_name'] . ' ' . $mesTu['tu_tonalite'] . ' ' . $mesTu['tu_sujet'] . ' ' . $mesTu['tu_lieu'] . ' ' . $mesTu['tu_contexte']) . ' ';
             $mots_perso = $aut_pperso->get_fields_recherche($mesTu['tu_id']);
             if ($mots_perso) {
                 $infos_global .= $mots_perso . ' ';
                 $infos_global_index .= strip_empty_words($mots_perso) . ' ';
             }
         }
         pmb_mysql_free_result($tu);
     }
     // indexer les cotes des etat des collections :
     $p_perso = new parametres_perso("collstate");
     $coll = pmb_mysql_query("select collstate_id, collstate_cote from collections_state WHERE id_serial=" . $notice, $dbh);
     $numcoll = pmb_mysql_num_rows($coll);
     for ($j = 0; $j < $numcoll; $j++) {
         $mescoll = pmb_mysql_fetch_assoc($coll);
         $infos_global .= $mescoll['collstate_cote'] . ' ';
         $infos_global_index .= strip_empty_words($mescoll['collstate_cote']) . ' ';
         // champ perso cherchable
         $mots_perso = $p_perso->get_fields_recherche($mescoll['collstate_id']);
         if ($mots_perso) {
             $infos_global .= $mots_perso . ' ';
             $infos_global_index .= strip_empty_words($mots_perso) . ' ';
         }
     }
     pmb_mysql_free_result($coll);
     // Nomenclature
     global $pmb_nomenclature_activate;
     if ($pmb_nomenclature_activate) {
         $mots = nomenclature_record_ui::get_index($notice);
         $infos_global .= $mots . ' ';
         $infos_global_index .= strip_empty_words($mots) . ' ';
     }
     // champ perso cherchable
     $p_perso = new parametres_perso("notices");
     $mots_perso = $p_perso->get_fields_recherche($notice);
     if ($mots_perso) {
         $infos_global .= $mots_perso . ' ';
         $infos_global_index .= strip_empty_words($mots_perso) . ' ';
     }
     // champs des authperso
     $auth_perso = new authperso_notice($notice);
     $mots_authperso = $auth_perso->get_fields_search();
     if ($mots_authperso) {
         $infos_global .= $mots_authperso . ' ';
         $infos_global_index .= strip_empty_words($mots_authperso) . ' ';
     }
     // flux RSS éventuellement
     $eformat = array();
     $eformat = explode(' ', $eformatlien);
     if ($eformat[0] == 'RSS' && $eformat[3] == '1') {
         $flux = strip_tags(affiche_rss($notice));
         $infos_global_index .= strip_empty_words($flux) . ' ';
     }
     pmb_mysql_query("insert into notices_global_index SET num_notice=" . $notice . ",no_index =" . $NoIndex . ", infos_global='" . addslashes($infos_global) . "', index_infos_global='" . addslashes($infos_global_index) . "'", $dbh);
 }