Пример #1
0
 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 .= "&nbsp;/ {$libelle_mention_resp}";
     }
     // mention d'édition
     if ($this->notice->mention_edition) {
         $this->isbd .= ".&nbsp;-&nbsp;" . $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 .= '&nbsp;; ' . $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 .= ".&nbsp;-&nbsp;{$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 .= ".&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         if ($this->notice->nocoll) {
             $collections .= '; ' . $this->notice->nocoll;
         }
         $this->isbd .= ".&nbsp;-&nbsp;({$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 .= '.&nbsp;-&nbsp;ISBN ';
             } else {
                 $zoneNote = 'ISBN ';
             }
         } else {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;';
             }
         }
         $zoneNote .= $this->notice->code;
     }
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneNote .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneNote) {
                 $zoneNote .= '&nbsp; ' . $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'] . "&nbsp;</b>" . ($prefixe[1] ? $prefixe[1] : '') . $this->notice_id . "<br />";
     }
     // Permalink OPAC
     if ($pmb_show_permalink) {
         $this->isbd .= "<b>" . $msg["notice_permalink_opac"] . "&nbsp;</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>&nbsp;: ".nl2br(htmlentities($this->notice->n_resume,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[267]}</b>&nbsp;: " . nl2br($this->notice->n_resume);
     }
     // note de contenu
     if ($this->notice->n_contenu) {
         // $this->isbd .= "<br /><b>${msg[266]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_contenu,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[266]}</b>&nbsp;: " . 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>&nbsp;: " . construit_liste_langues($this->langues);
     }
     if (count($this->languesorg)) {
         $langues .= " <b>{$msg[711]}</b>&nbsp;: " . 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>&nbsp;: " . 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>&nbsp;: " . $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;
 }
Пример #2
0
 static function get_form_import($form_name, $ntu_data)
 {
     global $msg;
     $i = 0;
     do {
         $values[$i]["id"] = $ntu_data[$i]->num_tu;
         $values[$i]["label"] = $ntu_data[$i]->tu->name;
         $j = 0;
         $values[$i]["objets"][$j]["label"] = $msg["catal_titre_uniforme_titre_section"];
         $values[$i]["objets"][$j]["name"] = "ntu_titre";
         $values[$i]["objets"][$j]["class"] = "saisie-80em";
         $values[$i]["objets"][$j]["value"] = $ntu_data[$i]->titre;
         $j++;
         $values[$i]["objets"][$j]["label"] = $msg["catal_titre_uniforme_date"];
         $values[$i]["objets"][$j]["name"] = "ntu_date";
         $values[$i]["objets"][$j]["class"] = "saisie-80em";
         $values[$i]["objets"][$j]["value"] = $ntu_data[$i]->date;
         $j++;
         $values[$i]["objets"][$j]["label"] = $msg["catal_titre_uniforme_sous_vedette"];
         $values[$i]["objets"][$j]["name"] = "ntu_sous_vedette";
         $values[$i]["objets"][$j]["class"] = "saisie-80em";
         $values[$i]["objets"][$j]["value"] = $ntu_data[$i]->sous_vedette;
         $j++;
         $values[$i]["objets"][$j]["label"] = $msg["catal_titre_uniforme_langue"];
         $values[$i]["objets"][$j]["name"] = "ntu_langue";
         $values[$i]["objets"][$j]["class"] = "saisie-80em";
         $values[$i]["objets"][$j]["value"] = $ntu_data[$i]->langue;
         $j++;
         $values[$i]["objets"][$j]["label"] = $msg["catal_titre_uniforme_version"];
         $values[$i]["objets"][$j]["name"] = "ntu_version";
         $values[$i]["objets"][$j]["class"] = "saisie-80em";
         $values[$i]["objets"][$j]["value"] = $ntu_data[$i]->version;
         $j++;
         $values[$i]["objets"][$j]["label"] = $msg["catal_titre_uniforme_mention"];
         $values[$i]["objets"][$j]["name"] = "ntu_mention";
         $values[$i]["objets"][$j]["class"] = "saisie-80em";
         $values[$i]["objets"][$j]["value"] = $ntu_data[$i]->mention;
     } while (++$i < count($ntu_data));
     $ntu_form = tu_notice::gen_input_selection($msg["catal_onglet_titre_uniforme"], $form_name, "titre_uniforme", $values, "titre_uniforme", "saisie-80emr");
     return $ntu_form;
 }
Пример #3
0
 function get_form($action, $id_notice = 0, $retour = 'link', $article = false)
 {
     // construit le formulaire de catalogage pré-rempli
     global $msg, $dbh, $charset, $current_module;
     global $include_path;
     global $base_path;
     global $znotices_id;
     global $item;
     $fonction = new marc_list('function');
     $this->action = $action;
     include "{$include_path}/templates/z3950_form.tpl.php";
     global $bt_undo;
     // mise à jour de l'entête du formulaire
     $form_notice = str_replace('!!libelle_form!!', $this->libelle_form, $form_notice);
     // mise à jour des flags de niveau hiérarchique
     $form_notice = str_replace('!!b_level!!', $this->bibliographic_level, $form_notice);
     $form_notice = str_replace('!!h_level!!', $this->hierarchic_level, $form_notice);
     for ($i = 0; $i < 4; $i++) {
         z3950_notice::substitute("title_{$i}", $this->titles[$i], $ptab[0]);
     }
     z3950_notice::substitute("serie", $this->serie, $ptab[0]);
     z3950_notice::substitute("nbr_in_serie", $this->nbr_in_serie, $ptab[0]);
     $form_notice = str_replace('!!tab0!!', $ptab[0], $form_notice);
     // mise à jour de l'onglet 1
     // constitution de la mention de responsabilité
     $nb_autres_auteurs = 0;
     $nb_auteurs_secondaires = 0;
     //print "<pre>";print_r($this->aut_array);print "</pre>";
     for ($as = 0; $as < sizeof($this->aut_array); $as++) {
         if ($this->aut_array[$as]["responsabilite"] === 0) {
             $numrows = 0;
             if ($this->aut_array[$as]["date"]) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if (!$numrows) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if ($numrows == 1) {
                 $existing_author = pmb_mysql_fetch_array($res);
                 $existing_author_id = $existing_author["author_id"];
             } else {
                 $existing_author_id = 0;
             }
             z3950_notice::substitute("author0_type_use_existing", $existing_author_id ? "checked" : "", $ptab[1]);
             z3950_notice::substitute("author0_type_insert_new", $existing_author_id ? "" : "checked", $ptab[1]);
             if ($existing_author_id) {
                 z3950_notice::substitute("f_author_name_0_existing", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab[1]);
                 z3950_notice::substitute("f_aut0_existing_id", $existing_author_id, $ptab[1]);
             } else {
                 z3950_notice::substitute("f_author_name_0_existing", '', $ptab[1]);
                 z3950_notice::substitute("f_aut0_existing_id", 0, $ptab[1]);
             }
             z3950_notice::substitute("author_name_0", $this->aut_array[$as]["entree"], $ptab[1]);
             z3950_notice::substitute("author_rejete_0", $this->aut_array[$as]["rejete"], $ptab[1]);
             z3950_notice::substitute("author_date_0", $this->aut_array[$as]["date"], $ptab[1]);
             z3950_notice::substitute("author_function_0", $this->aut_array[$as]["fonction"], $ptab[1]);
             z3950_notice::substitute("author_function_label_0", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab[1]);
             z3950_notice::substitute("author_lieu_0", $this->aut_array[$as]["lieu"], $ptab[1]);
             z3950_notice::substitute("author_pays_0", $this->aut_array[$as]["pays"], $ptab[1]);
             z3950_notice::substitute("author_comment_0", $this->aut_array[$as]["author_comment"], $ptab[1]);
             z3950_notice::substitute("author_ville_0", $this->aut_array[$as]["ville"], $ptab[1]);
             z3950_notice::substitute("author_subdivision_0", $this->aut_array[$as]["subdivision"], $ptab[1]);
             z3950_notice::substitute("author_numero_0", $this->aut_array[$as]["numero"], $ptab[1]);
             z3950_notice::substitute("author_web_0", $this->aut_array[$as]["web"], $ptab[1]);
             z3950_notice::substitute("authority_number_0", $this->aut_array[$as]["authority_number"], $ptab[1]);
             for ($type = 70; $type <= 72; $type++) {
                 if ($this->aut_array[$as]["type_auteur"] == $type) {
                     $sel = " selected";
                 } else {
                     $sel = "";
                 }
                 z3950_notice::substitute("author_type_" . $type . "_0", $sel, $ptab[1]);
                 if ($this->aut_array[$as]["type_auteur"] == '70') {
                     z3950_notice::substitute('display_0', 'none', $ptab[1]);
                 } else {
                     z3950_notice::substitute('display_0', '', $ptab[1]);
                 }
             }
         }
         if ($this->aut_array[$as]["responsabilite"] == 1) {
             if ($this->aut_array[$as]["entree"] == "") {
                 continue;
             }
             $ptab_aut_autres = str_replace('!!iaut!!', $nb_autres_auteurs, $ptab[11]);
             $numrows = 0;
             if ($this->aut_array[$as]["date"]) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if (!$numrows) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if ($numrows == 1) {
                 $existing_author = pmb_mysql_fetch_array($res);
                 $existing_author_id = $existing_author["author_id"];
             } else {
                 $existing_author_id = 0;
             }
             z3950_notice::substitute("author1_type_use_existing_", $existing_author_id ? "checked" : "", $ptab_aut_autres);
             z3950_notice::substitute("author1_type_insert_new_", $existing_author_id ? "" : "checked", $ptab_aut_autres);
             if ($existing_author_id) {
                 z3950_notice::substitute("f_aut1", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab_aut_autres);
                 z3950_notice::substitute("f_aut1_id", $existing_author_id, $ptab_aut_autres);
             } else {
                 z3950_notice::substitute("f_aut1", '', $ptab_aut_autres);
                 z3950_notice::substitute("f_aut1_id", '', $ptab_aut_autres);
             }
             z3950_notice::substitute("author_name_1", $this->aut_array[$as]["entree"], $ptab_aut_autres);
             z3950_notice::substitute("author_rejete_1", $this->aut_array[$as]["rejete"], $ptab_aut_autres);
             z3950_notice::substitute("author_date_1", $this->aut_array[$as]["date"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_1", $this->aut_array[$as]["fonction"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_label_1", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab_aut_autres);
             z3950_notice::substitute("author_lieu_1", $this->aut_array[$as]["lieu"], $ptab_aut_autres);
             z3950_notice::substitute("author_pays_1", $this->aut_array[$as]["pays"], $ptab_aut_autres);
             z3950_notice::substitute("author_comment_1", $this->aut_array[$as]["author_comment"], $ptab_aut_autres);
             z3950_notice::substitute("author_ville_1", $this->aut_array[$as]["ville"], $ptab_aut_autres);
             z3950_notice::substitute("author_subdivision_1", $this->aut_array[$as]["subdivision"], $ptab_aut_autres);
             z3950_notice::substitute("author_numero_1", $this->aut_array[$as]["numero"], $ptab_aut_autres);
             z3950_notice::substitute("author_web_1", $this->aut_array[$as]["web"], $ptab_aut_autres);
             z3950_notice::substitute("authority_number_1", $this->aut_array[$as]["authority_number"], $ptab_aut_autres);
             for ($type = 70; $type <= 72; $type++) {
                 if ($this->aut_array[$as]["type_auteur"] == $type) {
                     $sel = " selected";
                 } else {
                     $sel = "";
                 }
                 z3950_notice::substitute("author_type_" . $type . "_1", $sel, $ptab_aut_autres);
                 if ($this->aut_array[$as]["type_auteur"] == '70') {
                     z3950_notice::substitute('display_1' . $nb_autres_auteurs, 'none', $ptab_aut_autres);
                 } else {
                     z3950_notice::substitute('display_1' . $nb_autres_auteurs, '', $ptab_aut_autres);
                 }
             }
             $autres_auteurs .= $ptab_aut_autres;
             $nb_autres_auteurs++;
         }
         if ($this->aut_array[$as]["responsabilite"] == 2) {
             if ($this->aut_array[$as]["entree"] == "") {
                 continue;
             }
             $ptab_aut_autres = str_replace('!!iaut!!', $nb_auteurs_secondaires, $ptab[12]);
             $numrows = 0;
             if ($this->aut_array[$as]["date"]) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if (!$numrows) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if ($numrows == 1) {
                 $existing_author = pmb_mysql_fetch_array($res);
                 $existing_author_id = $existing_author["author_id"];
             } else {
                 $existing_author_id = 0;
             }
             z3950_notice::substitute("author2_type_use_existing_", $existing_author_id ? "checked" : "", $ptab_aut_autres);
             z3950_notice::substitute("author2_type_insert_new_", $existing_author_id ? "" : "checked", $ptab_aut_autres);
             if ($existing_author_id) {
                 z3950_notice::substitute("f_aut2", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab_aut_autres);
                 z3950_notice::substitute("f_aut2_id", $existing_author_id, $ptab_aut_autres);
             } else {
                 z3950_notice::substitute("f_aut2", '', $ptab_aut_autres);
                 z3950_notice::substitute("f_aut2_id", 0, $ptab_aut_autres);
             }
             z3950_notice::substitute("author_name_2", $this->aut_array[$as]["entree"], $ptab_aut_autres);
             z3950_notice::substitute("author_rejete_2", $this->aut_array[$as]["rejete"], $ptab_aut_autres);
             z3950_notice::substitute("author_date_2", $this->aut_array[$as]["date"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_2", $this->aut_array[$as]["fonction"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_label_2", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab_aut_autres);
             z3950_notice::substitute("author_lieu_2", $this->aut_array[$as]["lieu"], $ptab_aut_autres);
             z3950_notice::substitute("author_pays_2", $this->aut_array[$as]["pays"], $ptab_aut_autres);
             z3950_notice::substitute("author_comment_2", $this->aut_array[$as]["author_comment"], $ptab_aut_autres);
             z3950_notice::substitute("author_ville_2", $this->aut_array[$as]["ville"], $ptab_aut_autres);
             z3950_notice::substitute("author_subdivision_2", $this->aut_array[$as]["subdivision"], $ptab_aut_autres);
             z3950_notice::substitute("author_numero_2", $this->aut_array[$as]["numero"], $ptab_aut_autres);
             z3950_notice::substitute("author_web_2", $this->aut_array[$as]["web"], $ptab_aut_autres);
             z3950_notice::substitute("authority_number_2", $this->aut_array[$as]["authority_number"], $ptab_aut_autres);
             for ($type = 70; $type <= 72; $type++) {
                 if ($this->aut_array[$as]["type_auteur"] == $type) {
                     $sel = " selected";
                 } else {
                     $sel = "";
                 }
                 z3950_notice::substitute("author_type_" . $type . "_2", $sel, $ptab_aut_autres);
                 if ($this->aut_array[$as]["type_auteur"] == '70') {
                     z3950_notice::substitute('display_2' . $nb_auteurs_secondaires, 'none', $ptab_aut_autres);
                 } else {
                     z3950_notice::substitute('display_2' . $nb_auteurs_secondaires, '', $ptab_aut_autres);
                 }
             }
             $auteurs_secondaires .= $ptab_aut_autres;
             $nb_auteurs_secondaires++;
         }
     }
     // au cas ou pas d'auteur principal : on fait le ménage dans le formulaire
     z3950_notice::substitute("author_name_0", "", $ptab[1]);
     z3950_notice::substitute("author_rejete_0", "", $ptab[1]);
     z3950_notice::substitute("author_date_0", "", $ptab[1]);
     z3950_notice::substitute("author_function_0", "", $ptab[1]);
     z3950_notice::substitute("author_function_label_0", "", $ptab[1]);
     z3950_notice::substitute("f_author_name_0_existing", "", $ptab[1]);
     z3950_notice::substitute("f_aut0_existing_id", "", $ptab[1]);
     z3950_notice::substitute("author0_type_use_existing", "", $ptab[1]);
     z3950_notice::substitute("author0_type_insert_new", "checked", $ptab[1]);
     z3950_notice::substitute("author_lieu_0", "", $ptab[1]);
     z3950_notice::substitute("author_pays_0", "", $ptab[1]);
     z3950_notice::substitute("author_comment_0", "", $ptab[1]);
     z3950_notice::substitute("author_ville_0", "", $ptab[1]);
     z3950_notice::substitute("author_subdivision_0", "", $ptab[1]);
     z3950_notice::substitute("author_numero_0", "", $ptab[1]);
     z3950_notice::substitute("author_web_0", "", $ptab[1]);
     z3950_notice::substitute("authority_number_0", "", $ptab[1]);
     z3950_notice::substitute('display_0', 'none', $ptab[1]);
     $ptab[1] = str_replace('!!max_aut1!!', $nb_autres_auteurs + 1, $ptab[1]);
     $ptab[1] = str_replace('!!iaut_added1!!', $nb_autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!max_aut2!!', $nb_auteurs_secondaires + 1, $ptab[1]);
     $ptab[1] = str_replace('!!iaut_added2!!', $nb_auteurs_secondaires, $ptab[1]);
     $ptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $ptab[1]);
     $form_notice = str_replace('!!tab1!!', $ptab[1], $form_notice);
     //Editeur 1
     //On tente avec toutes les infos
     if ($this->editors[0]['name'] && $this->editors[0]['ville']) {
         $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "' AND ed_ville = '" . addslashes($this->editors[0]['ville']) . "'";
         $res = pmb_mysql_query($sql_find_publisher);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher = pmb_mysql_fetch_array($res);
             $existing_publisher_id = $existing_publisher["ed_id"];
         }
     }
     //Non? Le nom sans ville peut être alors?
     if (!$existing_publisher_id && $this->editors[0]['name']) {
         $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "' AND ed_ville = ''";
         $res = pmb_mysql_query($sql_find_publisher);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher = pmb_mysql_fetch_array($res);
             $existing_publisher_id = $existing_publisher["ed_id"];
         }
     }
     //Juste le nom alors?
     if (!$existing_publisher_id && $this->editors[0]['name'] && !$this->editors[0]['ville']) {
         $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "'";
         $res = pmb_mysql_query($sql_find_publisher);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher = pmb_mysql_fetch_array($res);
             $existing_publisher_id = $existing_publisher["ed_id"];
         }
     }
     if (!$existing_publisher_id) {
         $existing_publisher_id = 0;
     }
     z3950_notice::substitute("editor_type_use_existing", $existing_publisher_id ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("editor_type_insert_new", $existing_publisher_id ? '' : 'checked', $ptab[2]);
     if ($existing_publisher_id) {
         $editor = new editeur($existing_publisher_id);
         $editor_display = $editor->display;
         if (!$editor_display) {
             $info_ville = $existing_publisher["ed_ville"] ? ' (' . $existing_publisher["ed_ville"] . ')' : "";
             $editor_display = $existing_publisher["ed_name"] . $info_ville;
         }
         z3950_notice::substitute("f_ed1", $editor_display, $ptab[2]);
         z3950_notice::substitute("f_ed1_id", $existing_publisher_id, $ptab[2]);
     } else {
         z3950_notice::substitute("f_ed1", '', $ptab[2]);
         z3950_notice::substitute("f_ed1_id", '', $ptab[2]);
     }
     z3950_notice::substitute("editor_name_0", $this->editors[0]['name'], $ptab[2]);
     z3950_notice::substitute("editor_ville_0", $this->editors[0]['ville'], $ptab[2]);
     //Editeur 2
     //On tente avec toutes les infos
     if ($this->editors[1]['name'] && $this->editors[1]['ville']) {
         $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "' AND ed_ville = '" . addslashes($this->editors[1]['ville']) . "'";
         $res = pmb_mysql_query($sql_find_publisher2);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher2 = pmb_mysql_fetch_array($res);
             $existing_publisher_id2 = $existing_publisher2["ed_id"];
         }
     }
     //Non? Le nom sans ville peut être alors?
     if (!$existing_publisher_id2 && $this->editors[1]['name']) {
         $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "' AND ed_ville = ''";
         $res = pmb_mysql_query($sql_find_publisher2);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher2 = pmb_mysql_fetch_array($res);
             $existing_publisher_id2 = $existing_publisher2["ed_id"];
         }
     }
     //Juste le nom alors?
     if (!$existing_publisher_id2 && $this->editors[1]['name'] && !$this->editors[1]['ville']) {
         $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "'";
         $res = pmb_mysql_query($sql_find_publisher2);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher2 = pmb_mysql_fetch_array($res);
             $existing_publisher_id2 = $existing_publisher2["ed_id"];
         }
     }
     if (!$existing_publisher_id2) {
         $existing_publisher_id2 = 0;
     }
     z3950_notice::substitute("editor1_type_use_existing", $existing_publisher_id2 ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("editor1_type_insert_new", $existing_publisher_id2 ? '' : 'checked', $ptab[2]);
     if ($existing_publisher_id2) {
         $editor = new editeur($existing_publisher_id2);
         $editor_display = $editor->display;
         if (!$editor_display) {
             $info_ville = $existing_publisher2["ed_ville"] ? ' (' . $existing_publisher2["ed_ville"] . ')' : "";
             $editor_display = $existing_publisher2["ed_name"] . $info_ville;
         }
         z3950_notice::substitute("f_ed11", $editor_display, $ptab[2]);
         z3950_notice::substitute("f_ed11_id", $existing_publisher_id2, $ptab[2]);
     } else {
         z3950_notice::substitute("f_ed11", '', $ptab[2]);
         z3950_notice::substitute("f_ed11_id", '', $ptab[2]);
     }
     z3950_notice::substitute("editor_name_1", $this->editors[1]['name'], $ptab[2]);
     z3950_notice::substitute("editor_ville_1", $this->editors[1]['ville'], $ptab[2]);
     //Collection
     if ($existing_publisher_id && $this->collection['name']) {
         $sql_collection_find = "SELECT collection_id, collection_name FROM collections WHERE collection_name = '" . addslashes($this->collection['name']) . "' AND collection_parent = '" . $existing_publisher_id . "'";
         $res = pmb_mysql_query($sql_collection_find);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_collection = pmb_mysql_fetch_array($res);
             $existing_collection_id = $existing_collection["collection_id"];
         } else {
             $existing_collection_id = 0;
         }
     } else {
         $existing_collection_id = 0;
     }
     z3950_notice::substitute("collection_type_use_existing", $existing_collection_id ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("collection_type_insert_new", $existing_collection_id ? '' : 'checked', $ptab[2]);
     if ($existing_collection_id) {
         z3950_notice::substitute("f_coll_existing", $existing_collection["collection_name"], $ptab[2]);
         z3950_notice::substitute("f_coll_existing_id", $existing_collection_id, $ptab[2]);
     } else {
         z3950_notice::substitute("f_coll_existing", '', $ptab[2]);
         z3950_notice::substitute("f_coll_existing_id", '0', $ptab[2]);
     }
     z3950_notice::substitute("collection_name", $this->collection['name'], $ptab[2]);
     z3950_notice::substitute("collection_issn", $this->collection['issn'], $ptab[2]);
     //Sous Collection
     if ($existing_collection_id && $this->subcollection['name']) {
         $sql_subcollection_find = "SELECT sub_coll_id, sub_coll_name FROM sub_collections WHERE sub_coll_name = '" . addslashes($this->subcollection['name']) . "' AND sub_coll_parent = '" . $existing_collection_id . "'";
         $res = pmb_mysql_query($sql_subcollection_find) or die(pmb_mysql_error() . "<br />{$sql_subcollection_find}");
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_subcollection = pmb_mysql_fetch_array($res);
             $existing_subcollection_id = $existing_subcollection["sub_coll_id"];
         } else {
             $existing_subcollection_id = 0;
         }
     } else {
         $existing_subcollection_id = 0;
     }
     z3950_notice::substitute("subcollection_type_use_existing", $existing_subcollection_id ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("subcollection_type_insert_new", $existing_subcollection_id ? '' : 'checked', $ptab[2]);
     if ($existing_subcollection_id) {
         z3950_notice::substitute("f_subcoll_existing", $existing_subcollection["sub_coll_name"], $ptab[2]);
         z3950_notice::substitute("f_subcoll_existing_id", $existing_subcollection_id, $ptab[2]);
     } else {
         z3950_notice::substitute("f_subcoll_existing", '', $ptab[2]);
         z3950_notice::substitute("f_subcoll_existing_id", '0', $ptab[2]);
     }
     z3950_notice::substitute("subcollection_name", $this->subcollection['name'], $ptab[2]);
     z3950_notice::substitute("subcollection_issn", $this->subcollection['issn'], $ptab[2]);
     z3950_notice::substitute("nbr_in_collection", $this->nbr_in_collection, $ptab[2]);
     z3950_notice::substitute("year", $this->year, $ptab[2]);
     z3950_notice::substitute("mention_edition", $this->mention_edition, $ptab[2]);
     $form_notice = str_replace('!!tab2!!', $ptab[2], $form_notice);
     z3950_notice::substitute("isbn", $this->isbn, $ptab[3]);
     $form_notice = str_replace('!!tab3!!', $ptab[3], $form_notice);
     z3950_notice::substitute("page_nbr", $this->page_nbr, $ptab[4]);
     z3950_notice::substitute("illustration", $this->illustration, $ptab[4]);
     z3950_notice::substitute("prix", $this->prix, $ptab[4]);
     z3950_notice::substitute("accompagnement", $this->accompagnement, $ptab[4]);
     z3950_notice::substitute("size", $this->size, $ptab[4]);
     $form_notice = str_replace('!!tab4!!', $ptab[4], $form_notice);
     z3950_notice::substitute("general_note", $this->general_note, $ptab[5]);
     z3950_notice::substitute("content_note", $this->content_note, $ptab[5]);
     z3950_notice::substitute("abstract_note", $this->abstract_note, $ptab[5]);
     $form_notice = str_replace('!!tab5!!', $ptab[5], $form_notice);
     // indexation interne
     $pclassement_sql = "SELECT * FROM pclassement";
     $res = pmb_mysql_query($pclassement_sql);
     $pclassement_count = pmb_mysql_num_rows($res);
     if (!$pclassement_count) {
         $pclassement_count = 1;
     }
     if ($pclassement_count > 1) {
         $pclassements = array();
         while ($row = pmb_mysql_fetch_assoc($res)) {
             $pclassements[] = array("id" => $row["id_pclass"], "name" => $row["name_pclass"]);
         }
         $pclassement_combobox = '<select name="f_indexint_new_pclass">';
         foreach ($pclassements as $pclassement) {
             $pclassement_combobox .= '<option value="' . $pclassement["id"] . '">' . $pclassement["name"] . '</option>';
         }
         $pclassement_combobox .= '</select>';
     } else {
         $pclassement_combobox = "";
     }
     $ptab[6] = str_replace("!!multiple_pclass_combo_box!!", $pclassement_combobox, $ptab[6]);
     $index_int_sql = "SELECT indexint_name, indexint_comment, indexint_id, name_pclass FROM indexint LEFT JOIN pclassement ON (pclassement.id_pclass = indexint.num_pclass) WHERE indexint_name = '" . addslashes($this->dewey[0]) . "'";
     $res = pmb_mysql_query($index_int_sql, $dbh);
     $num_rows = pmb_mysql_num_rows($res);
     if ($num_rows == 1) {
         $the_row = pmb_mysql_fetch_assoc($res);
         z3950_notice::substitute("indexint", $the_row["indexint_name"] . ': ' . $the_row["indexint_comment"], $ptab[6]);
         z3950_notice::substitute("indexint_id", $the_row["indexint_id"], $ptab[6]);
         z3950_notice::substitute("indexint_type_use_existing", 'checked', $ptab[6]);
         z3950_notice::substitute("indexint_type_insert_new", '', $ptab[6]);
         z3950_notice::substitute("multiple_index_int_propositions", '', $ptab[6]);
     } else {
         if ($num_rows > 1) {
             $index_ints = array();
             while ($row = pmb_mysql_fetch_assoc($res)) {
                 $index_ints[] = array("id" => $row["indexint_id"], "name" => $row["indexint_name"], "comment" => $row["indexint_comment"], "pclass" => $row["name_pclass"]);
             }
             $form_indexint_proposition = "<ul>";
             foreach ($index_ints as $index_int) {
                 $form_indexint_proposition .= "<li><b>[" . $index_int["pclass"] . "]</b> " . $index_int["name"] . ": " . $index_int["comment"] . '&nbsp;';
                 $jsaction = "document.getElementById('indexint_type_use_existing').checked=1; document.getElementById('f_indexint').value='" . addslashes($index_int["name"] . ' - ' . $index_int["comment"]) . "'; document.getElementById('f_indexint_id').value='" . addslashes($index_int["id"]) . "'";
                 $form_indexint_proposition .= '<input type="button" class="bouton" value="' . $msg["notice_integre_indexint_use"] . '" onclick="' . $jsaction . '">';
                 $form_indexint_proposition .= '</li>';
             }
             $form_indexint_proposition .= "</ul>";
             $ptab[6] = str_replace("!!multiple_index_int_propositions!!", $form_indexint_proposition, $ptab[6]);
             z3950_notice::substitute("indexint", "", $ptab[6]);
             z3950_notice::substitute("indexint_id", "", $ptab[6]);
             z3950_notice::substitute("indexint_type_use_existing", 'checked', $ptab[6]);
             z3950_notice::substitute("indexint_type_insert_new", '', $ptab[6]);
         } else {
             z3950_notice::substitute("indexint", "", $ptab[6]);
             z3950_notice::substitute("indexint_id", "", $ptab[6]);
             z3950_notice::substitute("indexint_type_use_existing", '', $ptab[6]);
             z3950_notice::substitute("indexint_type_insert_new", 'checked', $ptab[6]);
             z3950_notice::substitute("multiple_index_int_propositions", '', $ptab[6]);
         }
     }
     z3950_notice::substitute("indexint_new_name", $this->dewey[0], $ptab[6]);
     z3950_notice::substitute("indexint_new_comment", "", $ptab[6]);
     // indexation libre
     z3950_notice::substitute("f_free_index", $this->free_index, $ptab[6]);
     global $pmb_keyword_sep;
     $sep = "'{$pmb_keyword_sep}'";
     if (!$pmb_keyword_sep) {
         $sep = "' '";
     }
     if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) {
         $sep = $msg['catalogue_saut_de_ligne'];
     }
     $ptab[6] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $ptab[6]);
     $form_notice = str_replace('!!tab6!!', $ptab[6], $form_notice);
     // Gestion des titres uniformes
     $nb_tu = sizeof($this->tu_500);
     for ($i = 0; $i < $nb_tu; $i++) {
         $value_tu[$i]['name'] = $this->tu_500[$i]['a'];
         $ntu_data[$i]->tu->name = $this->tu_500[$i]['a'];
         $value_tu[$i]['tonalite'] = $this->tu_500[$i]['u'];
         for ($j = 0; $j < count($this->tu_500_r[$i]); $j++) {
             $value_tu[$i]['distrib'][$j] = $this->tu_500_r[$i][$j];
         }
         for ($j = 0; $j < count($this->tu_500_s[$i]); $j++) {
             $value_tu[$i]['ref'][$j] = $this->tu_500_s[$i][$j];
         }
         if ($tu_id = titre_uniforme::import_tu_exist($value_tu, 1)) {
             // 	le titre uniforme est déjà existant
             $ntu_data[$i]->num_tu = $tu_id;
         } else {
             // le titre uniforme n'est pas existant
             for ($j = 0; $j < count($this->tu_500_n[$i]); $j++) {
                 $value_tu[$i]['comment'] .= $this->tu_500_r[$i][$j];
                 if ($j + 1 < count($this->tu_500_n[$i])) {
                     $value_tu[$i]['comment'] .= "\n";
                 }
             }
             for ($j = 0; $j < count($this->tu_500_j[$i]); $j++) {
                 $value_tu[$i]['subdiv'][$j] = $this->tu_500_j[$i][$j];
             }
         }
         // memorisation du niveau biblio de ce titre uniforme
         for ($j = 0; $j < count($this->tu_500_i[$i]); $j++) {
             $ntu_data[$i]->titre .= $this->tu_500_i[$i][$j];
             if ($j + 1 < count($this->tu_500_i[$i])) {
                 $ntu_data[$i]->titre .= "; ";
             }
         }
         $ntu_data[$i]->date = $this->tu_500[$i]['k'];
         for ($j = 0; $j < count($this->tu_500_l[$i]); $j++) {
             $ntu_data[$i]->sous_vedette .= $this->tu_500_l[$i][$j];
             if ($j + 1 < count($this->tu_500_l[$i])) {
                 $ntu_data[$i]->sous_vedette .= "; ";
             }
         }
         $ntu_data[$i]->langue = $this->tu_500[$i]['m'];
         $ntu_data[$i]->version = $this->tu_500[$i]['q'];
         $ntu_data[$i]->mention = $this->tu_500[$i]['w'];
     }
     // serialisation des champs de l'autorité titre uniforme
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         $memo_value_tu = "<input type='hidden' name='memo_value_tu' value=\"" . rawurlencode(serialize($value_tu)) . "\">";
         $ptab[230] = str_replace("!!titres_uniformes!!", $memo_value_tu . tu_notice::get_form_import("notice", $ntu_data), $ptab[230]);
         $form_notice = str_replace('!!tab230!!', $ptab[230], $form_notice);
     }
     // mise à jour de l'onglet 7 : langues
     // langues répétables
     $lang = new marc_list('lang');
     if (sizeof($this->language_code) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->language_code);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[701]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[70]);
         }
         if (sizeof($this->language_code) == 0) {
             $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!lang_code!!', $this->language_code[$i], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($lang->table[$this->language_code[$i]], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_lang!!', $max_lang, $ptab[7]);
     $ptab[7] = str_replace('!!langues_repetables!!', $lang_repetables, $ptab[7]);
     // langues originales répétables
     if (sizeof($this->original_language_code) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->original_language_code);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[711]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[71]);
         }
         if (sizeof($this->original_language_code) == 0) {
             $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!langorg_code!!', $this->original_language_code[$i], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($lang->table[$this->original_language_code[$i]], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_langorg!!', $max_langorg, $ptab[7]);
     $ptab[7] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $ptab[7]);
     $form_notice = str_replace('!!tab7!!', $ptab[7], $form_notice);
     z3950_notice::substitute("link_url", $this->link_url, $ptab[8]);
     z3950_notice::substitute("link_format", $this->link_format, $ptab[8]);
     $form_notice = str_replace('!!tab8!!', $ptab[8], $form_notice);
     // définition de la page cible du form
     $form_notice = str_replace('!!action!!', $this->action, $form_notice);
     // ajout des selecteurs
     $select_doc = new marc_select('doctype', 'typdoc', $this->document_type);
     $form_notice = str_replace('!!document_type!!', $select_doc->display, $form_notice);
     if ($article) {
         $form_notice = str_replace('!!checked_mono!!', "", $form_notice);
         $form_notice = str_replace('!!checked_perio!!', "", $form_notice);
         $form_notice = str_replace('!!checked_art!!', "selected=\"selected\"", $form_notice);
     } else {
         if ($this->bibliographic_level == 's') {
             $form_notice = str_replace('!!checked_mono!!', "", $form_notice);
             $form_notice = str_replace('!!checked_perio!!', "selected=\"selected\"", $form_notice);
             $form_notice = str_replace('!!checked_art!!', "", $form_notice);
         } else {
             $form_notice = str_replace('!!checked_mono!!', "selected=\"selected\"", $form_notice);
             $form_notice = str_replace('!!checked_perio!!', "", $form_notice);
             $form_notice = str_replace('!!checked_art!!', "", $form_notice);
         }
     }
     //Zone des perios et des bulletins pour les articles
     $zone_article_form = str_replace("!!perio_titre!!", $this->perio_titre[0], $zone_article_form);
     $zone_article_form = str_replace("!!perio_issn!!", $this->perio_issn[0], $zone_article_form);
     $zone_article_form = str_replace("!!bull_date!!", $this->bull_mention[0], $zone_article_form);
     $zone_article_form = str_replace("!!bull_titre!!", $this->bull_titre[0], $zone_article_form);
     $zone_article_form = str_replace("!!bull_num!!", $this->bull_num[0], $zone_article_form);
     if ($this->bull_date[0]) {
         $date_date_formatee = formatdate_input($this->bull_date[0]);
         $date_date_hid = $this->bull_date[0];
     } else {
         $date_date_formatee = '';
         $date_date_hid = '';
     }
     $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=notice&date_caller=&param1=f_bull_new_date&param2=date_date_lib&auto_submit=NO&date_anterieure=YES', 'date_date', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
     $date_date = "<input type='hidden' id='f_bull_new_date' name='f_bull_new_date' value='{$date_date_hid}' />\n\t\t\t<input class='saisie-10em' type='text' name='date_date_lib' value='" . $date_date_formatee . "' placeholder='" . $msg["format_date_input_placeholder"] . "' />\n\t\t\t<input class='bouton' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
     $zone_article_form = str_replace("!!date_date!!", $date_date, $zone_article_form);
     //On cherche si le perio existe
     if ($this->perio_titre[0] && $this->perio_issn[0]) {
         $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\tand tit1='" . addslashes($this->perio_titre[0]) . "'\n\t\t\t\t\tand code='" . addslashes($this->perio_issn[0]) . "' limit 1";
         $res_perio = pmb_mysql_query($req, $dbh);
         $num_rows_perio = pmb_mysql_num_rows($res_perio);
     }
     if (!$num_rows_perio) {
         if ($this->perio_titre[0]) {
             $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\tand tit1='" . addslashes($this->perio_titre[0]) . "'\n\t\t\t\t\tlimit 1";
             $res_perio = pmb_mysql_query($req, $dbh);
             $num_rows_perio = pmb_mysql_num_rows($res_perio);
         }
     }
     if (!$num_rows_perio) {
         if ($this->perio_issn[0]) {
             $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\t\tand code='" . addslashes($this->perio_issn[0]) . "' limit 1";
             $res_perio = pmb_mysql_query($req, $dbh);
             $num_rows_perio = pmb_mysql_num_rows($res_perio);
         }
     }
     if ($num_rows_perio == 1) {
         $perio_found = pmb_mysql_fetch_object($res_perio);
         $idperio = $perio_found->notice_id;
         $zone_article_form = str_replace("!!f_perio_existing!!", htmlentities($perio_found->tit1, ENT_QUOTES, $charset), $zone_article_form);
         $zone_article_form = str_replace("!!f_perio_existing_id!!", $perio_found->notice_id, $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_new!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_use_existing!!", "checked", $zone_article_form);
     } else {
         $idperio = 0;
         $zone_article_form = str_replace("!!f_perio_existing!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!f_perio_existing_id!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_new!!", "checked", $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_use_existing!!", "", $zone_article_form);
     }
     //On cherche si le bulletin existe
     $num_rows_bull = 0;
     if ($this->bull_num[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and  bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     }
     if (!$num_rows_bull && $this->bull_date[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     } elseif ($num_rows_bull > 1 && $this->bull_date[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' and  bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     }
     if (!$num_rows_bull && $this->bull_mention[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     } elseif ($num_rows_bull > 1 && $this->bull_mention[0] && $idperio) {
         if ($this->bull_date[0]) {
             $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' ";
         } else {
             $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' and  bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' ";
         }
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     }
     if ($num_rows_bull) {
         $bull_found = pmb_mysql_fetch_object($res_bull);
         $f_bull_existing = trim($bull_found->bulletin_numero);
         if (!$f_bull_existing && trim($bull_found->date_date)) {
             $f_bull_existing = "[" . trim($bull_found->date_date) . "]";
         } elseif (!$f_bull_existing && trim($bull_found->mention_date)) {
             $f_bull_existing = "(" . trim($bull_found->mention_date) . ")";
         }
         $zone_article_form = str_replace("!!f_bull_existing!!", htmlentities($f_bull_existing, ENT_QUOTES, $charset), $zone_article_form);
         $zone_article_form = str_replace("!!f_bull_existing_id!!", $bull_found->bulletin_id, $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_new!!", $num_rows_bull ? '' : "checked='checked'", $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_use_existing!!", $num_rows_bull ? "checked='checked'" : '', $zone_article_form);
     } else {
         $zone_article_form = str_replace("!!f_bull_existing!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!f_bull_existing_id!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_new!!", "checked='checked'", $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_use_existing!!", "", $zone_article_form);
     }
     $form_notice = str_replace("!!zone_article!!", $zone_article_form, $form_notice);
     if ($article) {
         $form_notice = str_replace("!!display_zone_article!!", "", $form_notice);
     } else {
         $form_notice = str_replace("!!display_zone_article!!", "none", $form_notice);
     }
     if ($item) {
         $form_notice = str_replace('!!notice_entrepot!!', "<input type='hidden' name='item' value='{$item}' />", $form_notice);
     } else {
         $form_notice = str_replace('!!notice_entrepot!!', "", $form_notice);
     }
     $form_notice = str_replace('!!orinot_nom!!', $this->origine_notice[nom], $form_notice);
     $form_notice = str_replace('!!orinot_pays!!', $this->origine_notice[pays], $form_notice);
     //Traitement du 503 "titre de forme" pour le Musée des beaux arts de Nantes
     global $tableau_503;
     $tableau_503 = array("info_503" => $this->info_503, "info_503_d" => $this->info_503_d, "info_503_j" => $this->info_503_j);
     // traitement des catégories : affichage dans le formulaire
     $tableau_600 = array("info_600_3" => $this->info_600_3, "info_600_a" => $this->info_600_a, "info_600_b" => $this->info_600_b, "info_600_c" => $this->info_600_c, "info_600_d" => $this->info_600_d, "info_600_f" => $this->info_600_f, "info_600_g" => $this->info_600_g, "info_600_j" => $this->info_600_j, "info_600_p" => $this->info_600_p, "info_600_t" => $this->info_600_t, "info_600_x" => $this->info_600_x, "info_600_y" => $this->info_600_y, "info_600_z" => $this->info_600_z);
     $tableau_601 = array("info_601_3" => $this->info_601_3, "info_601_a" => $this->info_601_a, "info_601_b" => $this->info_601_b, "info_601_c" => $this->info_601_c, "info_601_d" => $this->info_601_d, "info_601_e" => $this->info_601_e, "info_601_f" => $this->info_601_f, "info_601_g" => $this->info_601_g, "info_601_h" => $this->info_601_h, "info_601_j" => $this->info_601_j, "info_601_t" => $this->info_601_t, "info_601_x" => $this->info_601_x, "info_601_y" => $this->info_601_y, "info_601_z" => $this->info_601_z);
     $tableau_602 = array("info_602_3" => $this->info_602_3, "info_602_a" => $this->info_602_a, "info_602_f" => $this->info_602_f, "info_602_j" => $this->info_602_j, "info_602_t" => $this->info_602_t, "info_602_x" => $this->info_602_x, "info_602_y" => $this->info_602_y, "info_602_z" => $this->info_602_z);
     $tableau_604 = array("info_604_3" => $this->info_604_3, "info_604_a" => $this->info_604_a, "info_604_h" => $this->info_604_h, "info_604_i" => $this->info_604_i, "info_604_j" => $this->info_604_j, "info_604_k" => $this->info_604_k, "info_604_l" => $this->info_604_l, "info_604_x" => $this->info_604_x, "info_604_y" => $this->info_604_y, "info_604_z" => $this->info_604_z);
     $tableau_605 = array("info_605_3" => $this->info_605_3, "info_605_a" => $this->info_605_a, "info_605_h" => $this->info_605_h, "info_605_i" => $this->info_605_i, "info_605_k" => $this->info_605_k, "info_605_l" => $this->info_605_l, "info_605_m" => $this->info_605_m, "info_605_n" => $this->info_605_n, "info_605_q" => $this->info_605_q, "info_605_r" => $this->info_605_r, "info_605_s" => $this->info_605_s, "info_605_u" => $this->info_605_u, "info_605_w" => $this->info_605_w, "info_605_j" => $this->info_605_j, "info_605_x" => $this->info_605_x, "info_605_y" => $this->info_605_y, "info_605_z" => $this->info_605_z);
     $tableau_606 = array("info_606_3" => $this->info_606_3, "info_606_a" => $this->info_606_a, "info_606_j" => $this->info_606_j, "info_606_x" => $this->info_606_x, "info_606_y" => $this->info_606_y, "info_606_z" => $this->info_606_z);
     $tableau_607 = array("info_607_3" => $this->info_607_3, "info_607_a" => $this->info_607_a, "info_607_j" => $this->info_607_j, "info_607_x" => $this->info_607_x, "info_607_y" => $this->info_607_y, "info_607_z" => $this->info_607_z);
     $tableau_608 = array("info_608_3" => $this->info_608_3, "info_608_a" => $this->info_608_a, "info_608_j" => $this->info_608_j, "info_608_x" => $this->info_608_x, "info_608_y" => $this->info_608_y, "info_608_z" => $this->info_608_z);
     // catégories
     $max_categ = 1;
     $ptab_categ = str_replace('!!icateg!!', 0, $ptab[60]);
     $ptab_categ = str_replace('!!categ_id!!', 0, $ptab_categ);
     $ptab_categ = str_replace('!!categ_libelle!!', '', $ptab_categ);
     $ptab[6] = str_replace("!!categories_repetables!!", $ptab_categ, $ptab[6]);
     $ptab[6] = str_replace('!!tab_categ_order!!', "", $ptab[6]);
     $traitement_rameau = traite_categories_for_form($tableau_600, $tableau_601, $tableau_602, $tableau_605, $tableau_606, $tableau_607, $tableau_608);
     if (!is_array($traitement_rameau)) {
         $traitement_rameau = array("form" => $traitement_rameau, "message" => "");
     }
     $form_notice = str_replace('!!message_rameau!!', $traitement_rameau["message"], $form_notice);
     $form_notice = str_replace('!!traitement_rameau!!', $traitement_rameau["form"], $form_notice);
     $manual_categorisation_form = get_manual_categorisation_form($tableau_600, $tableau_601, $tableau_602, $tableau_604, $tableau_605, $tableau_606, $tableau_607, $tableau_608);
     $form_notice = str_replace('!!manual_categorisation!!', $manual_categorisation_form, $form_notice);
     //Mise à jour de l'onglet 9
     $p_perso = new parametres_perso("notices");
     if (function_exists("param_perso_form")) {
         param_perso_form($p_perso);
     }
     //pour Pubmed et DOI, on regarde si on peut remplir un champ résolveur...
     if (count($this->others_ids) > 0) {
         foreach ($p_perso->t_fields as $key => $t_field) {
             if ($t_field['TYPE'] == "resolve") {
                 $field_options = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $t_field['OPTIONS'], "OPTIONS");
                 foreach ($field_options['RESOLVE'] as $resolve) {
                     //pubmed = 1 | DOI = 2
                     foreach ($this->others_ids as $other_id) {
                         if ($other_id['b'] == "PMID" && $resolve['ID'] == "1") {
                             //on a le champ perso résolveur PubMed
                             $p_perso->values[$key][] = $other_id['a'] . "|1";
                         } else {
                             if ($other_id['b'] == "DOI" && $resolve['ID'] == "2") {
                                 //on a le champ perso résolveur DOI
                                 $p_perso->values[$key][] = $other_id['a'] . "|2";
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_editable_fields($id_notice, true);
         $perso = "";
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div class='row'>\n\t\t\t\t\t<label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t" . $p["AFF"] . "\n\t\t\t\t\t</div>\n\t\t\t\t\t";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $ptab[9] = str_replace("!!champs_perso!!", $perso, $ptab[9]);
     } else {
         $ptab[9] = "\n<script type='text/javascript' >function check_form() { return true; }</script>\n";
     }
     $form_notice = str_replace('!!tab9!!', $ptab[9], $form_notice);
     // champs de gestion
     global $pmb_notice_img_folder_id;
     $message_folder = "";
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             if (!is_dir($rep->repertoire_path)) {
                 $notice_img_folder_error = 1;
             }
         } else {
             $notice_img_folder_error = 1;
         }
         if ($notice_img_folder_error) {
             if (SESSrights & ADMINISTRATION_AUTH) {
                 $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' ";
                 $res = pmb_mysql_query($requete);
                 $i = 0;
                 if ($param = pmb_mysql_fetch_object($res)) {
                     $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> ";
                 }
             } else {
                 $message_folder = $msg['notice_img_folder_no_access'];
             }
         }
     }
     $ptab[10] = str_replace('!!message_folder!!', $message_folder, $ptab[10]);
     // langue de la notice
     global $lang, $xmlta_indexation_lang;
     $user_lang = $this->indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     //	if(!$user_lang) $user_lang="fr_FR";
     $langues = new XMLlist("{$include_path}/messages/languages.xml");
     $langues->analyser();
     $clang = $langues->table;
     $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >";
     if (!$user_lang) {
         $combo .= "<option value='' selected>--</option>";
     } else {
         $combo .= "<option value='' >--</option>";
     }
     while (list($cle, $value) = each($clang)) {
         // arabe seulement si on est en utf-8
         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
             if (strcmp($cle, $user_lang) != 0) {
                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
             } else {
                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
             }
         }
     }
     $combo .= "</select>";
     $ptab[10] = str_replace('!!indexation_lang!!', $combo, $ptab[10]);
     $form_notice = str_replace('!!indexation_lang_sel!!', $user_lang, $form_notice);
     global $deflt_integration_notice_statut;
     if ($id_notice) {
         $rqt_statut = "select statut from notices where notice_id='{$id_notice}' ";
         $res_statut = pmb_mysql_query($rqt_statut);
         $stat = pmb_mysql_fetch_object($res_statut);
         $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $stat->statut, "", "", "", "", 0);
     } else {
         $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $deflt_integration_notice_statut, "", "", "", "", 0);
     }
     $ptab[10] = str_replace('!!notice_statut!!', $select_statut, $ptab[10]);
     $ptab[10] = str_replace('!!commentaire_gestion!!', htmlentities($this->commentaire_gestion, ENT_QUOTES, $charset), $ptab[10]);
     $ptab[10] = str_replace('!!thumbnail_url!!', htmlentities($this->thumbnail_url, ENT_QUOTES, $charset), $ptab[10]);
     $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice);
     // Documents Numériques
     $docnum_infos = "";
     $count = 0;
     $upload_doc_num = "";
     if ($this->source_id) {
         $requete = "select * from connectors_sources where source_id=" . $this->source_id . "";
         $resultat = pmb_mysql_query($requete);
         if (pmb_mysql_num_rows($resultat)) {
             $r = pmb_mysql_fetch_object($resultat);
             if (!$r->upload_doc_num) {
                 $upload_doc_num = "checked";
             }
         }
     }
     if (count($this->doc_nums)) {
         global $deflt_explnum_statut;
         $statutlist = gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "doc_num_statut!!docnumid!!", "", $deflt_explnum_statut, "", "", "", "", 0);
         foreach ($this->doc_nums as $doc_num) {
             $docnum_info = $ptab[1111];
             // 				$alink = '<a target="_blank" href="'.htmlspecialchars($doc_num["a"]).'">'.htmlspecialchars($doc_num["a"]).'</a>';
             $docnum_info = str_replace('!!docnum_url!!', htmlspecialchars($doc_num["a"], ENT_QUOTES, $charset), $docnum_info);
             $docnum_info = str_replace('!!docnum_caption!!', htmlspecialchars($doc_num["b"], ENT_QUOTES, $charset), $docnum_info);
             $docnum_info = str_replace('!!docnum_filename!!', htmlspecialchars($doc_num["f"], ENT_QUOTES, $charset), $docnum_info);
             $docnum_info = str_replace('!!docnum_statutlist!!', $statutlist, $docnum_info);
             $docnum_info = str_replace('!!docnumid!!', $count, $docnum_info);
             $docnum_info = str_replace('!!upload_doc_num!!', $upload_doc_num, $docnum_info);
             $docnum_infos .= $docnum_info;
             $count++;
         }
     }
     if (!$docnum_infos) {
         $docnum_infos = $msg["noticeintegre_nodocnum"];
     }
     $ptab[1110] = str_replace('!!docnum_count!!', $count, $ptab[1110]);
     $ptab[1110] = str_replace('!!docnums!!', $docnum_infos, $ptab[1110]);
     $form_notice = str_replace('!!tab11!!', $ptab[1110], $form_notice);
     $aac = explode('&', $action);
     $retact = '&' . $aac[2] . '&' . $aac[5] . '&' . $aac[6];
     global $force;
     $retares = '';
     switch ($retour) {
         case 'button':
             if ($this->message_retour) {
                 $retares = "<input type='button' class='bouton' onclick='history.go(-1);' value='" . $this->message_retour . "' />";
             } else {
                 if ($force == 1) {
                     $retares = "<a href='javascript:history.go(-2);'>" . $msg['z3950_retour_a_resultats'] . "</a>";
                 } else {
                     $retares = "<a href='javascript:history.go(-1);'>" . $msg['z3950_retour_a_resultats'] . "</a>";
                 }
             }
             break;
         case 'link':
             $retares = "<a href='./catalog.php?categ=z3950&action=display" . $retact . "'>" . $msg['z3950_retour_a_resultats'] . "</a>";
             break;
         default:
             break;
     }
     $form_notice = str_replace('!!retour_a_resultats!!', $retares, $form_notice);
     if (!$this->bt_integr_value) {
         if (!$id_notice) {
             $form_notice = str_replace('!!bouton_integration!!', $msg['z3950_integr_not_seule'], $form_notice);
         } else {
             $form_notice = str_replace('!!bouton_integration!!', $msg['notice_z3950_remplace_catal'], $form_notice);
         }
     } else {
         $form_notice = str_replace('!!bouton_integration!!', $this->bt_integr_value, $form_notice);
     }
     if ($this->bt_undo_value && $this->bt_undo_action) {
         $bt_undo = str_replace('!!value!!', $this->bt_undo_value, $bt_undo);
         $bt_undo = str_replace('!!action!!', $this->bt_undo_action, $bt_undo);
         $form_notice = str_replace('<!-- bt_undo -->', $bt_undo, $form_notice);
     }
     $form_notice = str_replace('!!id_notice!!', $id_notice, $form_notice);
     $form_notice = str_replace('!!notice!!', $znotices_id, $form_notice);
     $form_notice = str_replace('!!notice_type!!', $this->notice_type, $form_notice);
     return $form_notice;
 }
Пример #4
0
                     imagepng($dest, $filename_output);
                     imagedestroy($dest);
                 } else {
                     imagepng($img, $filename_output);
                 }
                 imagedestroy($img);
                 $thumbnail_url = $opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $id;
                 $req = "update notices set  thumbnail_url='" . $thumbnail_url . "' where notice_id ='" . $id . "'";
                 $res = pmb_mysql_query($req, $dbh);
             }
         }
     }
 }
 // Traitement des titres uniformes
 if ($pmb_use_uniform_title) {
     $ntu = new tu_notice($id);
     $ntu->update($titres_uniformes);
 }
 //traitement des droits acces user_notice
 if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
     if ($sav_id) {
         $dom_1->storeUserRights(1, $id, $res_prf, $chk_rights, $prf_rad, $r_rad);
     } else {
         $dom_1->storeUserRights(0, $id, $res_prf, $chk_rights, $prf_rad, $r_rad);
     }
 }
 //traitement des droits acces empr_notice
 if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
     $dom_2 = $ac->setDomain(2);
     if ($sav_id) {
         $dom_2->storeUserRights(1, $id, $res_prf, $chk_rights, $prf_rad, $r_rad);
Пример #5
0
 static function getAutomaticTu($notice)
 {
     global $dbh, $charset, $opac_enrichment_bnf_sparql;
     if (!$opac_enrichment_bnf_sparql) {
         return 0;
     }
     $requete = "select code, responsability_author from notices left join responsability on (responsability_notice={$notice} and responsability_type=0)\n\t\t\tleft join notices_titres_uniformes on notice_id=ntu_num_notice where notice_id={$notice} and ntu_num_notice is null";
     $resultat = pmb_mysql_query($requete, $dbh);
     if (pmb_mysql_num_rows($resultat, $dbh)) {
         $code = pmb_mysql_result($resultat, 0, 0, $dbh);
         $id_author = pmb_mysql_result($resultat, 0, 1, $dbh);
     } else {
         $code = "";
     }
     $id_tu = 0;
     if (isISBN($code)) {
         $uri = titre_uniforme::get_data_bnf_uri($code);
         if ($uri) {
             //Recherche du titre uniforme déjà existant ?
             $requete = "select tu_id from titres_uniformes where tu_databnf_uri='" . addslashes($uri) . "'";
             $resultat = pmb_mysql_query($requete, $dbh);
             if (pmb_mysql_num_rows($resultat, $dbh)) {
                 $id_tu = pmb_mysql_result($resultat, 0, 0, $dbh);
             } else {
                 //Interrogation de data.bnf pour obtenir les infos !
                 $configbnf = array('remote_store_endpoint' => 'http://data.bnf.fr/sparql');
                 $storebnf = ARC2::getRemoteStore($configbnf);
                 $sparql = "\n\t\t\t\t\t\tPREFIX dc: <http://purl.org/dc/terms/>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tSELECT ?title ?date ?description WHERE {\n\t\t\t\t\t\t  <" . $uri . "> dc:title ?title.\n\t\t\t\t\t\t  OPTIONAL { <" . $uri . "> dc:date ?date. }\n\t\t\t\t\t\t  OPTIONAL { <" . $uri . "> dc:description ?description. }\n\t\t\t\t\t\t}";
                 $rows = $storebnf->query($sparql, 'rows');
                 // On vérifie qu'il n'y a pas d'erreur sinon on stoppe le programme et on renvoi une chaine vide
                 $err = $storebnf->getErrors();
                 if (!$err) {
                     $value = array("name" => encoding_normalize::charset_normalize($rows[0]['title'], "utf-8"), "num_author" => $id_author, "date" => encoding_normalize::charset_normalize($rows[0]['date'], "utf-8"), "comment" => encoding_normalize::charset_normalize($rows[0]['description'], "utf-8"), "databnf_uri" => $uri);
                     $id_tu = titre_uniforme::import($value);
                 }
             }
         }
     }
     if ($id_tu) {
         $titres_uniformes = array(array("num_tu" => $id_tu));
         $ntu = new tu_notice($notice);
         $ntu->update($titres_uniformes);
     }
     return $id_tu;
 }
Пример #6
0
 function show_form()
 {
     global $msg;
     global $charset;
     global $lang;
     global $include_path, $class_path;
     global $current_module;
     global $pmb_type_audit, $select_categ_prop, $z3950_accessible;
     global $value_deflt_fonction, $value_deflt_relation;
     global $thesaurus_mode_pmb;
     global $PMBuserid, $pmb_form_editables, $thesaurus_classement_mode_pmb;
     global $xmlta_indexation_lang;
     include "{$include_path}/templates/catal_form.tpl.php";
     $fonction = new marc_list('function');
     // mise a jour de l'action en fonction de l'id
     $this->action .= $this->id;
     // mise a jour de l'en-tete du formulaire
     if ($this->notice_mere[0]) {
         $this->libelle_form .= " " . $msg["catalog_notice_fille_lib"] . " " . substr($this->notice_mere[0], 0, 100) . (count($this->notice_mere) > 1 ? ", ..." : "");
     }
     $form_notice = str_replace('!!libelle_form!!', $this->libelle_form, $form_notice);
     // mise a jour des flags de niveau hierarchique
     $form_notice = str_replace('!!b_level!!', $this->biblio_level, $form_notice);
     $form_notice = str_replace('!!h_level!!', $this->hierar_level, $form_notice);
     // mise a jour de l'onglet 0
     $ptab[0] = str_replace('!!tit1!!', htmlentities($this->tit1, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tit2!!', htmlentities($this->tit2, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tit3!!', htmlentities($this->tit3, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tit4!!', htmlentities($this->tit4, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tparent_id!!', $this->tparent_id, $ptab[0]);
     $ptab[0] = str_replace('!!tparent!!', htmlentities($this->tparent, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tnvol!!', htmlentities($this->tnvol, ENT_QUOTES, $charset), $ptab[0]);
     $form_notice = str_replace('!!tab0!!', $ptab[0], $form_notice);
     // mise a jour de l'onglet 1
     // constitution de la mention de responsabilite
     //$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 ($value_deflt_fonction && $auteur_0["id"] == 0) {
         $auteur_0["fonction"] = $value_deflt_fonction;
     }
     $ptab[1] = str_replace('!!aut0_id!!', $auteur_0["id"], $ptab[1]);
     $ptab[1] = str_replace('!!aut0!!', htmlentities($auteur->isbd_entry, ENT_QUOTES, $charset), $ptab[1]);
     $ptab[1] = str_replace('!!f0_code!!', $auteur_0["fonction"], $ptab[1]);
     $ptab[1] = str_replace('!!f0!!', $fonction->table[$auteur_0["fonction"]], $ptab[1]);
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     $max_aut1 = count($as);
     if ($max_aut1 == 0) {
         $max_aut1 = 1;
     }
     for ($i = 0; $i < $max_aut1; $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($value_deflt_fonction && $auteur_1["id"] == 0 && $i == 0) {
             $auteur_1["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab[11]);
         $ptab_aut_autres = str_replace('!!aut1_id!!', $auteur_1["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut1!!', htmlentities($auteur->isbd_entry, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1_code!!', $auteur_1["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1!!', $fonction->table[$auteur_1["fonction"]], $ptab_aut_autres);
         $autres_auteurs .= $ptab_aut_autres;
     }
     $ptab[1] = str_replace('!!max_aut1!!', $max_aut1, $ptab[1]);
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     $max_aut2 = count($as);
     if ($max_aut2 == 0) {
         $max_aut2 = 1;
     }
     for ($i = 0; $i < $max_aut2; $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($value_deflt_fonction && $auteur_2["id"] == 0 && $i == 0) {
             $auteur_2["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab[12]);
         $ptab_aut_autres = str_replace('!!aut2_id!!', $auteur_2["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut2!!', htmlentities($auteur->isbd_entry, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2_code!!', $auteur_2["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2!!', $fonction->table[$auteur_2["fonction"]], $ptab_aut_autres);
         $auteurs_secondaires .= $ptab_aut_autres;
     }
     $ptab[1] = str_replace('!!max_aut2!!', $max_aut2, $ptab[1]);
     $ptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $ptab[1]);
     $form_notice = str_replace('!!tab1!!', $ptab[1], $form_notice);
     // mise a jour de l'onglet 2
     $ptab[2] = str_replace('!!ed1_id!!', $this->ed1_id, $ptab[2]);
     $ptab[2] = str_replace('!!ed1!!', htmlentities($this->ed1, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!coll_id!!', $this->coll_id, $ptab[2]);
     $ptab[2] = str_replace('!!coll!!', htmlentities($this->coll, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!subcoll_id!!', $this->subcoll_id, $ptab[2]);
     $ptab[2] = str_replace('!!subcoll!!', htmlentities($this->subcoll, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!year!!', $this->year, $ptab[2]);
     $ptab[2] = str_replace('!!nocoll!!', htmlentities($this->nocoll, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!mention_edition!!', htmlentities($this->mention_edition, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!ed2_id!!', $this->ed2_id, $ptab[2]);
     $ptab[2] = str_replace('!!ed2!!', htmlentities($this->ed2, ENT_QUOTES, $charset), $ptab[2]);
     $form_notice = str_replace('!!tab2!!', $ptab[2], $form_notice);
     // mise a jour de l'onglet 3
     $ptab[3] = str_replace('!!cb!!', $this->code, $ptab[3]);
     $ptab[3] = str_replace('!!notice_id!!', $this->id, $ptab[3]);
     $form_notice = str_replace('!!tab3!!', $ptab[3], $form_notice);
     // Gestion des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if ($this->duplicate_from_id) {
             $tu = new tu_notice($this->duplicate_from_id);
         } else {
             $tu = new tu_notice($this->id);
         }
         $ptab[230] = str_replace("!!titres_uniformes!!", $tu->get_form("notice"), $ptab[230]);
         $form_notice = str_replace('!!tab230!!', $ptab[230], $form_notice);
     }
     // mise a jour de l'onglet 4
     $ptab[4] = str_replace('!!npages!!', htmlentities($this->npages, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!ill!!', htmlentities($this->ill, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!size!!', htmlentities($this->size, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!prix!!', htmlentities($this->prix, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!accomp!!', htmlentities($this->accomp, ENT_QUOTES, $charset), $ptab[4]);
     $form_notice = str_replace('!!tab4!!', $ptab[4], $form_notice);
     // mise a jour de l'onglet 5
     $ptab[5] = str_replace('!!n_gen!!', htmlentities($this->n_gen, ENT_QUOTES, $charset), $ptab[5]);
     $ptab[5] = str_replace('!!n_contenu!!', htmlentities($this->n_contenu, ENT_QUOTES, $charset), $ptab[5]);
     $ptab[5] = str_replace('!!n_resume!!', htmlentities($this->n_resume, ENT_QUOTES, $charset), $ptab[5]);
     $form_notice = str_replace('!!tab5!!', $ptab[5], $form_notice);
     // mise a jour de l'onglet 6
     // categories
     if (sizeof($this->categories) == 0) {
         $max_categ = 1;
     } else {
         $max_categ = sizeof($this->categories);
     }
     $tab_categ_order = "";
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->categories[$i]["categ_id"];
         $categ = new category($categ_id);
         if ($i == 0) {
             $ptab_categ = str_replace('!!icateg!!', $i, $ptab[60]);
         } else {
             $ptab_categ = str_replace('!!icateg!!', $i, $ptab[601]);
         }
         $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ);
         if (sizeof($this->categories) == 0) {
             $ptab_categ = str_replace('!!categ_libelle!!', '', $ptab_categ);
         } else {
             if ($thesaurus_mode_pmb) {
                 $nom_tesaurus = '[' . $categ->thes->getLibelle() . '] ';
             } else {
                 $nom_tesaurus = '';
             }
             $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_tesaurus . $categ->catalog_form, ENT_QUOTES, $charset), $ptab_categ);
             if ($tab_categ_order != "") {
                 $tab_categ_order .= ",";
             }
             $tab_categ_order .= $i;
         }
         $categ_repetables .= $ptab_categ;
     }
     $ptab[6] = str_replace('!!max_categ!!', $max_categ, $ptab[6]);
     $ptab[6] = str_replace('!!categories_repetables!!', $categ_repetables, $ptab[6]);
     $ptab[6] = str_replace('!!tab_categ_order!!', $tab_categ_order, $ptab[6]);
     // indexation interne
     $ptab[6] = str_replace('!!indexint_id!!', $this->indexint, $ptab[6]);
     if ($this->indexint) {
         $indexint = new indexint($this->indexint);
         if ($indexint->comment) {
             $disp_indexint = $indexint->name . " - " . $indexint->comment;
         } else {
             $disp_indexint = $indexint->name;
         }
         if ($thesaurus_classement_mode_pmb) {
             // plusieurs classements/indexations decimales autorises en parametrage
             if ($indexint->name_pclass) {
                 $disp_indexint = "[" . $indexint->name_pclass . "] " . $disp_indexint;
             }
         }
         $ptab[6] = str_replace('!!indexint!!', htmlentities($disp_indexint, ENT_QUOTES, $charset), $ptab[6]);
         $ptab[6] = str_replace('!!num_pclass!!', $indexint->id_pclass, $ptab[6]);
     } else {
         $ptab[6] = str_replace('!!indexint!!', '', $ptab[6]);
         $ptab[6] = str_replace('!!num_pclass!!', '', $ptab[6]);
     }
     // indexation libre
     $ptab[6] = str_replace('!!f_indexation!!', htmlentities($this->index_l, ENT_QUOTES, $charset), $ptab[6]);
     global $pmb_keyword_sep;
     //if (!$pmb_keyword_sep) $pmb_keyword_sep=" ";
     $sep = "'{$pmb_keyword_sep}'";
     if (!$pmb_keyword_sep) {
         $sep = "' '";
     }
     if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) {
         $sep = $msg['catalogue_saut_de_ligne'];
     }
     $ptab[6] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $ptab[6]);
     $form_notice = str_replace('!!tab6!!', $ptab[6], $form_notice);
     // mise a jour de l'onglet 7 : langues
     // langues repetables
     if (sizeof($this->langues) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->langues);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[701]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[70]);
         }
         if (sizeof($this->langues) == 0) {
             $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!lang_code!!', $this->langues[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($this->langues[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_lang!!', $max_lang, $ptab[7]);
     $ptab[7] = str_replace('!!langues_repetables!!', $lang_repetables, $ptab[7]);
     // langues originales repetables
     if (sizeof($this->languesorg) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->languesorg);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[711]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[71]);
         }
         if (sizeof($this->languesorg) == 0) {
             $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!langorg_code!!', $this->languesorg[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($this->languesorg[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_langorg!!', $max_langorg, $ptab[7]);
     $ptab[7] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $ptab[7]);
     $form_notice = str_replace('!!tab7!!', $ptab[7], $form_notice);
     // mise a jour de l'onglet 8
     $ptab[8] = str_replace('!!lien!!', htmlentities($this->lien, ENT_QUOTES, $charset), $ptab[8]);
     $ptab[8] = str_replace('!!eformat!!', htmlentities($this->eformat, ENT_QUOTES, $charset), $ptab[8]);
     $form_notice = str_replace('!!tab8!!', $ptab[8], $form_notice);
     //Mise a jour de l'onglet 9
     $p_perso = new parametres_perso("notices");
     if (!$p_perso->no_special_fields) {
         // si on duplique, construire le formulaire avec les donnees de la notice d'origine
         if ($this->duplicate_from_id) {
             $perso_ = $p_perso->show_editable_fields($this->duplicate_from_id);
         } else {
             $perso_ = $p_perso->show_editable_fields($this->id);
         }
         $perso = "";
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div id='move_" . $p["NAME"] . "' movable='yes' title=\"" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "\">\n\t\t\t\t\t\t\t\t<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "</label></div>\n\t\t\t\t\t\t\t\t<div class='row'>" . $p["AFF"] . "</div>\n\t\t\t\t\t\t\t </div>";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $ptab[9] = str_replace("!!champs_perso!!", $perso, $ptab[9]);
     } else {
         $ptab[9] = "\n<script>function check_form() { return true; }</script>\n";
     }
     $form_notice = str_replace('!!tab9!!', $ptab[9], $form_notice);
     //Liens vers d'autres notices
     $string_relations = "";
     $n_rel = 0;
     foreach ($this->notice_link as $direction => $relations) {
         foreach ($relations as $relation) {
             //Selection du template
             if ($n_rel == 0) {
                 $pattern_rel = $ptab[130];
             } else {
                 $pattern_rel = $ptab[131];
             }
             //Construction du textbox
             $pattern_rel = str_replace("!!notice_relations_id!!", $relation['id_notice'], $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_libelle!!", htmlentities($relation['title_notice'], ENT_QUOTES, $charset), $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_rank!!", $relation['rank'], $pattern_rel);
             $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
             //Construction du combobox de type de lien
             $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_{$n_rel}", $pattern_rel);
             //Recuperation des types de relation
             $liste_type_relation_up = new marc_list("relationtypeup");
             $liste_type_relation_down = new marc_list("relationtypedown");
             $liste_type_relation_both = array();
             $corresp_relation_up_down = array();
             foreach ($liste_type_relation_up->table as $key_up => $val_up) {
                 foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                     if ($val_up == $val_down) {
                         $liste_type_relation_both['down'][$key_down] = $val_down;
                         $liste_type_relation_both['up'][$key_up] = $val_up;
                         $corresp_relation_up_down[$key_up] = $key_down;
                         unset($liste_type_relation_down->table[$key_down]);
                         unset($liste_type_relation_up->table[$key_up]);
                     }
                 }
             }
             $opts = '';
             if ($this->id) {
                 foreach ($liste_type_relation_up->table as $key => $val) {
                     if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'up') {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                     }
                 }
             } else {
                 foreach ($liste_type_relation_up->table as $key => $val) {
                     if ($key . '-up' == $value_deflt_relation) {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                     }
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
             $opts = '';
             if ($this->id) {
                 foreach ($liste_type_relation_down->table as $key => $val) {
                     if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'down') {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                     }
                 }
             } else {
                 foreach ($liste_type_relation_down->table as $key => $val) {
                     if ($key . '-down' == $value_deflt_relation) {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                     }
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
             $opts = '';
             if (array_key_exists($relation['relation_type'], $liste_type_relation_both['up']) || array_key_exists($relation['relation_type'], $liste_type_relation_both['down'])) {
                 $opts .= '<option  style="color:#000000" value="' . $relation['relation_type'] . '-' . $direction . '" selected="selected" >' . $liste_type_relation_both[$direction][$relation['relation_type']] . '</option>';
                 if ($direction == "up") {
                     $notDirection = "down";
                 } else {
                     $notDirection = "up";
                     $corresp_relation_up_down = array_flip($corresp_relation_up_down);
                 }
                 $notRelationType = $corresp_relation_up_down[$relation['relation_type']];
                 unset($liste_type_relation_both[$direction][$relation['relation_type']]);
                 unset($liste_type_relation_both[$notDirection][$notRelationType]);
             }
             if ($this->id) {
                 foreach ($liste_type_relation_both['down'] as $key => $val) {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                 }
             } else {
                 foreach ($liste_type_relation_both['down'] as $key => $val) {
                     if ($key . '-down' == $value_deflt_relation) {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected">' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                     }
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
             $string_relations .= $pattern_rel;
             $n_rel++;
         }
     }
     if (!$n_rel) {
         $pattern_rel = $ptab[130];
         $pattern_rel = str_replace("!!notice_relations_id!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_libelle!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_rank!!", "0", $pattern_rel);
         $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
         $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_0", $pattern_rel);
         //Recuperation des types de relation
         $liste_type_relation_up = new marc_list("relationtypeup");
         $liste_type_relation_down = new marc_list("relationtypedown");
         $liste_type_relation_both = array();
         foreach ($liste_type_relation_up->table as $key_up => $val_up) {
             foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                 if ($val_up == $val_down) {
                     $liste_type_relation_both[$key_down] = $val_down;
                     unset($liste_type_relation_down->table[$key_down]);
                     unset($liste_type_relation_up->table[$key_up]);
                 }
             }
         }
         $opts = '';
         foreach ($liste_type_relation_up->table as $key => $val) {
             if ($key . '-up' == $value_deflt_relation) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_down->table as $key => $val) {
             if ($key . '-down' == $value_deflt_relation) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_both as $key => $val) {
             if ($key . '-down' == $value_deflt_relation) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
         $string_relations .= $pattern_rel;
         $n_rel++;
     }
     //Nombre de relations
     $ptab[13] = str_replace("!!max_rel!!", $n_rel, $ptab[13]);
     //Liens multiples
     $ptab[13] = str_replace("!!notice_relations!!", $string_relations, $ptab[13]);
     $form_notice = str_replace('!!tab11!!', $ptab[13], $form_notice);
     // champs de gestion
     $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $this->statut, "", "", "", "", 0);
     $ptab[10] = str_replace('!!notice_statut!!', $select_statut, $ptab[10]);
     $ptab[10] = str_replace('!!commentaire_gestion!!', htmlentities($this->commentaire_gestion, ENT_QUOTES, $charset), $ptab[10]);
     $ptab[10] = str_replace('!!thumbnail_url!!', htmlentities($this->thumbnail_url, ENT_QUOTES, $charset), $ptab[10]);
     global $pmb_notice_img_folder_id;
     $message_folder = "";
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = mysql_query($req);
         if (mysql_num_rows($res)) {
             $rep = mysql_fetch_object($res);
             if (!is_dir($rep->repertoire_path)) {
                 $notice_img_folder_error = 1;
             }
         } else {
             $notice_img_folder_error = 1;
         }
         if ($notice_img_folder_error) {
             if (SESSrights & ADMINISTRATION_AUTH) {
                 $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' ";
                 $res = mysql_query($requete);
                 $i = 0;
                 if ($param = mysql_fetch_object($res)) {
                     $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> ";
                 }
             } else {
                 $message_folder = $msg['notice_img_folder_no_access'];
             }
         }
     }
     $ptab[10] = str_replace('!!message_folder!!', $message_folder, $ptab[10]);
     //affichage des formulaires des droits d'acces
     $rights_form = $this->get_rights_form();
     $ptab[10] = str_replace('<!-- rights_form -->', $rights_form, $ptab[10]);
     // langue de la notice
     global $lang;
     $user_lang = $this->indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     //	if(!$user_lang) $user_lang="fr_FR";
     $langues = new XMLlist("{$include_path}/messages/languages.xml");
     $langues->analyser();
     $clang = $langues->table;
     $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >";
     if (!$user_lang) {
         $combo .= "<option value='' selected>--</option>";
     } else {
         $combo .= "<option value='' >--</option>";
     }
     while (list($cle, $value) = each($clang)) {
         // arabe seulement si on est en utf-8
         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
             if (strcmp($cle, $user_lang) != 0) {
                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
             } else {
                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
             }
         }
     }
     $combo .= "</select>";
     $ptab[10] = str_replace('!!indexation_lang!!', $combo, $ptab[10]);
     $form_notice = str_replace('!!indexation_lang_sel!!', $user_lang, $form_notice);
     $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice);
     // definition de la page cible du form
     $form_notice = str_replace('!!action!!', $this->action, $form_notice);
     // ajout des selecteurs
     $select_doc = new marc_select('doctype', 'typdoc', $this->type_doc, "get_pos(); expandAll(); ajax_parse_dom(); if (inedit) move_parse_dom(relative); else initIt();");
     $form_notice = str_replace('!!doc_type!!', $select_doc->display, $form_notice);
     $form_notice = str_replace('!!notice_id_no_replace!!', $this->id, $form_notice);
     // Ajout des localisations pour edition
     $select_loc = "";
     if ($PMBuserid == 1) {
         $req_loc = "select idlocation,location_libelle from docs_location";
         $res_loc = mysql_query($req_loc);
         if (mysql_num_rows($res_loc) > 1) {
             $select_loc = "<select name='grille_location' id='grille_location' style='display:none' onChange=\"get_pos(); expandAll(); if (inedit) move_parse_dom(relative); else initIt();\">\n";
             $select_loc .= "<option value='0'>" . $msg['all_location'] . "</option>\n";
             while ($r = mysql_fetch_object($res_loc)) {
                 $select_loc .= "<option value='" . $r->idlocation . "'>" . $r->location_libelle . "</option>\n";
             }
             $select_loc .= "</select>\n";
         }
     }
     $form_notice = str_replace("!!location!!", $select_loc, $form_notice);
     // affichage du lien pour suppression et du lien d'annulation
     if ($this->id) {
         $link_supp = "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tfunction confirm_delete() {\n\t\t\t\t\t\tresult = confirm(\"{$msg[confirm_suppr_notice]}\");\n\t\t\t       \t\tif(result) {\n\t\t\t       \t\t\tunload_off();\n\t\t\t           \t\tdocument.location = './catalog.php?categ=delete&id=" . $this->id . "'\n\t\t\t\t\t\t} \n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t\t<input type='button' class='bouton' value=\"{$msg[63]}\" onClick=\"confirm_delete();\" />";
         $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();history.go(-1);\" />";
         $link_remplace = "<input type='button' class='bouton' value='{$msg['158']}' onclick='unload_off();document.location=\"./catalog.php?categ=remplace&id=" . $this->id . "\"' />";
         $link_duplicate = "<input type='button' class='bouton' value='{$msg['notice_duplicate_bouton']}' onclick='unload_off();document.location=\"./catalog.php?categ=duplicate&id=" . $this->id . "\"' />";
         if ($z3950_accessible) {
             $link_z3950 = "<input type='button' class='bouton' value='{$msg['notice_z3950_update_bouton']}' onclick='unload_off();document.location=\"./catalog.php?categ=z3950&id_notice=" . $this->id . "&isbn=" . $this->code . "\"' />";
         } else {
             $link_z3950 = "";
         }
         if ($pmb_type_audit) {
             $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=1&object_id={$this->id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />";
         } else {
             $link_audit = "";
         }
     } else {
         $link_supp = "";
         $link_remplace = "";
         $link_duplicate = "";
         $link_z3950 = "";
         $link_audit = "";
         // 				if ($this->notice_mere_id || $this->duplicate_from_id) $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();history.go(-1);\" />";
         if ($this->notice_link['up'][0]['id_notice'] || $this->duplicate_from_id) {
             $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();history.go(-1);\" />";
         } else {
             $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();document.location='" . $this->link_annul . "';\" />";
         }
     }
     $form_notice = str_replace('!!link_supp!!', $link_supp, $form_notice);
     $form_notice = str_replace('!!link_annul!!', $link_annul, $form_notice);
     $form_notice = str_replace('!!link_remplace!!', $link_remplace, $form_notice);
     $form_notice = str_replace('!!link_duplicate!!', $link_duplicate, $form_notice);
     $form_notice = str_replace('!!link_z3950!!', $link_z3950, $form_notice);
     $form_notice = str_replace('!!link_audit!!', $link_audit, $form_notice);
     return $form_notice;
 }