function do_isbd() { global $dbh, $base_path; global $langue_doc; global $msg; global $tdoc; global $fonction_auteur; global $charset; global $thesaurus_mode_pmb, $thesaurus_categories_categ_in_line, $pmb_keyword_sep, $thesaurus_categories_affichage_ordre; global $load_tablist_js; global $lang; global $categories_memo, $libelle_thesaurus_memo; global $categories_top, $use_opac_url_base, $opac_url_base, $thesaurus_categories_show_only_last; global $categ; global $id_empr; global $pmb_show_notice_id, $pmb_opac_url, $pmb_show_permalink; global $sort_children; global $pmb_resa_planning; global $thesaurus_concepts_active; global $pmb_map_activate; global $pmb_nomenclature_activate; // constitution de la mention de titre if ($this->tit_serie) { if ($this->print_mode) { $this->isbd = $this->tit_serie; } else { $this->isbd = $this->tit_serie_lien_gestion; } if ($this->notice->tnvol) { $this->isbd .= ', ' . $this->notice->tnvol; } } $this->isbd ? $this->isbd .= '. ' . $this->notice->tit1 : ($this->isbd = $this->notice->tit1); $tit2 = $this->notice->tit2; $tit3 = $this->notice->tit3; $tit4 = $this->notice->tit4; if ($tit3) { $this->isbd .= " = {$tit3}"; } if ($tit4) { $this->isbd .= " : {$tit4}"; } if ($tit2) { $this->isbd .= " ; {$tit2}"; } $this->isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']'; $mention_resp = array(); // constitution de la mention de responsabilité //$this->responsabilites $as = array_search("0", $this->responsabilites["responsabilites"]); if ($as !== FALSE && $as !== NULL) { $auteur_0 = $this->responsabilites["auteurs"][$as]; $auteur = new auteur($auteur_0["id"]); if ($this->print_mode) { $mention_resp_lib = $auteur->isbd_entry; } else { $mention_resp_lib = $auteur->isbd_entry_lien_gestion; } if (!$this->print_mode) { $mention_resp_lib .= $auteur->author_web_link; } if ($auteur_0["fonction"]) { $mention_resp_lib .= ", " . $fonction_auteur[$auteur_0["fonction"]]; } $mention_resp[] = $mention_resp_lib; } $as = array_keys($this->responsabilites["responsabilites"], "1"); for ($i = 0; $i < count($as); $i++) { $indice = $as[$i]; $auteur_1 = $this->responsabilites["auteurs"][$indice]; $auteur = new auteur($auteur_1["id"]); if ($this->print_mode) { $mention_resp_lib = $auteur->isbd_entry; } else { $mention_resp_lib = $auteur->isbd_entry_lien_gestion; } if (!$this->print_mode) { $mention_resp_lib .= $auteur->author_web_link; } if ($auteur_1["fonction"]) { $mention_resp_lib .= ", " . $fonction_auteur[$auteur_1["fonction"]]; } $mention_resp[] = $mention_resp_lib; } $as = array_keys($this->responsabilites["responsabilites"], "2"); for ($i = 0; $i < count($as); $i++) { $indice = $as[$i]; $auteur_2 = $this->responsabilites["auteurs"][$indice]; $auteur = new auteur($auteur_2["id"]); if ($this->print_mode) { $mention_resp_lib = $auteur->isbd_entry; } else { $mention_resp_lib = $auteur->isbd_entry_lien_gestion; } if (!$this->print_mode) { $mention_resp_lib .= $auteur->author_web_link; } if ($auteur_2["fonction"]) { $mention_resp_lib .= ", " . $fonction_auteur[$auteur_2["fonction"]]; } $mention_resp[] = $mention_resp_lib; } $libelle_mention_resp = implode("; ", $mention_resp); if ($libelle_mention_resp) { $this->isbd .= " / {$libelle_mention_resp}"; } // mention d'édition if ($this->notice->mention_edition) { $this->isbd .= ". - " . $this->notice->mention_edition; } if ($pmb_map_activate) { if ($mapisbd = $this->map_info->get_isbd()) { $this->isbd .= $mapisbd; } } // zone de l'adresse // on récupère la collection au passage, si besoin est if ($this->notice->subcoll_id) { $collection = new subcollection($this->notice->subcoll_id); $ed_obj = new editeur($collection->editeur); if ($this->print_mode) { $editeurs .= $ed_obj->isbd_entry; $collections = $collection->isbd_entry; } else { $editeurs .= $ed_obj->isbd_entry_lien_gestion; $collections = $collection->isbd_entry_lien_gestion; } } elseif ($this->notice->coll_id) { $collection = new collection($this->notice->coll_id); $ed_obj = new editeur($collection->parent); if ($this->print_mode) { $editeurs .= $ed_obj->isbd_entry; $collections = $collection->isbd_entry; } else { $editeurs .= $ed_obj->isbd_entry_lien_gestion; $collections = $collection->isbd_entry_lien_gestion; } } elseif ($this->notice->ed1_id) { $editeur = new editeur($this->notice->ed1_id); if ($this->print_mode) { $editeurs .= $editeur->isbd_entry; } else { $editeurs .= $editeur->isbd_entry_lien_gestion; } } if ($this->notice->ed2_id) { $editeur = new editeur($this->notice->ed2_id); if ($this->print_mode) { $ed_isbd = $editeur->isbd_entry; } else { $ed_isbd = $editeur->isbd_entry_lien_gestion; } $editeurs ? $editeurs .= ' ; ' . $ed_isbd : ($editeurs = $ed_isbd); } if ($this->notice->year) { $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year); } elseif ($this->notice->niveau_biblio != 'b') { $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]"); } if ($editeurs) { $this->isbd .= ". - {$editeurs}"; } // zone de la collation (ne concerne que a2) if ($this->notice->npages) { $collation = $this->notice->npages; } if ($this->notice->ill) { $collation .= ': ' . $this->notice->ill; } if ($this->notice->size) { $collation .= '; ' . $this->notice->size; } if ($this->notice->accomp) { $collation .= '+ ' . $this->notice->accomp; } if ($collation) { $this->isbd .= ". - {$collation}"; } if ($collections) { if ($this->notice->nocoll) { $collections .= '; ' . $this->notice->nocoll; } $this->isbd .= ". - ({$collections})" . ' '; } if (substr(trim($this->isbd), -1) != ".") { $this->isbd .= '.'; } // note générale if ($this->notice->n_gen) { $zoneNote = nl2br(htmlentities($this->notice->n_gen, ENT_QUOTES, $charset)) . ' '; } // ISBN ou NO. commercial if ($this->notice->code) { if (isISBN($this->notice->code)) { if ($zoneNote) { $zoneNote .= '. - ISBN '; } else { $zoneNote = 'ISBN '; } } else { if ($zoneNote) { $zoneNote .= '. - '; } } $zoneNote .= $this->notice->code; } if ($this->notice->prix) { if ($this->notice->code) { $zoneNote .= ' : ' . $this->notice->prix; } else { if ($zoneNote) { $zoneNote .= ' ' . $this->notice->prix; } else { $zoneNote = $this->notice->prix; } } } if ($zoneNote) { $this->isbd .= "<br /><br />{$zoneNote}."; } //In //Recherche des notices parentes if (!$this->no_link) { $requete = "select linked_notice, relation_type, rank, l.niveau_biblio as lnb, l.niveau_hierar as lnh from notices_relations, notices as l where num_notice=" . $this->notice_id . " and linked_notice=l.notice_id order by relation_type,rank"; $result_linked = pmb_mysql_query($requete) or die(pmb_mysql_error()); //Si il y en a, on prépare l'affichage if (pmb_mysql_num_rows($result_linked)) { global $relation_listup; if (!$relation_listup) { $relation_listup = new marc_list("relationtypeup"); } } $r_type = array(); $ul_opened = false; $r_type_local = ""; //Pour toutes les notices liées while ($r_rel = pmb_mysql_fetch_object($result_linked)) { //Pour avoir le lien par défaut if (!$this->print_mode && SESSrights & CATALOGAGE_AUTH) { $link_parent = $base_path . '/catalog.php?categ=isbd&id=!!id!!'; } else { $link_parent = ""; } if ($r_rel->lnb == 's' && $r_rel->lnh == '1') { // c'est une notice chapeau global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial; $link_serial_sub = $base_path . "/catalog.php?categ=serials&sub=view&serial_id=" . $r_rel->linked_notice; // function serial_display ($id, $level='1', $action_serial='', $action_analysis='', $action_bulletin='', $lien_suppr_cart="", $lien_explnum="", $bouton_explnum=1,$print=0,$show_explnum=1, $show_statut=0, $show_opac_hidden_fields=true, $draggable=0 ) { $serial = new serial_display($r_rel->linked_notice, 0, $link_serial_sub, $link_analysis, $link_bulletin, "", "", 0, $this->print_mode, $this->show_explnum, $this->show_statut, $this->show_opac_hidden_fields, 1, true); $aff = $serial->header; } else { if ($r_rel->lnb == 'a' && $r_rel->lnh == '2') { // c'est un dépouillement de bulletin global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial; if (!$link_analysis) { $link_analysis = $base_path . "/catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=!!bul_id!!&art_to_show=!!id!!"; } $serial = new serial_display($r_rel->linked_notice, 0, $link_serial, $link_analysis, $link_bulletin, "", "", 0, $this->print_mode, $this->show_explnum, $this->show_statut, $this->show_opac_hidden_fields, 1, true); $aff = $serial->result; } else { if ($link_parent && $r_rel->lnb == 'b' && $r_rel->lnh == '2') { $requete = "SELECT bulletin_id FROM bulletins WHERE num_notice='" . $r_rel->linked_notice . "'"; $res = pmb_mysql_query($requete); if (pmb_mysql_num_rows($res)) { $link_parent = $base_path . "/catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . pmb_mysql_result($res, 0, 0); } } // dans les autres cas $parent_notice = new mono_display($r_rel->linked_notice, 0, $link_parent, 1, '', "", '', 0, $this->print_mode, $this->show_explnum, $this->show_statut, '', 1, true, $this->show_opac_hidden_fields, 0); $aff = $parent_notice->header; $this->nb_expl += $parent_notice->nb_expl; } } //$parent_notice=new mono_display($r_rel->linked_notice,0,$link_parent); //Présentation différente si il y en a un ou plusieurs if (pmb_mysql_num_rows($result_linked) == 1) { $this->isbd .= "<br /><b>" . $relation_listup->table[$r_rel->relation_type] . "</b> " . $aff . "<br />"; } else { if ($r_rel->relation_type != $r_type_local) { $r_type_local = $r_rel->relation_type; if ($ul_opened) { $this->isbd .= "</ul>"; $this->isbd .= "\n<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>"; $this->isbd .= "\n<ul class='notice_rel'>\n"; $ul_opened = true; } else { $this->isbd .= "\n<br />"; $this->isbd .= "\n<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>"; $this->isbd .= "\n<ul class='notice_rel'>\n"; $ul_opened = true; } } $this->isbd .= "\n<li>" . $aff . "</li>\n"; } } if ($ul_opened) { $this->isbd .= "\n</ul>\n"; } } if ($pmb_show_notice_id || $pmb_show_permalink) { $this->isbd .= "<br />"; } if ($pmb_show_notice_id) { $prefixe = explode(",", $pmb_show_notice_id); $this->isbd .= "<b>" . $msg['notice_id_libelle'] . " </b>" . ($prefixe[1] ? $prefixe[1] : '') . $this->notice_id . "<br />"; } // Permalink OPAC if ($pmb_show_permalink) { $this->isbd .= "<b>" . $msg["notice_permalink_opac"] . " </b><a href='" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "' target=\"__LINK__\">" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "</a><br />"; } // niveau 1 if ($this->level == 1) { if (!$this->print_mode) { $this->isbd .= "<!-- !!bouton_modif!! -->"; } if ($this->expl) { $this->isbd .= "<br /><b>{$msg[285]}</b> (" . $this->nb_expl . ")"; $this->isbd .= $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl); } if ($this->show_explnum) { $explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum); if ($explnum_assoc) { $this->isbd .= "<b>{$msg['explnum_docs_associes']}</b>" . $explnum_assoc; } } if ($this->show_resa) { $aff_resa = resa_list($this->notice_id, 0, 0); if ($aff_resa) { $this->isbd .= "<b>{$msg['resas']}</b>" . $aff_resa; } } if ($this->show_planning && $pmb_resa_planning) { $aff_resa_planning = planning_list($this->notice_id, 0, 0); if ($aff_resa_planning) { $this->isbd .= "<b>{$msg['resas_planning']}</b>" . $aff_resa_planning; } } $this->simple_isbd = $this->isbd; $this->do_image($this->isbd); return; } // map if ($pmb_map_activate && $this->show_map) { $this->isbd .= $this->map->get_map(); } if ($pmb_nomenclature_activate) { $nomenclature = new nomenclature_record_ui($this->notice_id); $this->isbd .= $nomenclature->get_isbd(); } // résumé if ($this->notice->n_resume) { // $this->isbd .= "<br /><b>${msg[267]}</b> : ".nl2br(htmlentities($this->notice->n_resume,ENT_QUOTES, $charset)); $this->isbd .= "<br /><b>{$msg[267]}</b> : " . nl2br($this->notice->n_resume); } // note de contenu if ($this->notice->n_contenu) { // $this->isbd .= "<br /><b>${msg[266]}</b> : ".nl2br(htmlentities($this->notice->n_contenu,ENT_QUOTES, $charset)); $this->isbd .= "<br /><b>{$msg[266]}</b> : " . nl2br($this->notice->n_contenu); } // catégories $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 = pmb_mysql_query($q, $dbh); while ($res = pmb_mysql_fetch_object($r)) { $categories_top[] = $res->id_noeud; } } $requete = "select * from (\n\t\tselect libelle_thesaurus, if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, 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\tFROM ((noeuds\n\t\tjoin thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus\n\t\tleft join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = thesaurus.langue_defaut\n\t\tleft join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "'))\n\t\t,notices_categories\n\t\twhere notices_categories.num_noeud=noeuds.id_noeud and\n\t\tnotices_categories.notcateg_notice=" . $this->notice_id . "\torder by id_thesaurus, noeuds.id_noeud, p desc\n\t\t) as list_categ group by id_noeud"; if ($thesaurus_categories_affichage_ordre == 1) { $requete .= " order by ordre_vedette, ordre_categorie"; } $result_categ = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($result_categ)) { while ($res_categ = pmb_mysql_fetch_object($result_categ)) { $libelle_thesaurus = $res_categ->libelle_thesaurus; $categ_id = $res_categ->id_noeud; $libelle_categ = $res_categ->categ_libelle; $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 ($thesaurus_categories_show_only_last || $categ_head) { if ($use_opac_url_base) { $url_base_lien_aut = $opac_url_base . "index.php?&lvl=categ_see&id="; } else { $url_base_lien_aut = $base_path . "/autorites.php?categ=categories&sub=categ_form&id="; } if ((SESSrights & AUTORITES_AUTH || $use_opac_url_base) && !$this->print_mode) { $libelle_aff_complet = "<a href='" . $url_base_lien_aut . $categ_id . "' class='lien_gestion'>" . $libelle_categ . "</a>"; } else { $libelle_aff_complet = $libelle_categ; } if ($thesaurus_mode_pmb) { $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 = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle, num_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\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 = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($result)) { $parent = pmb_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\tFROM noeuds, categories where id_noeud ='" . $parent->categ_parent . "'\n\t\t\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud\n\t\t\t\t\t\t\t\torder by p desc limit 1"; $result = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($result)) { $parent = pmb_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; } if ($use_opac_url_base) { $url_base_lien_aut = $opac_url_base . "index.php?&lvl=categ_see&id="; } else { $url_base_lien_aut = $base_path . "/autorites.php?categ=categories&sub=categ_form&id="; } if ((SESSrights & AUTORITES_AUTH || $use_opac_url_base) && !$this->print_mode) { $libelle_aff_complet = "<a href='" . $url_base_lien_aut . $categ_id . "' class='lien_gestion'>" . $catalog_form . "</a>"; } else { $libelle_aff_complet = $catalog_form; } if ($thesaurus_mode_pmb) { $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 ($thesaurus_mode_pmb) { $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 ($thesaurus_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 ($thesaurus_mode_pmb) { if (!$thesaurus_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); } } else { if (!$thesaurus_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 .= "<br />{$categ_repetables_aff}"; } } if ($tmpcateg_aff) { $this->isbd .= "<br />{$tmpcateg_aff}"; } // Concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->notice_id, TYPE_NOTICE); $this->isbd .= $index_concept->get_isbd_display(); } // langues if (count($this->langues)) { $langues = "<b>{$msg[537]}</b> : " . construit_liste_langues($this->langues); } if (count($this->languesorg)) { $langues .= " <b>{$msg[711]}</b> : " . construit_liste_langues($this->languesorg); } if ($langues) { $this->isbd .= "<br />{$langues}"; } // indexation libre if ($this->notice->index_l) { $this->isbd .= "<br /><b>{$msg[324]}</b> : " . nl2br($this->notice->index_l); } // indexation interne if ($this->notice->indexint) { $indexint = new indexint($this->notice->indexint); if ($this->print_mode) { $indexint_isbd = $indexint->display; } else { $indexint_isbd = $indexint->isbd_entry_lien_gestion; } $this->isbd .= "<br /><b>{$msg[indexint_catal_title]}</b> : " . $indexint_isbd; } $tu = new tu_notice($this->notice_id); if ($tu_liste = $tu->get_print_type(1)) { $this->isbd .= "<br />" . $tu_liste; } $authperso = new authperso_notice($this->notice_id); $this->isbd .= $authperso->get_notice_display(); //Champs personalisés $perso_aff = ""; if (!$this->p_perso->no_special_fields) { $perso_ = $this->p_perso->show_fields($this->notice_id); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; // ajout de && ($p['OPAC_SHOW']||$this->show_opac_hidden_fields) afin de masquer les champs masqués de l'OPAC en diff de bannette. if ($p["AFF"] && ($p['OPAC_SHOW'] || $this->show_opac_hidden_fields)) { $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]); } } } if ($perso_aff) { $this->isbd .= $perso_aff; } //Notices liées if (count($this->childs) && !$this->print_mode && !$this->no_link) { $link = $base_path . '/catalog.php?categ=isbd&id=!!id!!'; $link_expl = $base_path . '/catalog.php?categ=edit_expl&id=!!notice_id!!&cb=!!expl_cb!!&expl_id=!!expl_id!!'; $link_explnum = $base_path . '/catalog.php?categ=edit_explnum&id=!!notice_id!!&explnum_id=!!explnum_id!!'; global $relation_typedown; if (!$relation_typedown) { $relation_typedown = new marc_list("relationtypedown"); } reset($this->childs); if (!$load_tablist_js) { $aff_childs = "<script type='text/javascript' src='" . $base_path . "/javascript/tablist.js'></script>\n"; } $aff_childs .= "<br />"; $load_tablist_js = 1; $anti_loop = $this->anti_loop; $anti_loop[] = $this->notice_id; $n_childs = 0; while ((list($rel_type, $child_notices) = each($this->childs)) && $n_childs < 100) { $aff_childs .= "<b>" . $relation_typedown->table[$rel_type] . "</b>"; $aff_childs .= "<blockquote>"; if ($pmb_notice_fille_format) { $aff_childs .= "<ul class='notice_rel'>"; } for ($i = 0; $i < count($child_notices); $i++) { $as = array_search($child_notices[$i], $anti_loop); if ($as === false) { global $pmb_notice_fille_format; if ($pmb_notice_fille_format) { $level_fille = 0; } else { $level_fille = 6; } // il faut aller chercher le niveau biblio et niveau hierar de la notice liée $requete_nbnh = "select l.niveau_biblio as lnb, l.niveau_hierar as lnh, rank from notices as l join notices_relations on num_notice=notice_id where notice_id='" . $child_notices[$i] . "' "; $r_rel = pmb_mysql_fetch_object(pmb_mysql_query($requete_nbnh)); if ($r_rel->rank != $i) { $req = "update notices_relations set rank='{$i}' where num_notice='" . $child_notices[$i] . "' and relation_type='" . $rel_type . "' and linked_notice='" . $anti_loop[count($serial->anti_loop) - 1] . "'"; pmb_mysql_query($req, $dbh); } if ($r_rel->lnb == 's' && $r_rel->lnh == '1') { // c'est une notice de pério global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial; $link_serial_sub = $base_path . "/catalog.php?categ=serials&sub=view&serial_id=" . $child_notices[$i]; $serial = new serial_display($child_notices[$i], $level_fille, $link_serial_sub, $link_analysis, $link_bulletin, "", $link_explnum_serial, 0, $this->print_mode, 1, 1, 1, 0, 0, $anti_loop); if (count($serial->anti_loop) == 1 && $sort_children) { //Drag pour tri des notices filles $id_elt = $serial->notice_id . ($serial->anti_loop ? "_p" . implode("_", $serial->anti_loop) : ""); $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($serial->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($serial->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\" >"; $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>"; $affichage_result = $serial->result; } else { $drag_fille = ""; $affichage_result = $pmb_notice_fille_format ? "<li>" . $serial->result . "</li>" : $serial->result; } $aff = $drag_fille . $affichage_result; if ($drag_fille) { $aff .= "</div>"; } } else { if ($r_rel->lnb == 'a' && $r_rel->lnh == '2') { // c'est un dépouillement de bulletin global $link_serial, $link_analysis, $link_bulletin, $link_explnum_analysis; $serial = new serial_display($child_notices[$i], $level_fille, $link_serial, $link_analysis, $link_bulletin, "", $link_explnum_analysis, 0, 0, 1, 1, 1, 0, 0, $anti_loop); if (count($serial->anti_loop) == 1 && $sort_children) { //Drag pour tri des notices filles $id_elt = $serial->notice_id . ($serial->anti_loop ? "_p" . implode("_", $serial->anti_loop) : ""); $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($serial->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($serial->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\">"; $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>"; $affichage_result = $serial->result; } else { $drag_fille = ""; $affichage_result = $pmb_notice_fille_format ? "<li>" . $serial->result . "</li>" : $serial->result; } $aff = $drag_fille . $affichage_result; if ($drag_fille) { $aff .= "</div>"; } } else { $display = new mono_display($child_notices[$i], $level_fille, $link, 1, $link_expl, '', $link_explnum, 1, 0, 1, 1, $anti_loop, $this->drag, false, true, 0, 1, 0); if (count($display->anti_loop) == 1 && $sort_children) { //Drag pour tri des notices filles $id_elt = $display->notice_id . ($display->anti_loop ? "_p" . implode("_", $display->anti_loop) : ""); $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($display->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($display->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\">"; $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>"; $affichage_result = $display->result; } else { $drag_fille = ""; $affichage_result = $pmb_notice_fille_format ? "<li>" . $display->result . "</li>" : $display->result; } $display->result = str_replace("<!-- !!bouton_modif!! -->", " ", $display->result); $aff = $drag_fille . $affichage_result; $this->nb_expl += $display->nb_expl; if ($drag_fille) { $aff .= "</div>"; } } } $aff_childs .= $aff; } $n_childs++; } $aff_childs .= ($pmb_notice_fille_format ? "</ul>" : "") . "</blockquote>"; } $this->isbd .= $aff_childs; } if (!$this->print_mode && !$this->anti_loop) { $this->isbd .= "<!-- !!bouton_modif!! -->"; } $this->do_image($this->isbd); if (!$this->anti_loop) { $this->isbd .= "<!-- !!avis_notice!! -->"; } if ($this->expl) { if ($this->notice->niveau_biblio == 'b' && $this->notice->niveau_hierar == 2) { // on est face à une notice de bulletin $requete = "select bulletin_id from bulletins where num_notice=" . $this->notice->notice_id; $result = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($result)) { $bull = pmb_mysql_fetch_object($result); $expl_aff = $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl, $bull->bulletin_id); } } else { $expl_aff = $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl); } if ($expl_aff) { $this->isbd .= "<br /><b>{$msg[285]} </b>(" . $this->nb_expl . ")"; $this->isbd .= $expl_aff; } } if ($this->show_explnum) { $explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum); if ($explnum_assoc) { $this->isbd .= "<b>{$msg['explnum_docs_associes']}</b> (" . show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum, array(), true) . ")" . $explnum_assoc; } } //documents numériques en relation... $explnum_in_relation = show_explnum_in_relation($this->notice->notice_id, $this->link_explnum); if ($explnum_in_relation) { $this->isbd .= "<b>" . $msg["explnum_docs_in_relation"] . "</b>" . $explnum_in_relation; } //reservations et previsions if ($this->show_resa || $this->show_planning && $pmb_resa_planning) { $rqt_nt = "select count(*) from exemplaires, notices, docs_statut where exemplaires.expl_statut=docs_statut.idstatut and notices.notice_id=exemplaires.expl_notice and statut_allow_resa=1 and notices.notice_id=" . $this->notice_id; $result = pmb_mysql_query($rqt_nt, $dbh) or die($rqt_nt . " " . pmb_mysql_error()); $nb_expl_reservables = pmb_mysql_result($result, 0, 0); if ($this->show_resa) { $aff_resa = resa_list($this->notice_id, 0, 0); $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_from_catal&id_notice=" . $this->notice_id . "'; return(false) \""; if ($aff_resa) { $this->isbd .= "<b>" . $msg['resas'] . "</b><br />"; if ($nb_expl_reservables && !($categ == "resa") && !$id_empr) { $this->isbd .= "<input type='button' class='bouton' value='" . $msg['351'] . "' {$ouvrir_reserv}><br /><br />"; } $this->isbd .= $aff_resa . "<br />"; } else { if ($nb_expl_reservables && !($categ == "resa") && !$id_empr) { $this->isbd .= "<b>" . $msg['resas'] . "</b><br /><input type='button' class='bouton' value='" . $msg['351'] . "' {$ouvrir_reserv}><br /><br />"; } } } if ($this->show_planning && $pmb_resa_planning) { $aff_resa_planning = planning_list($this->notice_id, 0, 0); $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_planning_from_catal&id_notice=" . $this->notice_id . "'; return(false) \""; if ($aff_resa_planning) { $this->isbd .= "<b>" . $msg['resas_planning'] . "</b><br />"; if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr) { $this->isbd .= "<input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />"; } $this->isbd .= $aff_resa_planning . "<br />"; } else { if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr) { $this->isbd .= "<b>" . $msg['resas_planning'] . "</b><br /><input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />"; } } } } return; }
function analysis_update($values, $other_fields = "") { global $dbh, $pmb_notice_img_folder_id, $opac_url_base, $pmb_notice_img_pics_max_size; global $pmb_map_activate, $pmb_newrecord_timeshift; // clean des vieilles nouveautés if ($pmb_newrecord_timeshift) { $req_old = "UPDATE notices SET notice_date_is_new ='', notice_is_new=0, update_date=update_date where notice_date_is_new !='0000-00-00 00:00:00' and (notice_date_is_new < now() - interval {$pmb_newrecord_timeshift} day )"; mysql_query($req_old, $dbh); } if (is_array($values)) { $this->analysis_biblio_level = 'a'; $this->analysis_hierar_level = '2'; $this->analysis_typdoc = $values['typdoc']; $this->analysis_statut = $values['statut']; $this->analysis_commentaire_gestion = $values['f_commentaire_gestion']; $this->analysis_thumbnail_url = $values['f_thumbnail_url']; $this->analysis_tit1 = $values['f_tit1']; $this->analysis_tit2 = $values['f_tit2']; $this->analysis_tit3 = $values['f_tit3']; $this->analysis_tit4 = $values['f_tit4']; $this->analysis_n_gen = $values['f_n_gen']; $this->analysis_n_contenu = $values['f_n_contenu']; $this->analysis_n_resume = $values['f_n_resume']; $this->analysis_indexint = $values['f_indexint_id']; $this->analysis_index_l = $values['f_indexation']; $this->analysis_lien = $values['f_lien']; $this->analysis_eformat = $values['f_eformat']; $this->analysis_pages = $values['pages']; $this->analysis_signature = $values['signature']; $this->analysis_indexation_lang = $values['indexation_lang']; $this->notice_is_new = $values['notice_is_new']; // insert de year à partir de la date de parution du bulletin if ($this->date_date) { $this->analysis_year = substr($this->date_date, 0, 4); } $this->date_parution_perio = $this->date_date; // construction de la requête : $data = "typdoc='" . $this->analysis_typdoc . "'"; $data .= ", statut='" . $this->analysis_statut . "'"; $data .= ", tit1='" . $this->analysis_tit1 . "'"; $data .= ", tit3='" . $this->analysis_tit3 . "'"; $data .= ", tit4='" . $this->analysis_tit4 . "'"; $data .= ", year='" . $this->analysis_year . "'"; $data .= ", npages='" . $this->analysis_pages . "'"; $data .= ", n_contenu='" . $this->analysis_n_contenu . "'"; $data .= ", n_gen='" . $this->analysis_n_gen . "'"; $data .= ", n_resume='{$this->analysis_n_resume}'"; $data .= ", lien='" . $this->analysis_lien . "'"; $data .= ", eformat='" . $this->analysis_eformat . "'"; $data .= ", indexint='" . $this->analysis_indexint . "'"; $data .= ", index_l='" . clean_tags($this->analysis_index_l) . "'"; $data .= ", niveau_biblio='" . $this->analysis_biblio_level . "'"; $data .= ", niveau_hierar='" . $this->analysis_hierar_level . "'"; $data .= ", commentaire_gestion='" . $this->analysis_commentaire_gestion . "'"; $data .= ", thumbnail_url='" . $this->analysis_thumbnail_url . "'"; $data .= ", signature='" . $this->analysis_signature . "'"; $data .= ", date_parution='" . $this->date_parution_perio . "'"; $data .= ", indexation_lang='" . $this->analysis_indexation_lang . "'"; $data .= ", notice_is_new='" . $this->notice_is_new . "' \n\t\t\t{$other_fields}"; $result = 0; if (!$this->analysis_id) { // si c'est une création // fabrication de la requête finale $requete = "INSERT INTO notices SET {$data} , create_date=sysdate(), update_date=sysdate() "; $myQuery = pmb_mysql_query($requete, $dbh); $this->analysis_id = pmb_mysql_insert_id($dbh); if ($myQuery) { $result = $this->analysis_id; } // si l'insertion est OK, il faut créer l'entrée dans la table 'analysis' if ($this->analysis_id) { // autorité personnalisées $authperso = new authperso_notice($this->analysis_id); $authperso->save_form(); // map if ($pmb_map_activate) { $map = new map_edition_controler(TYPE_RECORD, $this->analysis_id); $map->save_form(); $map_info = new map_info($this->analysis_id); $map_info->save_form(); } // Mise à jour des index de la notice notice::majNoticesTotal($this->analysis_id); audit::insert_creation(AUDIT_NOTICE, $this->analysis_id); $requete = 'INSERT INTO analysis SET'; $requete .= ' analysis_bulletin=' . $this->id_bulletinage; $requete .= ', analysis_notice=' . $this->analysis_id; $myQuery = pmb_mysql_query($requete, $dbh); } } else { $requete = "UPDATE notices SET {$data} , update_date=sysdate() WHERE notice_id='" . $this->analysis_id . "' LIMIT 1"; $myQuery = pmb_mysql_query($requete, $dbh); // autorité personnalisées $authperso = new authperso_notice($this->analysis_id); $authperso->save_form(); // map if ($pmb_map_activate) { $map = new map_edition_controler(TYPE_RECORD, $this->analysis_id); $map->save_form(); $map_info = new map_info($this->analysis_id); $map_info->save_form(); } // Mise à jour des index de la notice notice::majNoticesTotal($this->analysis_id); audit::insert_modif(AUDIT_NOTICE, $this->analysis_id); if ($myQuery) { $result = $this->analysis_id; } } // vignette de la notice uploadé dans un répertoire $id = $this->analysis_id; if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) { $poids_fichier_max = 1024 * 1024; //Limite la taille de l'image à 1 Mo $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'"; $res = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($res)) { $rep = pmb_mysql_fetch_object($res); $filename_output = $rep->repertoire_path . "img_" . $id; } if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) { $image = ""; $size = 0; $flag = true; while (!feof($fp)) { $image .= fread($fp, 4096); $size = strlen($image); if ($size > $poids_fichier_max) { $flag = false; break; } } if ($flag) { if ($img = imagecreatefromstring($image)) { if (!($pmb_notice_img_pics_max_size * 1)) { $pmb_notice_img_pics_max_size = 100; } $redim = false; if (imagesx($img) >= imagesy($img)) { if (imagesx($img) <= $pmb_notice_img_pics_max_size) { $largeur = imagesx($img); $hauteur = imagesy($img); } else { $redim = true; $largeur = $pmb_notice_img_pics_max_size; $hauteur = $largeur * imagesy($img) / imagesx($img); } } else { if (imagesy($img) <= $pmb_notice_img_pics_max_size) { $hauteur = imagesy($img); $largeur = imagesx($img); } else { $redim = true; $hauteur = $pmb_notice_img_pics_max_size; $largeur = $hauteur * imagesx($img) / imagesy($img); } } if ($redim) { $dest = imagecreatetruecolor($largeur, $hauteur); imagecopyresampled($dest, $img, 0, 0, 0, 0, $largeur, $hauteur, imagesx($img), imagesy($img)); imagepng($dest, $filename_output); imagedestroy($dest); } else { imagepng($img, $filename_output); } imagedestroy($img); $thumbnail_url = $opac_url_base . "getimage.php?noticecode=&vigurl=¬ice_id=" . $id; $req = "update notices set thumbnail_url='" . $thumbnail_url . "' where notice_id ='" . $id . "'"; $res = pmb_mysql_query($req, $dbh); } } } } return $result; } //if(is_array($values)) }
function fetch_data() { global $base_path, $charset; global $opac_show_book_pics; global $opac_book_pics_url; global $opac_book_pics_msg; global $opac_url_base, $use_opac_url_base; global $opac_sur_location_activate; global $fonction_auteur, $msg; global $tdoc, $icon_doc, $biblio_doc; global $pmb_map_activate; global $pmb_url_base; if (!$this->notice_id) { return false; } //Recuperation des infos de la notice $requete = "select * from notices where notice_id=" . $this->notice_id; $resultat = pmb_mysql_query($requete); $res = pmb_mysql_fetch_object($resultat); $this->notice = $res; $this->memo_isbn = $this->notice->code; $this->memo_typdoc = $tdoc->table[$this->notice->typdoc]; //Icone type de Document $icon = $icon_doc[$this->notice->niveau_biblio . $this->notice->typdoc]; if ($icon) { $info_bulle_icon = $biblio_doc[$this->notice->niveau_biblio] . " : " . $tdoc->table[$this->notice->typdoc]; if ($use_opac_url_base) { $this->memo_icondoc = "<img src=\"" . $opac_url_base . "images/{$icon}\" alt=\"{$info_bulle_icon}\" title=\"{$info_bulle_icon}\" align='top' />"; } else { $this->memo_icondoc = "<img src=\"" . $pmb_url_base . "images/{$icon}\" alt=\"{$info_bulle_icon}\" title=\"{$info_bulle_icon}\" align='top' />"; } } if ($use_opac_url_base) { if (isset($_SESSION["cart"]) && in_array($this->notice_id, $_SESSION["cart"])) { $this->memo_iconcart = "<span id='baskets" . $this->notice_id . "'><a href='#' class=\"img_basket_exist\" title=\"" . $msg['notice_title_basket_exist'] . "\"><img src=\"" . $opac_url_base . "images/basket_exist.gif\" border=\"0\" alt=\"" . $msg['notice_title_basket_exist'] . "\" /></a></span>"; } else { $title = $this->notice_header; if (!$title) { $title = $this->notice->tit1; } $this->memo_iconcart = "<span id='baskets" . $this->notice_id . "'><a href=\"cart_info.php?id=" . $this->notice_id . "&header=" . rawurlencode(strip_tags($title)) . "\" target=\"cart_info\" class=\"img_basket\" title=\"" . $msg['notice_title_basket'] . "\"><img src=\"" . $opac_url_base . "images/basket_small_20x20.gif\" border=\"0\" title=\"" . $msg['notice_title_basket'] . "\" alt=\"" . $msg['notice_title_basket'] . "\" /></a></span>"; } } else { $this->memo_iconcart = "<img src=\"" . $pmb_url_base . "images/basket_small_20x20.gif\" align='absmiddle' border='0' title='" . $msg["400"] . "' alt='" . $msg["400"] . "' />"; } $this->niveau_biblio = $this->notice->niveau_biblio; $this->niveau_hierar = $this->notice->niveau_hierar; //Recherche des infos du périodique $this->fetch_analysis_info(); //Recherche des etats de collection $this->fetch_collstate(); //Titres //Titre de serie et composition du titre $this->memo_series[] = array(); if ($res->tparent_id) { $requete = "select * from series where serie_id=" . $res->tparent_id; $resultat = pmb_mysql_query($requete); if ($serie = pmb_mysql_fetch_object($resultat)) { $this->memo_series[] = $serie; $this->memo_titre = $serie->serie_name; $this->memo_titre_serie = $serie->serie_name; $this->isbd = $this->serie_name; if ($this->notice->tnvol) { $this->memo_titre .= ', ' . $res->tnvol; $this->memo_titre_serie .= ', ' . $res->tnvol; $this->isbd .= ', ' . $this->tnvol; } } } elseif ($this->notice->tnvol) { $this->memo_titre .= $res->tnvol; } $this->memo_titre ? $this->memo_titre .= '. ' . $res->tit1 : ($this->memo_titre = $res->tit1); $this->isbd ? $this->isbd .= '. ' . $this->notice->tit1 : ($this->isbd = $this->notice->tit1); $tit2 = $this->notice->tit2; $tit3 = $this->notice->tit3; $tit4 = $this->notice->tit4; if ($tit3) { $this->isbd .= " = {$tit3}"; } if ($tit4) { $this->isbd .= " : {$tit4}"; } if ($tit2) { $this->isbd .= " ; {$tit2}"; } $this->isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']'; $this->memo_notice_bulletin = new stdClass(); $this->memo_bulletin = new stdClass(); if ($res->niveau_biblio == 'b') { $rqt = "select tit1, date_format(date_date, '" . $msg["format_date"] . "') as aff_date_date, bulletin_numero as num_bull,bulletin_notice from bulletins,notices where bulletins.num_notice='" . $this->notice_id . "' and notices.notice_id=bulletins.bulletin_notice"; $execute_query = pmb_mysql_query($rqt); $row = pmb_mysql_fetch_object($execute_query); $this->memo_titre .= " " . (!$row->aff_date_date ? sprintf($msg["bul_titre_perio"], $row->tit1) : sprintf($msg["bul_titre_perio"], $row->tit1 . ", " . $row->num_bull . " [" . $row->aff_date_date . "]")); // recherche editeur de la notice de perio $rqt_perio = "select * from notices where notice_id=" . $row->bulletin_notice; $execute_query_perio = pmb_mysql_query($rqt_perio); $row_perio = pmb_mysql_fetch_object($execute_query_perio); if (!$this->notice->ed1_id) { $this->notice->ed1_id = $row_perio->ed1_id; } //issn pour les notices de bulletin if (!$this->notice->code) { $this->memo_isbn = $row_perio->code; } } elseif ($res->niveau_biblio == 'a' && $res->niveau_hierar == 2) { $requete = "SELECT b.* "; $requete .= "from analysis a, notices b, bulletins c"; $requete .= " WHERE a.analysis_notice=" . $this->notice_id; $requete .= " AND c.bulletin_id=a.analysis_bulletin"; $requete .= " AND c.bulletin_notice=b.notice_id"; $requete .= " LIMIT 1"; $myQuery = pmb_mysql_query($requete); if (pmb_mysql_num_rows($myQuery)) { $row_perio = pmb_mysql_fetch_object($myQuery); if (!$this->notice->ed1_id) { $this->notice->ed1_id = $row_perio->ed1_id; } //issn pour les notice de dépouillement if (!$this->notice->code) { $this->memo_isbn = $row_perio->code; } } // info du bulletin de ce dépouillement $req_bulletin = "SELECT c.* from analysis a, bulletins c WHERE c.bulletin_id=a.analysis_bulletin AND analysis_notice=" . $res->notice_id; $result_bull = pmb_mysql_query($req_bulletin); if ($bull = pmb_mysql_fetch_object($result_bull)) { $this->memo_bulletin = $bull; $this->memo_notice_bulletin = $bull; $this->bulletin_mention_date = $bull->mention_date; $this->bulletin_date_date = formatdate($bull->date_date); $this->bulletin_numero = $bull->bulletin_numero; } } $this->memo_complement_titre = $res->tit4; $this->memo_titre_parallele = $res->tit3; $this->memo_notice = $res; //mention d'édition $this->memo_mention_edition = $res->mention_edition; //Titre du pério pour les notices de bulletin if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') { $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1 as titre from bulletins, notices WHERE bulletin_notice=notice_id AND num_notice=" . $res->notice_id; $result_bull = pmb_mysql_query($req_bulletin); while ($bull = pmb_mysql_fetch_object($result_bull)) { $this->memo_notice_bulletin = $bull; $this->memo_bulletin = $bull; $this->serial_title = $bull->titre; $this->bulletin_mention_date = $bull->mention_date; $this->bulletin_date_date = formatdate($bull->date_date); $this->bulletin_numero = $bull->bulletin_numero; $this->bulletin_id = $bull->bulletin_id; } } //Langage $this->memo_lang = get_notice_langues($this->notice_id, 0); // langues de la publication $this->memo_lang_or = get_notice_langues($this->notice_id, 1); // langues originales //Auteurs $this->authors = array(); //Recherche des auteurs; $this->responsabilites = get_notice_authors($this->notice_id); $mention_resp = $mention_resp_1 = $mention_resp_2 = array(); $isbd_entry_1 = $isbd_entry_2 = array(); $as = array_search("0", $this->responsabilites["responsabilites"]); if ($as !== FALSE && $as !== NULL) { $auteur_0 = $this->responsabilites["auteurs"][$as]; $auteur = new auteur($auteur_0["id"]); $auteur->fonction = $fonction_auteur[$auteur_0["fonction"]]; $this->authors[] = $auteur; if ($this->print_mode) { $mention_resp_lib = $auteur->isbd_entry; } else { $mention_resp_lib = $auteur->isbd_entry_lien_gestion; } if (!$this->print_mode) { $mention_resp_lib .= $auteur->author_web_link; } if ($auteur_0["fonction"]) { $mention_resp_lib .= ", " . $fonction_auteur[$auteur_0["fonction"]]; } $mention_resp[] = $mention_resp_lib; $this->memo_auteur_principal = $auteur->isbd_entry; } $as = array_keys($this->responsabilites["responsabilites"], "1"); for ($i = 0; $i < count($as); $i++) { $indice = $as[$i]; $auteur_1 = $this->responsabilites["auteurs"][$indice]; $auteur = new auteur($auteur_1["id"]); $auteur->fonction = $fonction_auteur[$auteur_1["fonction"]]; $this->authors[] = $auteur; if ($this->print_mode) { $mention_resp_lib = $auteur->isbd_entry; } else { $mention_resp_lib = $auteur->isbd_entry_lien_gestion; } if (!$this->print_mode) { $mention_resp_lib .= $auteur->author_web_link; } if ($auteur_1["fonction"]) { $mention_resp_lib .= ", " . $fonction_auteur[$auteur_1["fonction"]]; } $mention_resp[] = $mention_resp_lib; $mention_resp_1[] = $mention_resp_lib; $isbd_entry_1[] = $auteur->isbd_entry; } $this->memo_mention_resp_1 = implode("; ", $mention_resp_1); $this->memo_auteur_autre_tab = $isbd_entry_1; $this->memo_auteur_autre = implode("; ", $isbd_entry_1); $as = array_keys($this->responsabilites["responsabilites"], "2"); for ($i = 0; $i < count($as); $i++) { $indice = $as[$i]; $auteur_2 = $this->responsabilites["auteurs"][$indice]; $auteur = new auteur($auteur_2["id"]); $auteur->fonction = $fonction_auteur[$auteur_2["fonction"]]; $this->authors[] = $auteur; if ($this->print_mode) { $mention_resp_lib = $auteur->isbd_entry; } else { $mention_resp_lib = $auteur->isbd_entry_lien_gestion; } if (!$this->print_mode) { $mention_resp_lib .= $auteur->author_web_link; } if ($auteur_2["fonction"]) { $mention_resp_lib .= ", " . $fonction_auteur[$auteur_2["fonction"]]; } $mention_resp[] = $mention_resp_lib; $mention_resp_2[] = $mention_resp_lib; $isbd_entry_2[] = $auteur->isbd_entry; } $this->memo_mention_resp_2 = implode("; ", $mention_resp_2); $this->memo_auteur_secondaire_tab = $isbd_entry_2; $this->memo_auteur_secondaire = implode("; ", $isbd_entry_2); $this->memo_libelle_mention_resp = implode("; ", $mention_resp); if ($this->memo_libelle_mention_resp) { $this->isbd .= " / {$this->memo_libelle_mention_resp}"; } // on récupère la collection au passage, si besoin est if ($this->notice->subcoll_id) { $collection = new subcollection($this->notice->subcoll_id); $info = $this->get_info_editeur($collection->editeur); $this->memo_collection = $collection->isbd_entry; $this->memo_ed1 = $info["isbd_entry"]; $this->memo_ed1_name = $info["name"]; $this->memo_ed1_place = $info["place"]; $editeurs = $info["isbd_entry"]; } elseif ($this->notice->coll_id) { $collection = new collection($this->notice->coll_id); $info = $this->get_info_editeur($collection->parent); $this->memo_collection = $collection->isbd_entry; $this->memo_ed1 = $info["isbd_entry"]; $this->memo_ed1_name = $info["name"]; $this->memo_ed1_place = $info["place"]; $editeurs = $info["isbd_entry"]; } elseif ($this->notice->ed1_id) { $info = $this->get_info_editeur($this->notice->ed1_id); $this->memo_ed1 = $info["isbd_entry"]; $this->memo_ed1_name = $info["name"]; $this->memo_ed1_place = $info["place"]; $editeurs = $info["isbd_entry"]; } if ($this->notice->ed2_id) { $info = $this->get_info_editeur($this->notice->ed2_id); $this->memo_ed2 = $info["isbd_entry"]; $this->memo_ed2_name = $info["name"]; $this->memo_ed2_place = $info["place"]; $editeurs ? $editeurs .= ' ; ' . $info["isbd_entry"] : ($editeurs = $info["isbd_entry"]); } if ($this->notice->year) { $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year); } elseif ($this->notice->niveau_biblio != 'b') { $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]"); } $this->memo_year = $this->notice->year; if ($editeurs) { $this->isbd .= ". - {$editeurs}"; } // zone de la collation (ne concerne que a2) if ($this->notice->npages) { $collation = $this->notice->npages; } if ($this->notice->ill) { $collation .= ': ' . $this->notice->ill; } if ($this->notice->size) { $collation .= '; ' . $this->notice->size; } if ($this->notice->accomp) { $collation .= '+ ' . $this->notice->accomp; } if ($collation) { $this->isbd .= ". - {$collation}"; } $this->memo_collation = $collation; // map $this->memo_map_isbd = ""; $this->memo_map_id = 0; $this->memo_map_echelle = ""; $this->memo_map_projection = ""; $this->memo_map_ref = ""; $this->memo_map_equinoxe = ""; $this->memo_map = ""; if ($pmb_map_activate) { $ids[] = $this->notice_id; $this->map = new map_objects_controler(TYPE_RECORD, $ids); $this->map_info = new map_info($this->notice_id); $this->memo_map_isbd = $this->map_info->get_isbd(); if ($this->memo_map_isbd) { $this->isbd .= ". - " . $this->memo_map_isbd; } $this->memo_map_id = $this->map_info->map['id']; $this->memo_map_echelle = $this->map_info->map['echelle']; $this->memo_map_projection = $this->map_info->map['projection']; $this->memo_map_ref = $this->map_info->map['ref']; $this->memo_map_equinoxe = $this->map_info->map['equinoxe']; $this->memo_map = $this->map->get_map(); } //Recherche du code dewey $requete = "select * from indexint where indexint_id=" . $res->indexint; $resultat = pmb_mysql_query($requete); if ($code_dewey = pmb_mysql_fetch_object($resultat)) { $this->memo_dewey = $code_dewey; } if ($collections = $this->memo_collection) { if ($this->notice->nocoll) { $collections .= '; ' . $this->notice->nocoll; } $this->isbd .= ". - ({$collections})" . ' '; } if (substr(trim($this->isbd), -1) != ".") { $this->isbd .= '.'; } //Traitement des exemplaires $this->memo_exemplaires = array(); $requete = "select expl_id, expl_cb, expl_cote, expl_statut,statut_libelle, expl_typdoc, tdoc_libelle, expl_note, expl_comment, expl_section, section_libelle, "; $requete .= "expl_owner, lender_libelle, expl_codestat, codestat_libelle, expl_date_retour, expl_date_depot, expl_note, pret_flag, expl_location, location_libelle, expl_prix "; if ($opac_sur_location_activate) { $requete .= ", ifnull(surloc_id,0) as surloc_id, ifnull(surloc_libelle,'') as surloc_libelle "; } $requete .= "from exemplaires, docs_statut, docs_type, docs_section, docs_codestat, lenders, docs_location "; if ($opac_sur_location_activate) { $requete .= "left join sur_location on surloc_num=surloc_id "; } $requete .= "where expl_notice=" . $res->notice_id . " and expl_statut=idstatut and expl_typdoc=idtyp_doc and expl_section=idsection and expl_owner=idlender and expl_codestat=idcode "; $requete .= "and expl_location=idlocation "; $requete .= "union "; $requete .= "select expl_id, expl_cb, expl_cote, expl_statut,statut_libelle, expl_typdoc, tdoc_libelle, expl_note, expl_comment, expl_section, section_libelle, "; $requete .= "expl_owner, lender_libelle, expl_codestat, codestat_libelle, expl_date_retour, expl_date_depot, expl_note, pret_flag, expl_location, location_libelle, expl_prix "; if ($opac_sur_location_activate) { $requete .= ", ifnull(surloc_id,0) as surloc_id, ifnull(surloc_libelle,'') as surloc_libelle "; } $requete .= "from exemplaires, bulletins, docs_statut, docs_type, docs_section, docs_codestat, lenders, docs_location "; if ($opac_sur_location_activate) { $requete .= "left join sur_location on surloc_num=surloc_id "; } $requete .= "where bulletins.num_notice=" . $res->notice_id . " and expl_bulletin=bulletin_id and expl_statut=idstatut and expl_typdoc=idtyp_doc and expl_section=idsection and expl_owner=idlender and expl_codestat=idcode "; $requete .= "and expl_location=idlocation"; $resultat = pmb_mysql_query($requete); while ($ex = pmb_mysql_fetch_object($resultat)) { //Champs perso d'exemplaires $parametres_perso = array(); $mes_pp = new parametres_perso("expl"); if (!$mes_pp->no_special_fields) { $mes_pp->get_values($ex->expl_id); $values = $mes_pp->values; foreach ($values as $field_id => $vals) { $parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["TITRE"] = $mes_pp->t_fields[$field_id]["TITRE"]; foreach ($vals as $value) { $parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["VALUE"][] = $mes_pp->get_formatted_output(array($value), $field_id); } } } $ex->parametres_perso = $parametres_perso; $this->memo_exemplaires[] = $ex; } //Descripteurs $requete = "SELECT libelle_categorie FROM categories, notices_categories WHERE notcateg_notice=" . $res->notice_id . " and categories.num_noeud = notices_categories.num_noeud ORDER BY ordre_categorie"; $resultat = pmb_mysql_query($requete); $this->memo_categories = array(); while ($cat = pmb_mysql_fetch_object($resultat)) { $this->memo_categories[] = $cat; } $authperso = new authperso_notice($this->notice_id); $this->memo_authperso_all_isbd .= $authperso->get_notice_display(); $this->memo_authperso_all_isbd_list = $authperso->get_notice_display_list(); foreach ($authperso->auth_info as $fields) { foreach ($fields["info_fields"] as $field) { if (is_array($field["values"]) && count($field["values"])) { $tvalues = array(); foreach ($field["values"] as $values) { $tvalues[] = $values["format_value"]; } $this->parametres_auth_perso[$field["name"]]["TITRE"][] = $field["label"]; $this->parametres_auth_perso[$field["name"]]["VALUE"][] = $tvalues; } } } //Champs perso de notice traite par la table notice_custom $mes_pp = new parametres_perso("notices"); $mes_pp->get_values($res->notice_id); $values = $mes_pp->values; $this->parametres_perso = array(); foreach ($values as $field_id => $vals) { $this->parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["TITRE"] = $mes_pp->t_fields[$field_id]["TITRE"]; foreach ($vals as $value) { $this->parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["VALUE"][] = $mes_pp->get_formatted_output(array($value), $field_id); $this->parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["VALUE_IN_DATABASE"][] = $value; } } //Notices liées, relations entre notices //les notices mères $requete = "SELECT num_notice, linked_notice, relation_type, rank from notices_relations where num_notice=" . $res->notice_id . " order by num_notice, rank asc"; $resultat = pmb_mysql_query($requete); $i = 0; while ($notice_fille = pmb_mysql_fetch_object($resultat)) { $this->memo_notice_mere[$i] = $notice_fille->linked_notice; $this->memo_notice_mere_relation_type[$i] = $notice_fille->relation_type; $i++; } // les notices filles $requete = "SELECT num_notice, linked_notice, relation_type, rank from notices_relations where linked_notice=" . $res->notice_id . " order by num_notice, rank asc"; $resultat = pmb_mysql_query($requete); $i = 0; while ($notice_mere = pmb_mysql_fetch_object($resultat)) { $this->memo_notice_fille[$i] = $notice_mere->num_notice; $this->memo_notice_fille_relation_type[$i] = $notice_mere->relation_type; $i++; } // liens vers les périodiques pour les notices d'article $req_perio_link = "SELECT notice_id, tit1, code from bulletins,analysis,notices WHERE bulletin_notice=notice_id and bulletin_id=analysis_bulletin and analysis_notice=" . $res->notice_id; $result_perio_link = pmb_mysql_query($req_perio_link); while ($notice_perio_link = pmb_mysql_fetch_object($result_perio_link)) { $this->memo_notice_article[] = $notice_perio_link->notice_id; } // bulletinage pour les notices de pério $req_bulletinage = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins, notices WHERE bulletin_notice = notice_id AND notice_id=" . $res->notice_id; $result_bulletinage = pmb_mysql_query($req_bulletinage); while ($notice_bulletinage = pmb_mysql_fetch_object($result_bulletinage)) { $this->memo_bulletinage[] = $notice_bulletinage->bulletin_id; } // liens vers les bulletins pour les notices d'article $req_bull_link = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins, analysis WHERE bulletin_id=analysis_bulletin and analysis_notice=" . $res->notice_id; $result_bull_link = pmb_mysql_query($req_bull_link); while ($notice_bull_link = pmb_mysql_fetch_object($result_bull_link)) { $this->memo_article_bulletinage[] = $notice_bull_link->bulletin_id; } $paramaff["mine_type"] = 1; $this->memo_explnum_assoc = show_explnum_per_notice($res->notice_id, 0, "", $paramaff); if ($this->notice->code || $this->notice->thumbnail_url) { if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $this->notice->thumbnail_url)) { $code_chiffre = pmb_preg_replace('/-|\\.| /', '', $this->notice->code); $url_image = $opac_book_pics_url; $url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "&noticecode=!!noticecode!!&vigurl=" . urlencode($this->notice->thumbnail_url); if ($this->notice->thumbnail_url) { $url_image_ok = $this->notice->thumbnail_url; $title_image_ok = ""; } else { $url_image_ok = str_replace("!!noticecode!!", $code_chiffre, $url_image); $title_image_ok = htmlentities($opac_book_pics_msg, ENT_QUOTES, $charset); } $this->memo_image = "<img class='vignetteimg' src='" . $url_image_ok . "' title=\"" . $title_image_ok . "\" align='right' hspace='4' vspace='2' style='max-width : 140px; max-height: 200px;' >"; $this->memo_url_image = $url_image_ok; } else { $this->memo_image = ""; $this->memo_url_image = ""; } } //calcul du permalink... if ($this->notice->niveau_biblio != "b") { $this->permalink = $opac_url_base . "index.php?lvl=notice_display&id=" . $this->notice_id; } else { $this->permalink = $opac_url_base . "index.php?lvl=bulletin_display&id=" . $this->bulletin_id; } //Traitement des avis $this->memo_avis = array(); $requete = "SELECT id_avis,note,sujet,commentaire,DATE_FORMAT(dateajout,'" . $msg['format_date'] . "') as ladate,empr_login,empr_nom, empr_prenom, valide\n\t\tfrom avis left join empr on id_empr=num_empr where num_notice='" . $res->notice_id . "' and valide=1 order by avis_rank, dateajout desc"; $resultat = pmb_mysql_query($requete); if ($resultat) { while ($avis = pmb_mysql_fetch_object($resultat)) { $avis->note_textuelle = $msg['avis_detail_note_' . $avis->note]; if ($charset != "utf-8") { $avis->commentaire = cp1252Toiso88591($avis->commentaire); } $avis->commentaire = do_bbcode($avis->commentaire); $this->memo_avis[] = $avis; } } //Titres uniformes $requete = "select * from notices_titres_uniformes where ntu_num_notice=" . $res->notice_id . " order by ntu_ordre"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { while ($tu = pmb_mysql_fetch_object($resultat)) { $tu_memo = new titre_uniforme($tu->ntu_num_tu); $tu_memo->parametres_perso = array(); $mes_pp = new parametres_perso("tu"); $mes_pp->get_values($tu->ntu_num_tu); $values = $mes_pp->values; foreach ($values as $field_id => $vals) { $tu_memo->parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["TITRE"] = $mes_pp->t_fields[$field_id]["TITRE"]; foreach ($vals as $value) { $tu_memo->parametres_perso[$mes_pp->t_fields[$field_id]["NAME"]]["VALUE"][] = $mes_pp->get_formatted_output(array($value), $field_id); } } $this->memo_tu[] = $tu_memo; } } //statut $this->memo_statut['id_notice_statut'] = $res->statut; $this->memo_statut['gestion_statut_libelle'] = ''; $this->memo_statut['opac_statut_libelle'] = ''; if ($this->memo_statut['id_notice_statut']) { $requete = "SELECT * FROM notice_statut WHERE id_notice_statut=" . $this->memo_statut['id_notice_statut'] * 1; $resultat = pmb_mysql_query($requete); if ($resultat) { $statut = pmb_mysql_fetch_object($resultat); $this->memo_statut['gestion_statut_libelle'] = $statut->gestion_libelle; $this->memo_statut['opac_statut_libelle'] = $statut->opac_libelle; } } return true; }
$requete .= ", indexation_lang='{$t_notice['indexation_lang']}'"; $requete .= ", notice_is_new='{$t_notice['notice_is_new']}'"; $requete .= $req_notice_date_is_new; $requete .= $postrequete; $result = pmb_mysql_query($requete, $dbh); //traitement audit if (!$id) { $sav_id = 0; $id = pmb_mysql_insert_id($dbh); audit::insert_creation(AUDIT_NOTICE, $id); } else { $sav_id = $id; audit::insert_modif(AUDIT_NOTICE, $id); } // autorité personnalisées $authperso = new authperso_notice($id); $authperso->save_form(); // map global $pmb_map_activate; if ($pmb_map_activate) { $map = new map_edition_controler(TYPE_RECORD, $id); $map->save_form(); $map_info = new map_info($id); $map_info->save_form(); } // vignette de la notice uploadé dans un répertoire if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) { $poids_fichier_max = 1024 * 1024; //Limite la taille de l'image à 1 Mo $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'"; $res = pmb_mysql_query($req, $dbh);
static function majNoticesMotsGlobalIndex($notice, $datatype = 'all') { global $include_path; global $dbh, $champ_base; global $lang; global $indexation_lang; //recuperation du fichier xml de configuration if (!count($champ_base)) { $file = $include_path . "/indexation/notices/champs_base_subst.xml"; if (!file_exists($file)) { $file = $include_path . "/indexation/notices/champs_base.xml"; } $fp = fopen($file, "r"); if ($fp) { $xml = fread($fp, filesize($file)); } fclose($fp); $champ_base = _parser_text_no_function_($xml, "INDEXATION"); } $tableau = $champ_base; //analyse des donnees des tables $temp_not = array(); $temp_not['t'][0][0] = $tableau['REFERENCE'][0][value]; $temp_ext = array(); $temp_marc = array(); $champ_trouve = false; $tab_code_champ = array(); $tab_languages = array(); $tab_keep_empty = array(); $tab_pp = array(); $tab_authperso = array(); $authperso_code_champ_start = 0; $isbd_ask_list = array(); for ($i = 0; $i < count($tableau['FIELD']); $i++) { //pour chacun des champs decrits //recuperation de la liste des informations a mettre a jour if ($datatype == 'all' || $datatype == $tableau['FIELD'][$i]['DATATYPE']) { //conservation des mots vides if ($tableau['FIELD'][$i]['KEEPEMPTYWORD'] == "yes") { $tab_keep_empty[] = $tableau['FIELD'][$i]['ID']; } //champ perso if ($tableau['FIELD'][$i]['DATATYPE'] == "custom_field") { $tab_pp[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['value']; //autorité perso } elseif ($tableau['FIELD'][$i]['DATATYPE'] == "authperso") { $tab_authperso[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['value']; $authperso_code_champ_start = $tableau['FIELD'][$i]['ID']; $authpersos = new authperso_notice($notice); } else { if ($tableau['FIELD'][$i]['EXTERNAL'] == "yes") { //champ externe à la table notice //Stockage de la structure pour un accès plus facile $temp_ext[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]; } else { //champ de la table notice $temp_not['f'][0][$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']; $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']] = array('champ' => $tableau['FIELD'][$i]['ID'], 'ss_champ' => 0, 'pond' => $tableau['FIELD'][$i]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false, 'internal' => 1, 'use_global_separator' => $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['USE_GLOBAL_SEPARATOR']); if ($tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']) { $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']]['marctype'] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']; $temp_not['f'][0][$tableau['FIELD'][$i]['ID'] . "_marc"] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value'] . " as " . "subst_for_marc_" . $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']; } } } if ($tableau['FIELD'][$i]['ISBD']) { // isbd autorités $isbd_ask_list[$tableau['FIELD'][$i]['ID']] = array('champ' => $tableau['FIELD'][$i]['ID'], 'ss_champ' => $tableau['FIELD'][$i]['ISBD'][0]['ID'], 'pond' => $tableau['FIELD'][$i]['ISBD'][0]['POND'], 'class_name' => $tableau['FIELD'][$i]['ISBD'][0]['CLASS_NAME']); } $champ_trouve = true; } } if ($champ_trouve) { $tab_req = array(); //Recherche des champs directs if ($datatype == 'all') { $tab_req[0]["rqt"] = "select " . implode(',', $temp_not['f'][0]) . " from " . $temp_not['t'][0][0]; $tab_req[0]["rqt"] .= " where " . $tableau['REFERENCEKEY'][0][value] . "='" . $notice . "'"; $tab_req[0]["table"] = $temp_not['t'][0][0]; } foreach ($temp_ext as $k => $v) { $isbd_tab_req = array(); $no_word_field = false; //Construction de la requete //Champs pour le select $select = array(); //on harmonise les fichiers XML décrivant des requetes... for ($i = 0; $i < count($v["TABLE"]); $i++) { $table = $v['TABLE'][$i]; $select = array(); if (count($table['TABLEFIELD'])) { $use_word = true; } else { $use_word = false; } if ($table['IDKEY'][0]) { $select[] = $table['NAME'] . "." . $table['IDKEY'][0]['value'] . " as subst_for_autorite_" . $table['IDKEY'][0]['value']; } for ($j = 0; $j < count($table['TABLEFIELD']); $j++) { $select[] = ($table['ALIAS'] ? $table['ALIAS'] . "." : "") . $table['TABLEFIELD'][$j]["value"]; if ($table['LANGUAGE']) { $select[] = $table['LANGUAGE'][0]['value']; $tab_languages[$k] = $table['LANGUAGE'][0]['value']; } $field_name = $table['TABLEFIELD'][$j]["value"]; if (strpos(strtolower($table['TABLEFIELD'][$j]["value"]), " as ") !== false) { //Pour le cas où l'on a besoin de nommer un champ et d'utiliser un alias $field_name = substr($table['TABLEFIELD'][$j]["value"], strpos(strtolower($table['TABLEFIELD'][$j]["value"]), " as ") + 4); } elseif (strpos($table['TABLEFIELD'][$j]["value"], ".") !== false) { $field_name = substr($table['TABLEFIELD'][$j]["value"], strpos($table['TABLEFIELD'][$j]["value"], ".") + 1); } $field_name = trim($field_name); $tab_code_champ[$v['ID']][$field_name] = array('champ' => $v['ID'], 'ss_champ' => $table['TABLEFIELD'][$j]["ID"], 'pond' => $table['TABLEFIELD'][$j]['POND'], 'no_words' => $v['DATATYPE'] == "marclist" ? true : false, 'autorite' => $table['IDKEY'][0]['value']); if ($table['TABLEFIELD'][$j]['MARCTYPE']) { $tab_code_champ[$v['ID']][$table['TABLEFIELD'][$j]["value"]]['marctype'] = $table['TABLEFIELD'][$j]['MARCTYPE']; $select[] = $table['NAME'] . "." . $table['TABLEFIELD'][$j]["value"] . " as subst_for_marc_" . $table['TABLEFIELD'][$j]['MARCTYPE']; } } $query = "select " . implode(",", $select) . " from notices"; $jointure = ""; for ($j = 0; $j < count($table['LINK']); $j++) { $link = $table['LINK'][$j]; if ($link["TABLE"][0]['ALIAS']) { $alias = $link["TABLE"][0]['ALIAS']; } else { $alias = $link["TABLE"][0]['value']; } switch ($link["TYPE"]) { case "n0": if ($link["TABLEKEY"][0]['value']) { $jointure .= " LEFT JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : ""); if ($link["EXTERNALTABLE"][0]['value']) { $jointure .= " ON " . $link["EXTERNALTABLE"][0]['value'] . "." . $link["EXTERNALFIELD"][0]['value']; } else { $jointure .= " ON " . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value']; } $jointure .= "=" . $alias . "." . $link["TABLEKEY"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value']; } else { $jointure .= " LEFT JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON " . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value']; } break; case "n1": if ($link["TABLEKEY"][0]['value']) { $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : ""); if ($link["EXTERNALTABLE"][0]['value']) { $jointure .= " ON " . $link["EXTERNALTABLE"][0]['value'] . "." . $link["EXTERNALFIELD"][0]['value']; } else { $jointure .= " ON " . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value']; } $jointure .= "=" . $alias . "." . $link["TABLEKEY"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value']; } else { $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON " . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value']; } break; case "1n": $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON (" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value']; $jointure .= "=" . $tableau['REFERENCE'][0]['value'] . "." . $link["REFERENCEFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") "; break; case "nn": $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : ""); $jointure .= " ON (" . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value']; $jointure .= "=" . $alias . "." . $link["REFERENCEFIELD"][0]['value'] . ") "; if ($link["TABLEKEY"][0]['value']) { $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON (" . $alias . "." . $link["TABLEKEY"][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") "; } else { $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON (" . $alias . "." . $link["EXTERNALFIELD"][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") "; } break; } } $where = " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $notice; if ($table['FILTER']) { foreach ($table['FILTER'] as $filter) { if ($tmp = trim($filter["value"])) { $where .= " AND (" . $tmp . ")"; } } } if ($table['LANGUAGE']) { $tab_req_lang[$k] = "select " . $table['LANGUAGE'][0]['value'] . " from "; } $query .= $jointure . $where; if ($table['LANGUAGE']) { $tab_req_lang[$k] .= $jointure . $where; } if ($use_word) { $tab_req[$k]["new_rqt"]['rqt'][] = $query; } if ($isbd_ask_list[$k]) { // isbd => memo de la requete pour retrouver les id des autorités $id_aut = $table['NAME'] . "." . $table["TABLEKEY"][0]['value']; $req = "select {$id_aut} as id_aut_for_isbd from notices" . $jointure . $where; $isbd_tab_req[] = $req; } } if ($use_word) { $tab_req[$k]["rqt"] = implode(" union ", $tab_req[$k]["new_rqt"]['rqt']); } if ($isbd_ask_list[$k]) { // isbd => memo de la requete pour retrouver les id des autorités $req = implode(" union ", $isbd_tab_req); $isbd_ask_list[$k]['req'] = $req; } } //qu'est-ce qu'on efface? if ($datatype == 'all') { $req_del = "delete from notices_mots_global_index where id_notice='" . $notice . "' "; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from notices_fields_global_index where id_notice='" . $notice . "' "; pmb_mysql_query($req_del, $dbh); } else { foreach ($tab_code_champ as $subfields) { foreach ($subfields as $subfield) { $req_del = "delete from notices_mots_global_index where id_notice='" . $notice . "' and code_champ='" . $subfield['champ'] . "'"; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from notices_fields_global_index where id_notice='" . $notice . "' and code_champ='" . $subfield['champ'] . "'"; pmb_mysql_query($req_del, $dbh); break; } } //Les champs perso if (count($tab_pp)) { foreach ($tab_pp as $id) { $req_del = "delete from notices_mots_global_index where id_notice='" . $notice . "' and code_champ=100 and code_ss_champ='" . $id . "' "; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from notices_fields_global_index where id_notice='" . $notice . "' and code_champ=100 and code_ss_champ='" . $id . "' "; pmb_mysql_query($req_del, $dbh); } } //Les autorités perso if (count($tab_authperso)) { $authperso_fields = $authpersos->get_index_fields_to_delete(); foreach ($authperso_fields as $code_champ) { $code_champ += $authperso_code_champ_start; $req_del = "delete from notices_mots_global_index where id_notice='" . $notice . "' and code_champ={$code_champ} "; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from notices_fields_global_index where id_notice='" . $notice . "' and code_champ={$code_champ} "; pmb_mysql_query($req_del, $dbh); } } } //qu'est-ce qu'on met a jour ? $tab_insert = array(); $tab_field_insert = array(); foreach ($tab_req as $k => $v) { $r = pmb_mysql_query($v["rqt"], $dbh); $tab_mots = array(); $tab_fields = array(); if (pmb_mysql_num_rows($r)) { while ($tab_row = pmb_mysql_fetch_array($r, MYSQL_ASSOC)) { $langage = ""; if (isset($tab_row[$tab_languages[$k]])) { $langage = $tab_row[$tab_languages[$k]]; unset($tab_row[$tab_languages[$k]]); } foreach ($tab_row as $nom_champ => $liste_mots) { if (substr($nom_champ, 0, 10) == 'subst_for_') { continue; } if ($tab_code_champ[$k][$nom_champ]['internal']) { $langage = $indexation_lang; } if ($tab_code_champ[$k][$nom_champ]['marctype']) { //on veut toutes les langues, pas seulement celle de l'interface... $saved_lang = $lang; $code = $liste_mots; $dir = opendir($include_path . "/marc_tables"); while ($dir_lang = readdir($dir)) { if ($dir_lang != "." && $dir_lang != ".." && $dir_lang != "CVS" && $dir_lang != ".svn" && is_dir($include_path . "/marc_tables/" . $dir_lang)) { $lang = $dir_lang; $marclist = new marc_list($tab_code_champ[$k][$nom_champ]['marctype']); $liste_mots = $marclist->table[$code]; $tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang, 'autorite' => $tab_row["subst_for_marc_" . $tab_code_champ[$k][$nom_champ]['marctype']]); } } $lang = $saved_lang; $liste_mots = ""; } if ($liste_mots != '') { $tab_tmp = array(); $liste_mots = strip_tags($liste_mots); if (!in_array($k, $tab_keep_empty)) { $tab_tmp = explode(' ', strip_empty_words($liste_mots)); } else { $tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots))); } // if($lang!="") $tab_tmp[]=$lang; //la table pour les recherche exacte if (!$tab_fields[$nom_champ]) { $tab_fields[$nom_champ] = array(); } if (!$tab_code_champ[$k][$nom_champ]['use_global_separator']) { $tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $langage, 'autorite' => $tab_row["subst_for_autorite_" . $tab_code_champ[$k][$nom_champ]['autorite']]); } else { $var_global_sep = $tab_code_champ[$k][$nom_champ]['use_global_separator']; global ${$var_global_sep}; $tab_liste_mots = explode(${$var_global_sep}, $liste_mots); if (count($tab_liste_mots)) { foreach ($tab_liste_mots as $mot) { $tab_fields[$nom_champ][] = array('value' => trim($mot), 'lang' => $langage, 'autorite' => $tab_row["subst_for_autorite_" . $tab_code_champ[$k][$nom_champ]['autorite']]); } } } if (!$tab_code_champ[$k][$nom_champ]['no_words']) { foreach ($tab_tmp as $mot) { if (trim($mot)) { $langageKey = $langage; if (!trim($langageKey)) { $langageKey = "empty"; } $tab_mots[$nom_champ][$langageKey][] = $mot; } } } } } } } foreach ($tab_mots as $nom_champ => $tab) { $memo_ss_champ = ""; $order_fields = 1; $pos = 1; foreach ($tab as $langage => $mots) { if ($langage == "empty") { $langage = ""; } foreach ($mots as $mot) { //on cherche le mot dans la table de mot... $num_word = 0; $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $langage . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $num_word = pmb_mysql_result($result, 0, 0); } else { $dmeta = new DoubleMetaPhone($mot); $stemming = new stemming($mot); $element_to_update = ""; if ($dmeta->primary || $dmeta->secondary) { $element_to_update .= "\n\t\t\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'"; } if ($element_to_update) { $element_to_update .= ","; } $element_to_update .= "stem = '" . $stemming->stem . "'"; $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : ""); pmb_mysql_query($query); $num_word = pmb_mysql_insert_id(); } if ($num_word != 0) { $tab_insert[] = "(" . $notice . "," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $num_word . "," . $tab_code_champ[$k][$nom_champ]['pond'] . ",{$order_fields},{$pos})"; $pos++; if ($tab_code_champ[$k][$nom_champ]['ss_champ'] != $memo_ss_champ) { $order_fields++; } $memo_ss_champ = $tab_code_champ[$k][$nom_champ]['ss_champ']; } } } } //la table pour les recherche exacte foreach ($tab_fields as $nom_champ => $tab) { foreach ($tab as $order => $values) { //$tab_field_insert[]="(".$notice.",".$tab_code_champ[$v["table"]][$nom_champ][0].",".$tab_code_champ[$v["table"]][$nom_champ][1].",".$order.",'".addslashes($values['value'])."','".addslashes($values['lang'])."',".$tab_code_champ[$v["table"]][$nom_champ][2].")"; $tab_field_insert[] = "(" . $notice . "," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . ($order + 1) . ",'" . addslashes($values['value']) . "','" . addslashes($values['lang']) . "'," . $tab_code_champ[$k][$nom_champ]['pond'] . ",'" . addslashes($values['autorite']) . "')"; } } } //Les champs perso if (count($tab_pp)) { foreach ($tab_pp as $code_champ => $table) { $p_perso = new parametres_perso($table); //on doit retrouver l'id des eléments... switch ($table) { case "expl": $rqt = "select expl_id from notices join exemplaires on expl_notice = notice_id and expl_notice!=0 where notice_id = {$notice} union select expl_id from notices join bulletins on num_notice = notice_id join exemplaires on expl_bulletin = bulletin_id and expl_bulletin != 0 where notice_id = {$notice}"; $res = pmb_mysql_query($rqt); if (pmb_mysql_num_rows($res)) { $ids = array(); while ($row = pmb_mysql_fetch_object($res)) { $ids[] = $row->expl_id; } } break; case "collstate": break; default: $ids = array($notice); } if (count($ids)) { for ($i = 0; $i < count($ids); $i++) { $data = $p_perso->get_fields_recherche_mot_array($ids[$i]); $j = 0; $order_fields = 1; foreach ($data as $code_ss_champ => $value) { $tab_mots = array(); foreach ($value as $val) { $tab_tmp = explode(' ', strip_empty_words($val)); //la table pour les recherche exacte $tab_field_insert[] = "(" . $notice . "," . $code_champ . "," . $code_ss_champ . "," . $j . ",'" . addslashes(trim($val)) . "',''," . $p_perso->get_pond($code_ss_champ) . ",0)"; $j++; foreach ($tab_tmp as $mot) { if (trim($mot)) { $tab_mots[$mot] = ""; } } } $pos = 1; foreach ($tab_mots as $mot => $langage) { $num_word = 0; //on cherche le mot dans la table de mot... $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $langage . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $num_word = pmb_mysql_result($result, 0, 0); } else { $dmeta = new DoubleMetaPhone($mot); $stemming = new stemming($mot); $element_to_update = ""; if ($dmeta->primary || $dmeta->secondary) { $element_to_update .= "\n\t\t\t\t\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'"; } if ($element_to_update) { $element_to_update .= ","; } $element_to_update .= "stem = '" . $stemming->stem . "'"; $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : ""); pmb_mysql_query($query); $num_word = pmb_mysql_insert_id(); } if ($num_word != 0) { $tab_insert[] = "(" . $notice . "," . $code_champ . "," . $code_ss_champ . "," . $num_word . "," . $p_perso->get_pond($code_ss_champ) . ",{$order_fields},{$pos})"; $pos++; } } $order_fields++; } } } } } //Les autorités perso if (count($tab_authperso)) { $order_fields = 1; $index_fields = $authpersos->get_index_fields($notice); foreach ($index_fields as $code_champ => $auth) { $code_champ += $authperso_code_champ_start; $tab_mots = array(); foreach ($auth['ss_champ'] as $ss_field) { foreach ($ss_field as $code_ss_champ => $val) { $tab_field_insert[] = "(" . $notice . "," . $code_champ . "," . $code_ss_champ . "," . $j . ",'" . addslashes(trim($val)) . "',''," . $auth['pond'] . ",0)"; $tab_tmp = explode(' ', strip_empty_words($val)); foreach ($tab_tmp as $mot) { if (trim($mot)) { $tab_mots[$mot] = ""; } } $pos = 1; foreach ($tab_mots as $mot => $langage) { $num_word = 0; //on cherche le mot dans la table de mot... $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $langage . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $num_word = pmb_mysql_result($result, 0, 0); } else { $dmeta = new DoubleMetaPhone($mot); $stemming = new stemming($mot); $element_to_update = ""; if ($dmeta->primary || $dmeta->secondary) { $element_to_update .= "\n\t\t\t\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'"; } if ($element_to_update) { $element_to_update .= ","; } $element_to_update .= "stem = '" . $stemming->stem . "'"; $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : ""); pmb_mysql_query($query); $num_word = pmb_mysql_insert_id(); } if ($num_word != 0) { $tab_insert[] = "(" . $notice . "," . $code_champ . "," . $code_ss_champ . "," . $num_word . "," . $auth['pond'] . ",{$order_fields},{$pos})"; $pos++; } } $order_fields++; } } } } if (count($isbd_ask_list)) { // Les isbd d'autorités foreach ($isbd_ask_list as $infos) { $isbd_s = array(); // cumul des isbd $res = pmb_mysql_query($infos["req"]) or die($infos["req"]); if (pmb_mysql_num_rows($res)) { switch ($infos["class_name"]) { case 'author': while ($row = pmb_mysql_fetch_object($res)) { $aut = new auteur($row->id_aut_for_isbd); $isbd_s[] = $aut->isbd_entry; } break; case 'editeur': while ($row = pmb_mysql_fetch_object($res)) { $aut = new editeur($row->id_aut_for_isbd); $isbd_s[] = $aut->isbd_entry; } break; case 'indexint': while ($row = pmb_mysql_fetch_object($res)) { $aut = new indexint($row->id_aut_for_isbd); $isbd_s[] = $aut->display; } break; case 'collection': while ($row = pmb_mysql_fetch_object($res)) { $aut = new collection($row->id_aut_for_isbd); $isbd_s[] = $aut->isbd_entry; } break; case 'subcollection': while ($row = pmb_mysql_fetch_object($res)) { $aut = new subcollection($row->id_aut_for_isbd); $isbd_s[] = $aut->isbd_entry; } break; case 'serie': while ($row = pmb_mysql_fetch_object($res)) { $aut = new serie($row->id_aut_for_isbd); $isbd_s[] = $aut->name; } break; case 'categories': while ($row = pmb_mysql_fetch_object($res)) { $aut = new categories($row->id_aut_for_isbd, $lang); $isbd_s[] = $aut->libelle_categorie; } break; case 'titre_uniforme': while ($row = pmb_mysql_fetch_object($res)) { $aut = new titre_uniforme($row->id_aut_for_isbd); $isbd_s[] = $aut->libelle; } break; } } $order_fields = 1; for ($i = 0; $i < count($isbd_s); $i++) { $tab_mots = array(); $tab_field_insert[] = "(" . $notice . "," . $infos["champ"] . "," . $infos["ss_champ"] . "," . $order_fields . ",'" . addslashes(trim($isbd_s[$i])) . "',''," . $infos["pond"] . ",0)"; $tab_tmp = explode(' ', strip_empty_words($isbd_s[$i])); foreach ($tab_tmp as $mot) { if (trim($mot)) { $tab_mots[$mot] = ""; } } $pos = 1; foreach ($tab_mots as $mot => $langage) { $num_word = 0; //on cherche le mot dans la table de mot... $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $langage . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $num_word = pmb_mysql_result($result, 0, 0); } else { $dmeta = new DoubleMetaPhone($mot); $stemming = new stemming($mot); $element_to_update = ""; if ($dmeta->primary || $dmeta->secondary) { $element_to_update .= "\n\t\t\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'"; } if ($element_to_update) { $element_to_update .= ","; } $element_to_update .= "stem = '" . $stemming->stem . "'"; $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : ""); pmb_mysql_query($query); $num_word = pmb_mysql_insert_id(); } if ($num_word != 0) { $tab_insert[] = "(" . $notice . "," . $infos["champ"] . "," . $infos["ss_champ"] . "," . $num_word . "," . $infos["pond"] . ",{$order_fields},{$pos})"; $pos++; } } $order_fields++; } } } if (count($tab_insert)) { $req_insert = "insert ignore into notices_mots_global_index(id_notice,code_champ,code_ss_champ,num_word,pond,position, field_position) values " . implode(',', $tab_insert); pmb_mysql_query($req_insert, $dbh); } if (count($tab_field_insert)) { //la table pour les recherche exacte $req_insert = "insert ignore into notices_fields_global_index(id_notice,code_champ,code_ss_champ,ordre,value,lang,pond,authority_num) values " . implode(',', $tab_field_insert); pmb_mysql_query($req_insert, $dbh); } } }
function fetch_data() { global $dbh; global $opac_map_activate; if (is_null($this->dom_2)) { $requete = "SELECT notice_id, typdoc, tit1, tit2, tit3, tit4, tparent_id, tnvol, ed1_id, ed2_id, coll_id, subcoll_id, year, nocoll, mention_edition,code, npages, ill, size, accomp, lien, eformat, index_l, indexint, niveau_biblio, niveau_hierar, origine_catalogage, prix, n_gen, n_contenu, n_resume, statut, thumbnail_url, opac_visible_bulletinage, opac_serialcirc_demande, notice_is_new "; $requete .= "FROM notices WHERE notice_id='" . $this->notice_id . "' "; } else { $requete = "SELECT notice_id, typdoc, tit1, tit2, tit3, tit4, tparent_id, tnvol, ed1_id, ed2_id, coll_id, subcoll_id, year, nocoll, mention_edition,code, npages, ill, size, accomp, lien, eformat, index_l, indexint, niveau_biblio, niveau_hierar, origine_catalogage, prix, n_gen, n_contenu, n_resume, thumbnail_url, opac_visible_bulletinage, opac_serialcirc_demande, notice_is_new "; $requete .= "FROM notices "; $requete .= "WHERE notice_id='" . $this->notice_id . "'"; } $myQuery = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($myQuery)) { $this->notice = pmb_mysql_fetch_object($myQuery); } else { $this->statut_notice = ""; $this->statut = 0; $this->visu_notice = 0; $this->visu_notice_abon = 0; $this->visu_expl = 0; $this->visu_expl_abon = 0; $this->visu_explnum = 0; $this->visu_explnum_abon = 0; $this->notice_id = 0; $this->opac_visible_bulletinage = 0; return 0; } if (!$this->notice->typdoc) { $this->notice->typdoc = 'a'; } if ($this->notice->tparent_id) { $requete_serie = "SELECT serie_name FROM series WHERE serie_id='" . $this->notice->tparent_id . "' "; $myQuery_serie = pmb_mysql_query($requete_serie, $dbh); if (pmb_mysql_num_rows($myQuery_serie)) { $serie = pmb_mysql_fetch_object($myQuery_serie); $this->notice->serie_name = $serie->serie_name; } } // serials : si article if ($this->notice->niveau_biblio == 'a' && $this->notice->niveau_hierar == 2) { $this->get_bul_info(); } if ($this->notice->niveau_biblio == 'b' && $this->notice->niveau_hierar == 2) { $this->get_bul_info(); } if (!$this->header_only) { $this->fetch_categories(); } $this->fetch_auteurs(); $this->fetch_titres_uniformes(); $this->fetch_visibilite(); if (!$this->header_only) { $this->fetch_langues(0); } if (!$this->header_only) { $this->fetch_langues(1); } if (!$this->header_only) { $this->fetch_avis(); } if (!$this->header_only) { $this->authperso_info = array(); $authperso = new authperso_notice($this->notice_id); $this->authperso_info = $authperso->get_info(); } $this->map = new stdClass(); $this->map_info = new stdClass(); if ($opac_map_activate) { $ids[] = $this->notice_id; $this->map = new map_objects_controler(TYPE_RECORD, $ids); $this->map_info = new map_info($this->notice_id); } $this->childs = array(); if (!$this->header_only) { if (is_null($this->dom_2)) { $acces_j = ''; $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)" : "") . ")"; } else { $acces_j = $this->dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id'); $statut_j = ""; $statut_r = ""; } if ($this->notice->niveau_biblio == 'b') { // notice de bulletins, les relations sont dans la table analysis $requete = "select analysis_notice as notice_id, 'd' as relation_type from analysis JOIN bulletins ON bulletin_id = analysis_bulletin, notices {$acces_j} {$statut_j} "; $requete .= "where num_notice={$this->notice_id} AND notice_id = analysis_notice {$statut_r} "; $requete .= "order by analysis_notice ASC"; } else { // autres notices $requete = "select num_notice as notice_id,relation_type from notices_relations join notices on num_notice=notice_id {$acces_j} {$statut_j} "; $requete .= "where linked_notice='" . $this->notice_id . "' {$statut_r} order by relation_type, rank"; } // on va pré-remplir les childs avec les parents dont le libellé de la relation en up ou down est le même. $this->get_parents_as_childs(); $resultat = pmb_mysql_query($requete); // il y a des enfants ? if (pmb_mysql_num_rows($resultat)) { while ($r = pmb_mysql_fetch_object($resultat)) { $this->childs[$r->relation_type][] = $r->notice_id; } } $this->do_parents(); } return pmb_mysql_num_rows($myQuery); }