Beispiel #1
0
function show_import_choix_fichier($dbh)
{
    global $msg, $deflt2docs_location;
    global $current_module, $PMBuserid;
    print "\n\t<script type='text/javascript'>\n\nfunction display_part(type)\n{\n\tvar type_import = document.getElementById('div_ensae');\n\tif(type == 'ensae')\n\t{\n\t\tvar div_ensae = document.getElementById('div_ensae');\n\t\tdiv_ensae.style.display = 'table-cell';\n\t\tvar div_ensai = document.getElementById('div_ensai');\n\t\tdiv_ensai.style.display = 'none';\t\n\t\ttype_import.value='maj_complete';\n\t\t\n\t} else {\n\t\tvar div_ensae = document.getElementById('div_ensae');\n\t\tdiv_ensae.style.display = 'none';\n\t\tvar div_ensai = document.getElementById('div_ensai');\n\t\tdiv_ensai.style.display = 'table-cell';\n\t\ttype_import.value='insert_or_update';\n\t}\n\t\n} \n</script>\n\t\n\t<form class='form-{$current_module}' name='form1' ENCTYPE=\"multipart/form-data\" method='post' action=\"./admin.php?categ=empr&sub=implec&action=1\">\n\t<h3>Choix du fichier d'import des élèves GENES</h3>\n\t<div class='form-contenu'>\n\t\t<div class='row'>\n\t\t\t<label class='etiquette' for='import_lec'>" . $msg["import_lec_fichier"] . "</label>\n\t        <input name='import_lec' id='import_lec' accept='text/plain' type='file' class='saisie-80em' size='80'>\n\t\t\t</div>\n\t\t<div class='row'>\n\t        <label class='etiquette' for='Sep_Champs'>" . $msg["import_lec_separateur"] . "</label>\n\t        <select name='Sep_Champs' id='Sep_Champs'>\n\t            <option value=';' selected>;</option>\n\t            <option value='.'>.</option>\n\t        </select>\n\t    </div>\n\t    <div class='row'>\n\t        <label class='etiquette' for='file_format'>Format du fichier</label>\n\t        <select name='file_format' id='file_format' onchange='display_part(this.value);'>\n\t            <option value='ensae' selected>ENSAE</option>\n\t            <option value='ensai'>ENSAI</option>\n\t        </select>\n\t    </div>\n\t    <br />\n\t    <div style='display:table'>\n\t    \t<div style='display:table-row'>\n\t\t    \t<div id=div_ensae style='display:table-cell;width:50%'>\n\t\t    \t\t<div class='row'>\n\t\t\t\t\t\t<p>L'ordre des colonnes dans votre fichier doit être :<br />\n\t\t\t\t\t\t<font size='1'>Identifiant de l'étudiant ; Code-barres ; Voie ; Nom ; Prénom ; Mail ; Mail perso ; Numéro de casier ; Civilité ; Année de date de naissance ; Téléphone 1 ; Téléphone 2 ; Identifiant OPAC</font>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t        <input type=hidden name='type_import' id='type_import' value='maj_complete' />\n\t\t\t\t        <label class='etiquette' for='type_import'>Mise à jour complète</label>\n\t\t\t\t        Marquer les lecteurs appartenant aux groupes ci-dessous et ayant pour catégorie et localisation les choix ci-dessous\n\t\t\t\t        <blockquote>" . "\n\t\t\t\t        Et les placer dans le panier suivant: ";
    $requete = "SELECT idemprcaddie, name FROM empr_caddie where (autorisations='{$PMBuserid}' or autorisations like '{$PMBuserid} %' or autorisations like '% {$PMBuserid} %' or autorisations like '% {$PMBuserid}') order by name ";
    print gen_liste($requete, "idemprcaddie", "name", "idemprcaddie", "", "", "", "", "", "", 0);
    print "</blockquote>\n\t\t\t\t    </div>\n\t\t\t\t    <div class='row'>\n\t\t\t\t\t    <blockquote>\n\t\t\t\t\t    \t<div class='colonne3'>";
    $requete = "SELECT id_groupe, libelle_groupe FROM groupe left join empr_groupe on id_groupe=groupe_id  group by id_groupe, libelle_groupe ORDER BY libelle_groupe ";
    $groupe_form_aff = gen_liste_multiple($requete, "id_groupe", "libelle_groupe", "id_groupe", "id_grp[]", "", $id, 0, $msg[empr_form_aucungroupe], 0, "", 60);
    print "<div class='row'>\n\t\t\t\t\t\t\t\t\t<label for='form_ajoutgroupe' class='etiquette'>Groupes :</label>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='row'>" . $groupe_form_aff . "</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='colonne3'>";
    $requete = "SELECT id_categ_empr, libelle FROM empr_categ ORDER BY libelle ";
    $categ_form_aff = gen_liste($requete, "id_categ_empr", "libelle", "id_categ_empr", "", 36, "", "", "", "", 0);
    print "<div class='row'>\n\t\t\t\t\t\t\t\t\t<label for='form_categ_empr' class='etiquette'>Catégorie de lecteurs :</label>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='row'>" . $categ_form_aff . "</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='colonne_suite'>";
    print "<div class='row'>\n\t\t\t\t\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t\t\t<label for='form_empr_location' class='etiquette'>{$msg['empr_location']}:</label>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t\t\t" . docs_location::gen_combo_box_empr($deflt2docs_location, 0) . "\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</blockquote>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div id=div_ensai style='display:table-cell;width:50%;display:none'>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t<p>L'ordre des colonnes dans votre fichier doit être :<br />\n\t\t\t\t\t\t<font size='1'>Nom ; Prénom ; Mail ; Mail perso ; Catégorie ; Groupe 1 ; Groupe 2 ; Groupe 3 ;  Libellé du statut ; Libellé de la localisation ; Pays ; Date d'adhésion du lecteur ; Date d'expiration du lecteur ; Code-barres ; Identifiant OPAC ; Téléphone 1 ; Téléphone 2</font>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t        \n\t\t\t\t        <label class='etiquette' for='type_import_1'>Insertion uniquement</label>\n\t\t\t\t    </div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class='row'>&nbsp;</div>\n\t</div>\n\t<div class='row'>\n\t\t<input name='imp_elv' type='submit' class='bouton' value='Import des élèves'/>\n\t</div>\n\t</form>";
}
Beispiel #2
0
 function analysis_form($notice_type = false)
 {
     global $style;
     global $msg;
     global $pdeptab;
     global $analysis_top_form;
     global $fonction_auteur;
     global $charset;
     global $include_path, $class_path;
     global $pmb_type_audit, $select_categ_prop;
     global $value_deflt_fonction;
     global $value_deflt_lang, $value_deflt_relation_analysis;
     global $thesaurus_mode_pmb, $thesaurus_classement_mode_pmb;
     global $thesaurus_concepts_active;
     global $pmb_notices_show_dates;
     require_once "{$class_path}/author.class.php";
     require_once $class_path . "/index_concept.class.php";
     $fonction = new marc_list('function');
     // inclusion de la feuille de style des expandables
     print $style;
     // mise à jour des flags de niveau hiérarchique
     $select_doc = new marc_select('doctype', 'typdoc', $this->analysis_typdoc, "get_pos(); initIt(); ajax_parse_dom();");
     $analysis_top_form = str_replace('!!doc_type!!', $select_doc->display, $analysis_top_form);
     //$analysis_top_form = str_replace('!!doc_type!!', $this->analysis_typdoc, $analysis_top_form);
     $analysis_top_form = str_replace('!!b_level!!', $this->analysis_biblio_level, $analysis_top_form);
     $analysis_top_form = str_replace('!!h_level!!', $this->analysis_hierar_level, $analysis_top_form);
     $analysis_top_form = str_replace('!!id!!', $this->serial_id, $analysis_top_form);
     // mise à jour de l'onglet 0
     $pdeptab[0] = str_replace('!!tit1!!', htmlentities($this->analysis_tit1, ENT_QUOTES, $charset), $pdeptab[0]);
     $pdeptab[0] = str_replace('!!tit2!!', htmlentities($this->analysis_tit2, ENT_QUOTES, $charset), $pdeptab[0]);
     $pdeptab[0] = str_replace('!!tit3!!', htmlentities($this->analysis_tit3, ENT_QUOTES, $charset), $pdeptab[0]);
     $pdeptab[0] = str_replace('!!tit4!!', htmlentities($this->analysis_tit4, ENT_QUOTES, $charset), $pdeptab[0]);
     $analysis_top_form = str_replace('!!tab0!!', $pdeptab[0], $analysis_top_form);
     // initialisation avec les paramètres du user :
     if (!$this->analysis_langues) {
         global $value_deflt_lang;
         if ($value_deflt_lang) {
             $lang = new marc_list('lang');
             $this->analysis_langues[] = array('lang_code' => $value_deflt_lang, 'langue' => $lang->table[$value_deflt_lang]);
         }
     }
     // mise à jour de l'onglet 1
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites_dep["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites_dep["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
     }
     if ($value_deflt_fonction && $auteur_0["id"] == 0) {
         $auteur_0["fonction"] = $value_deflt_fonction;
     }
     $pdeptab[1] = str_replace('!!aut0_id!!', $auteur_0["id"], $pdeptab[1]);
     $pdeptab[1] = str_replace('!!aut0!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $pdeptab[1]);
     $pdeptab[1] = str_replace('!!f0_code!!', $auteur_0["fonction"], $pdeptab[1]);
     $pdeptab[1] = str_replace('!!f0!!', $fonction->table[$auteur_0["fonction"]], $pdeptab[1]);
     $as = array_keys($this->responsabilites_dep["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_dep["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, $pdeptab[11]);
         $ptab_aut_autres = str_replace('!!aut1_id!!', $auteur_1["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut1!!', htmlentities($auteur->display, 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;
     }
     $pdeptab[1] = str_replace('!!max_aut1!!', $max_aut1, $pdeptab[1]);
     $as = array_keys($this->responsabilites_dep["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_dep["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, $pdeptab[12]);
         $ptab_aut_autres = str_replace('!!aut2_id!!', $auteur_2["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut2!!', htmlentities($auteur->display, 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;
     }
     $pdeptab[1] = str_replace('!!max_aut2!!', $max_aut2, $pdeptab[1]);
     $pdeptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $pdeptab[1]);
     $pdeptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $pdeptab[1]);
     $analysis_top_form = str_replace('!!tab1!!', $pdeptab[1], $analysis_top_form);
     // mise à jour de l'onglet 2
     $pdeptab[2] = str_replace('!!pages!!', htmlentities($this->analysis_pages, ENT_QUOTES, $charset), $pdeptab[2]);
     $analysis_top_form = str_replace('!!tab2!!', $pdeptab[2], $analysis_top_form);
     // mise à jour de l'onglet 3 (notes)
     $pdeptab[3] = str_replace('!!n_gen!!', htmlentities($this->analysis_n_gen, ENT_QUOTES, $charset), $pdeptab[3]);
     $pdeptab[3] = str_replace('!!n_contenu!!', htmlentities($this->analysis_n_contenu, ENT_QUOTES, $charset), $pdeptab[3]);
     $pdeptab[3] = str_replace('!!n_resume!!', htmlentities($this->analysis_n_resume, ENT_QUOTES, $charset), $pdeptab[3]);
     $analysis_top_form = str_replace('!!tab3!!', $pdeptab[3], $analysis_top_form);
     // mise à jour de l'onglet 4
     // catégories
     if (sizeof($this->analysis_categories) == 0) {
         $max_categ = 1;
     } else {
         $max_categ = sizeof($this->analysis_categories);
     }
     $tab_categ_order = "";
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->analysis_categories[$i]["categ_id"];
         $categ = new category($categ_id);
         if ($i == 0) {
             $ptab_categ = str_replace('!!icateg!!', $i, $pdeptab[40]);
         } else {
             $ptab_categ = str_replace('!!icateg!!', $i, $pdeptab[401]);
         }
         if ($thesaurus_mode_pmb && $categ_id) {
             $nom_thesaurus = '[' . thesaurus::getLibelle($categ->thes->id_thesaurus) . '] ';
         } else {
             $nom_thesaurus = '';
         }
         $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ);
         $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus . $categ->catalog_form, ENT_QUOTES, $charset), $ptab_categ);
         $categ_repetables .= $ptab_categ;
         if (sizeof($this->analysis_categories) > 0) {
             if ($tab_categ_order != "") {
                 $tab_categ_order .= ",";
             }
             $tab_categ_order .= $i;
         }
     }
     $pdeptab[4] = str_replace('!!max_categ!!', $max_categ, $pdeptab[4]);
     $pdeptab[4] = str_replace('!!categories_repetables!!', $categ_repetables, $pdeptab[4]);
     $pdeptab[4] = str_replace('!!tab_categ_order!!', $tab_categ_order, $pdeptab[4]);
     // Concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->analysis_id, TYPE_NOTICE);
         $pdeptab[4] = str_replace('!!concept_form!!', $index_concept->get_form('notice'), $pdeptab[4]);
     } else {
         $pdeptab[4] = str_replace('!!concept_form!!', "", $pdeptab[4]);
     }
     // indexation interne
     $pdeptab[4] = str_replace('!!indexint_id!!', $this->analysis_indexint, $pdeptab[4]);
     $pdeptab[4] = str_replace('!!indexint!!', htmlentities($this->analysis_indexint_lib, ENT_QUOTES, $charset), $pdeptab[4]);
     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 décimales autorisés en parametrage
             if ($indexint->name_pclass) {
                 $disp_indexint = "[" . $indexint->name_pclass . "] " . $disp_indexint;
             }
         }
         $pdeptab[4] = str_replace('!!indexint!!', htmlentities($disp_indexint, ENT_QUOTES, $charset), $pdeptab[4]);
         $pdeptab[4] = str_replace('!!num_pclass!!', $indexint->id_pclass, $pdeptab[4]);
     } else {
         $pdeptab[4] = str_replace('!!indexint!!', '', $pdeptab[4]);
         $pdeptab[4] = str_replace('!!num_pclass!!', '', $pdeptab[4]);
     }
     // indexation libre
     $pdeptab[4] = str_replace('!!f_indexation!!', htmlentities($this->analysis_index_l, ENT_QUOTES, $charset), $pdeptab[4]);
     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'];
     }
     $pdeptab[4] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $pdeptab[4]);
     $analysis_top_form = str_replace('!!tab4!!', $pdeptab[4], $analysis_top_form);
     // mise à jour de l'onglet 5 : Langues
     // langues répétables
     if (sizeof($this->analysis_langues) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->analysis_langues);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $pdeptab[501]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $pdeptab[50]);
         }
         if (sizeof($this->analysis_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->analysis_langues[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($this->analysis_langues[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $pdeptab[5] = str_replace('!!max_lang!!', $max_lang, $pdeptab[5]);
     $pdeptab[5] = str_replace('!!langues_repetables!!', $lang_repetables, $pdeptab[5]);
     // langues originales répétables
     if (sizeof($this->analysis_languesorg) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->analysis_languesorg);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $pdeptab[511]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $pdeptab[51]);
         }
         if (sizeof($this->analysis_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->analysis_languesorg[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($this->analysis_languesorg[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $pdeptab[5] = str_replace('!!max_langorg!!', $max_langorg, $pdeptab[5]);
     $pdeptab[5] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $pdeptab[5]);
     $analysis_top_form = str_replace('!!tab5!!', $pdeptab[5], $analysis_top_form);
     // mise à jour de l'onglet 6
     global $pmb_curl_timeout;
     $pdeptab[6] = str_replace('!!lien!!', htmlentities($this->analysis_lien, ENT_QUOTES, $charset), $pdeptab[6]);
     $pdeptab[6] = str_replace('!!eformat!!', htmlentities($this->analysis_eformat, ENT_QUOTES, $charset), $pdeptab[6]);
     $pdeptab[6] = str_replace('!!pmb_curl_timeout!!', $pmb_curl_timeout, $pdeptab[6]);
     $analysis_top_form = str_replace('!!tab6!!', $pdeptab[6], $analysis_top_form);
     //Mise à jour de l'onglet 7
     $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->analysis_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<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label></div>\n\t\t\t\t\t\t<div class='row'>" . $p["AFF"] . "</div>\n\t\t\t\t\t\t</div>";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $pdeptab[7] = str_replace("!!champs_perso!!", $perso, $pdeptab[7]);
     } else {
         $pdeptab[7] = "\n<script>function check_form() { return true; }</script>\n";
     }
     $analysis_top_form = str_replace('!!tab7!!', $pdeptab[7], $analysis_top_form);
     //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 = $pdeptab[130];
             } else {
                 $pattern_rel = $pdeptab[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 = '';
             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>';
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
             $opts = '';
             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>';
                 }
             }
             $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]);
             }
             foreach ($liste_type_relation_both['down'] as $key => $val) {
                 $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 = $pdeptab[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_analysis) {
                 $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_analysis) {
                 $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_analysis) {
                 $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++;
     }
     //Type de relation par défaut
     $pdeptab[13] = str_replace("!!value_deflt_relation!!", $value_deflt_relation_analysis, $pdeptab[13]);
     //Nombre de relations
     $pdeptab[13] = str_replace("!!max_rel!!", $n_rel, $pdeptab[13]);
     //Liens multiples
     $pdeptab[13] = str_replace("!!notice_relations!!", $string_relations, $pdeptab[13]);
     $analysis_top_form = str_replace('!!tab13!!', $pdeptab[13], $analysis_top_form);
     // 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->analysis_statut, "", "", "", "", 0);
     $pdeptab[8] = str_replace('!!notice_statut!!', $select_statut, $pdeptab[8]);
     $pdeptab[8] = str_replace('!!commentaire_gestion!!', htmlentities($this->analysis_commentaire_gestion, ENT_QUOTES, $charset), $pdeptab[8]);
     $pdeptab[8] = str_replace('!!thumbnail_url!!', htmlentities($this->analysis_thumbnail_url, ENT_QUOTES, $charset), $pdeptab[8]);
     if ($this->analysis_is_new) {
         $pdeptab[8] = str_replace('!!checked_yes!!', "checked", $pdeptab[8]);
         $pdeptab[8] = str_replace('!!checked_no!!', "", $pdeptab[8]);
     } else {
         $pdeptab[8] = str_replace('!!checked_no!!', "checked", $pdeptab[8]);
         $pdeptab[8] = str_replace('!!checked_yes!!', "", $pdeptab[8]);
     }
     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'];
             }
         }
     }
     $pdeptab[8] = str_replace('!!message_folder!!', $message_folder, $pdeptab[8]);
     if ($this->analysis_id && $pmb_notices_show_dates) {
         $create_date = new DateTime($this->create_date);
         $update_date = new DateTime($this->update_date);
         $dates_notices = "<br>\n\t\t\t\t\t\t<label for='notice_date_crea' class='etiquette'>" . $msg["noti_crea_date"] . "</label>&nbsp;" . $create_date->format('d/m/Y H:i:s') . "\n\t\t\t    \t\t<br>\n\t\t\t    \t\t<label for='notice_date_mod' class='etiquette'>" . $msg["noti_mod_date"] . "</label>&nbsp;" . $update_date->format('d/m/Y H:i:s');
         $pdeptab[8] = str_replace('!!dates_notice!!', $dates_notices, $pdeptab[8]);
     } else {
         $pdeptab[8] = str_replace('!!dates_notice!!', "", $pdeptab[8]);
     }
     //affichage des formulaires des droits d'acces
     $rights_form = $this->get_rights_form();
     $pdeptab[8] = str_replace('<!-- rights_form -->', $rights_form, $pdeptab[8]);
     global $lang, $xmlta_indexation_lang;
     $user_lang = $this->analysis_indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     $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>";
     $pdeptab[8] = str_replace('!!indexation_lang!!', $combo, $pdeptab[8]);
     $analysis_top_form = str_replace('!!tab8!!', $pdeptab[8], $analysis_top_form);
     // autorité personnalisées
     $authperso = new authperso_notice($this->analysis_id);
     $authperso_tpl = $authperso->get_form();
     $analysis_top_form = str_replace('!!authperso!!', $authperso_tpl, $analysis_top_form);
     // map
     global $pmb_map_activate;
     if ($pmb_map_activate) {
         $map_edition = new map_edition_controler(TYPE_RECORD, $this->analysis_id);
         $map_form = $map_edition->get_form();
         $map_info = new map_info($this->analysis_id);
         $map_form_info = $map_info->get_form();
         $map_notice_form = $pdeptab[14];
         $map_notice_form = str_replace('!!notice_map!!', $map_form . $map_form_info, $map_notice_form);
         $analysis_top_form = str_replace('!!tab14!!', $map_notice_form, $analysis_top_form);
     } else {
         $analysis_top_form = str_replace('!!tab14!!', "", $analysis_top_form);
     }
     // définition de la page cible du form
     $analysis_top_form = str_replace('!!action!!', $this->action, $analysis_top_form);
     // mise à jour du type de document
     $analysis_top_form = str_replace('!!doc_type!!', $this->analysis_typdoc, $analysis_top_form);
     // Ajout des localisations pour édition
     $select_loc = "";
     global $PMBuserid, $pmb_form_editables;
     if ($PMBuserid == 1 && $pmb_form_editables == 1) {
         $req_loc = "select idlocation,location_libelle from docs_location";
         $res_loc = pmb_mysql_query($req_loc);
         if (pmb_mysql_num_rows($res_loc) > 1) {
             $select_loc = "<select name='grille_location' id='grille_location' style='display:none' onChange=\"get_pos();initIt(); if (inedit) move_parse_dom(relative);\">\n";
             $select_loc .= "<option value='0'>" . $msg['notice_grille_all_location'] . "</option>\n";
             while ($r = pmb_mysql_fetch_object($res_loc)) {
                 $select_loc .= "<option value='" . $r->idlocation . "'>" . $r->location_libelle . "</option>\n";
             }
             $select_loc .= "</select>\n";
         }
     }
     $analysis_top_form = str_replace("!!location!!", $select_loc, $analysis_top_form);
     // affichage du lien pour suppression
     if ($this->analysis_id) {
         $link_supp = "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t<!--\n\t\t\t\t\tfunction confirmation_delete() {\n\t\t\t\t\tresult = confirm(\"{$msg['confirm_suppr']} ?\");\n\t\t\t\t\tif(result) {\n\t\t\t\t\t\tunload_off();\n\t\t\t\t\t\tdocument.location = './catalog.php?categ=serials&sub=analysis&action=delete&bul_id=!!bul_id!!&analysis_id=!!analysis_id!!';\t\t\t\t\n\t\t\t\t\t}\t\n\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=\"confirmation_delete();\">&nbsp;";
         $form_titre = $msg[4023];
         if ($pmb_type_audit) {
             $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=1&object_id={$this->analysis_id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />";
         } else {
             $link_audit = "";
         }
         $link_duplicate = "<input type='button' class='bouton' value='" . $msg["analysis_duplicate_bouton"] . "' onclick='document.location=\"./catalog.php?categ=serials&sub=analysis&action=analysis_duplicate&bul_id={$this->id_bulletinage}&analysis_id={$this->analysis_id}\"' />";
         $link_move = "<input type='button' class='bouton' value='" . $msg["analysis_move_bouton"] . "' onclick='document.location=\"./catalog.php?categ=serials&sub=analysis&action=analysis_move&bul_id={$this->id_bulletinage}&analysis_id=" . $this->analysis_id . "\"' />";
     } else {
         $link_supp = "";
         $form_titre = $msg[4022];
         $link_audit = "";
         $link_duplicate = "";
         $link_move = "";
     }
     $analysis_top_form = str_replace('!!link_supp!!', $link_supp, $analysis_top_form);
     $analysis_top_form = str_replace('!!form_title!!', $form_titre, $analysis_top_form);
     // mise à jour des infos du dépouillement
     $analysis_top_form = str_replace('!!bul_id!!', $this->id_bulletinage, $analysis_top_form);
     $analysis_top_form = str_replace('!!analysis_id!!', $this->analysis_id, $analysis_top_form);
     $analysis_top_form = str_replace('!!link_audit!!', $link_audit, $analysis_top_form);
     $analysis_top_form = str_replace('!!link_duplicate!!', $link_duplicate, $analysis_top_form);
     $analysis_top_form = str_replace('!!link_move!!', $link_move, $analysis_top_form);
     $analysis_top_form = str_replace('!!notice_id_no_replace!!', $this->analysis_id, $analysis_top_form);
     if ($notice_type) {
         global $analysis_type_form;
         $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='' />\n\t\t\t\t<input class='saisie-10em' type='text' name='date_date_lib' value='' />\n\t\t\t\t<input class='bouton' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
         $analysis_type_form = str_replace("!!date_date!!", $date_date, $analysis_type_form);
         $analysis_type_form = str_replace("!!perio_type_new!!", "checked", $analysis_type_form);
         $analysis_type_form = str_replace("!!bull_type_new!!", "checked", $analysis_type_form);
         $analysis_type_form = str_replace("!!perio_type_use_existing!!", "", $analysis_type_form);
         $analysis_type_form = str_replace("!!bull_type_use_existing!!", "", $analysis_type_form);
         $analysis_top_form = str_replace("!!type_catal!!", $analysis_type_form, $analysis_top_form);
         return $analysis_top_form;
     } else {
         $analysis_top_form = str_replace("!!type_catal!!", "", $analysis_top_form);
     }
     return $analysis_top_form;
 }
 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;
 }
Beispiel #4
0
function show_empr_form($form_action, $form_cancel, $link, $id, $cb, $duplicate_empr_from_id = "")
{
    global $empr_form;
    global $dbh, $msg, $charset;
    global $biblio_email;
    global $aff_list_empr;
    global $deflt2docs_location;
    global $pmb_lecteurs_localises;
    global $pmb_gestion_abonnement, $pmb_gestion_financiere, $empr_abonnement_default_debit;
    global $empr_prolong_calc_date_adhes_depassee;
    global $database_window_title;
    global $lang;
    global $pmb_rfid_activate, $pmb_rfid_serveur_url;
    global $pmb_opac_view_activate;
    // si $id est fourni, il s'agit d'une modification. on recupere les donnees dans $link
    if ($id) {
        // modification
        echo window_title($database_window_title . $msg[55]);
        $entete = $msg[55];
        if ($pmb_rfid_activate == 1 && $pmb_rfid_serveur_url) {
            $script_rfid_encode = "if(script_rfid_encode()==false) return false;";
        } else {
            $script_rfid_encode = '';
        }
        $empr_form = str_replace("!!questionrfid!!", $script_rfid_encode, $empr_form);
        $requete = "SELECT * FROM empr WHERE id_empr='{$id}' ";
        $res = mysql_query($requete, $link);
        if ($res) {
            $empr = mysql_fetch_object($res);
        } else {
            error_message($msg[53], $msg[54], 0);
        }
    } else {
        // création
        $empr = new stdClass();
        $entete = $msg[15];
        $empr_form = str_replace("!!questionrfid!!", '', $empr_form);
    }
    if ($duplicate_empr_from_id) {
        $empr_form = str_replace("!!id!!", "", $empr_form);
        $empr_form = str_replace("!!entete!!", $msg["empr_duplicate"], $empr_form);
    } else {
        $empr_form = str_replace("!!id!!", $id, $empr_form);
        $empr_form = str_replace("!!entete!!", $entete, $empr_form);
    }
    $empr_form = str_replace("!!form_action!!", $form_action, $empr_form);
    if ($empr->empr_cb) {
        //Si il y a un code lecteur
        if (!$duplicate_empr_from_id) {
            $empr_form = str_replace("!!cb!!", $empr->empr_cb, $empr_form);
        } else {
            $empr_form = str_replace("!!cb!!", $cb, $empr_form);
        }
        $date_adhesion = !$duplicate_empr_from_id ? $empr->empr_date_adhesion : date('Y-m-d');
        $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=" . preg_replace('/-/', '', $date_adhesion) . "&param1=form_adhesion&param2=form_adhesion_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
        $adhesion = "\n\t\t\t\t<input type='hidden' name='form_adhesion' value='" . preg_replace('/-/', '', $date_adhesion) . "' />\n\t\t\t\t<input class='bouton' type='button' name='form_adhesion_lib' value='" . formatdate($date_adhesion) . "' " . $date_clic . " />";
        $empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form);
        $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=" . preg_replace('/-/', '', $empr->empr_date_expiration) . "&param1=form_expiration&param2=form_expiration_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 205, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
        $expiration = "\n\t\t\t\t<input type='hidden' id='form_expiration' name='form_expiration' value='" . preg_replace('/-/', '', $empr->empr_date_expiration) . "' />\n\t\t\t\t<input class='bouton' type='button' id='form_expiration_lib' name='form_expiration_lib' value='" . formatdate($empr->empr_date_expiration) . "' " . $date_clic . " />";
        $empr_form = str_replace("!!expiration!!", $expiration, $empr_form);
        // ajout ici des trucs sur la relance adhésion
        $empr_temp = new emprunteur($id, '', FALSE, 0);
        $aff_relance = "";
        if ($empr_temp->adhesion_renouv_proche() || $empr_temp->adhesion_depassee()) {
            if ($empr_temp->adhesion_depassee()) {
                $mess_relance = $msg[empr_date_depassee];
            } else {
                $mess_relance = $msg[empr_date_renouv_proche];
            }
            $rqt = "select duree_adhesion from empr_categ where id_categ_empr='{$empr_temp->categ}'";
            $res_dur_adhesion = mysql_query($rqt, $dbh);
            $row = mysql_fetch_row($res_dur_adhesion);
            $nb_jour_adhesion_categ = $row[0];
            if ($empr_prolong_calc_date_adhes_depassee && $empr_temp->adhesion_depassee()) {
                $rqt_date = "select date_add(curdate(),INTERVAL 1 DAY) as nouv_date_debut,\n\t\t\t\t\t\tdate_add(curdate(),INTERVAL {$nb_jour_adhesion_categ} DAY) as nouv_date_fin ";
            } else {
                $rqt_date = "select date_add('{$empr_temp->date_expiration}',INTERVAL 1 DAY) as nouv_date_debut,\n\t\t\t\t\t\tdate_add('{$empr_temp->date_expiration}',INTERVAL {$nb_jour_adhesion_categ} DAY) as nouv_date_fin ";
            }
            $resultatdate = mysql_query($rqt_date) or die("<br /> {$rqt_date} " . mysql_error());
            $resdate = mysql_fetch_object($resultatdate);
            $nouv_date_debut = $resdate->nouv_date_debut;
            $nouv_date_fin = $resdate->nouv_date_fin;
            $nouv_date_debut_formatee = formatdate($nouv_date_debut);
            $nouv_date_fin_formatee = formatdate($nouv_date_fin);
            // on conserve la date d'adhésion initiale
            $action_prolonger = "this.form.form_expiration.value = '{$nouv_date_fin}';\n\t\t\t\tthis.form.form_expiration_lib.value = '{$nouv_date_fin_formatee}';\n\t\t\t\t";
            $action_relance_courrier = "openPopUp('./pdf.php?pdfdoc=lettre_relance_adhesion&id_empr={$id}', 'lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes'); return(false) ";
            $aff_relance = "<div class='row'>\n\t\t\t\t\t\t<span class='erreur'>{$mess_relance}</span><br />\n\t\t\t\t\t\t<input class='bouton' type='button' value=\"" . $msg[prolonger] . "\" onClick=\"{$action_prolonger}\" />&nbsp;\n\t\t\t\t\t\t<input class='bouton' type='button' value=\"" . $msg[prolong_courrier] . "\" onClick=\"{$action_relance_courrier}\" />";
            if ($empr_temp->mail && $biblio_email) {
                $action_relance_mail = "if (confirm('" . $msg["mail_retard_confirm"] . "')) {openPopUp('./mail.php?type_mail=mail_relance_adhesion&id_empr={$id}', 'mail', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes'); } return(false) ";
                $aff_relance .= "&nbsp;<input class='bouton' type='button' value=\"" . $msg['prolong_mail'] . "\" onClick=\"{$action_relance_mail}\" />";
            }
            $aff_relance .= "</div>";
            if ($pmb_gestion_financiere && $pmb_gestion_abonnement) {
                $aff_relance .= "<div class='row'><input type='radio' name='debit' value='0' id='debit_0' " . (!$empr_abonnement_default_debit ? "checked" : "") . " /><label for='debit_0'>" . $msg["finance_abt_no_debit"] . "</label>&nbsp;<input type='radio' name='debit' value='1' id='debit_1' " . ($empr_abonnement_default_debit == 1 ? "checked" : "") . " />";
                $aff_relance .= "<label for='debit_1'>" . $msg["finance_abt_debit_wo_caution"] . "</label>&nbsp;";
                if ($pmb_gestion_abonnement == 2) {
                    $aff_relance .= "<input type='radio' name='debit' value='2' id='debit_2' " . ($empr_abonnement_default_debit == 2 ? "checked" : "") . " /><label for='debit_2'>" . $msg["finance_abt_debit_wt_caution"] . "</label>";
                }
                $aff_relance .= "</div>";
            }
        }
        $empr_form = str_replace("!!adhesion_proche_depassee!!", $aff_relance, $empr_form);
        //Liste des types d'abonnement
        $list_type_abt = "";
        if ($pmb_gestion_abonnement == 2 && $pmb_gestion_financiere) {
            $requete = "select * from type_abts order by type_abt_libelle ";
            $resultat_abt = mysql_query($requete);
            $user_loc = $deflt2docs_location;
            $t_type_abt = array();
            while ($res_abt = mysql_fetch_object($resultat_abt)) {
                $locs = explode(",", $res_abt->localisations);
                $as = array_search($user_loc, $locs);
                if ($as !== false && $as !== null || !$res_abt->localisations) {
                    $t_type_abt[] = $res_abt;
                }
            }
            if (count($t_type_abt)) {
                $list_type_abt = "<div class='row'>\n<label for='type_abt'>" . $msg["finance_type_abt"] . "</label></div>\n<div class='row'>\n<select name='type_abt' id='type_abt'>\n";
                for ($i = 0; $i < count($t_type_abt); $i++) {
                    $list_type_abt .= "<option value='" . $t_type_abt[$i]->id_type_abt . "'";
                    if ($empr->type_abt == $t_type_abt[$i]->id_type_abt) {
                        $list_type_abt .= " selected";
                    }
                    $list_type_abt .= ">" . htmlentities($t_type_abt[$i]->type_abt_libelle, ENT_QUOTES, $charset) . "</option>\n";
                }
                $list_type_abt .= "</select></div>";
            }
        }
        $empr_form = str_replace("!!typ_abonnement!!", $list_type_abt, $empr_form);
    } else {
        // création de lecteur
        $empr->empr_date_adhesion = today();
        $empr_form = str_replace('!!cb!!', $cb, $empr_form);
        $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=" . preg_replace('/-/', '', $empr->empr_date_adhesion) . "&param1=form_adhesion&param2=form_adhesion_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 250, 260, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
        $adhesion = "{$msg['1401']}{$msg['1901']}\n\t\t\t\t<input type='hidden' name='form_adhesion' value='" . preg_replace('/-/', '', $empr->empr_date_adhesion) . "'>\n\t\t\t\t<input class='bouton' type='button' name='form_adhesion_lib' value='" . formatdate($empr->empr_date_adhesion) . "' " . $date_clic . " />";
        $empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form);
        $empr_form = str_replace("!!adhesion_proche_depassee!!", "", $empr_form);
        $empr_form = str_replace("!!expiration!!", "<input type='hidden' name='form_expiration' value=''>", $empr_form);
        //Liste des types d'abonnement
        $list_type_abt = "";
        if ($pmb_gestion_abonnement == 2 && $pmb_gestion_financiere) {
            $requete = "select * from type_abts";
            $resultat_abt = mysql_query($requete);
            $user_loc = $deflt2docs_location;
            $t_type_abt = array();
            while ($res_abt = mysql_fetch_object($resultat_abt)) {
                $locs = explode(",", $res_abt->localisations);
                $as = array_search($user_loc, $locs);
                if ($as !== false && $as !== null || !$res_abt->localisations) {
                    $t_type_abt[] = $res_abt;
                }
            }
            if (count($t_type_abt)) {
                $list_type_abt = "<div class='row'>\n<label for='type_abt'>" . $msg["finance_type_abt"] . "</label></div>\n<div class='row'>\n<select name='type_abt' id='type_abt'>\n";
                for ($i = 0; $i < count($t_type_abt); $i++) {
                    $list_type_abt .= "<option value='" . $t_type_abt[$i]->id_type_abt . "'>" . htmlentities($t_type_abt[$i]->type_abt_libelle, ENT_QUOTES, $charset) . "</option>\n";
                }
                $list_type_abt .= "</select></div>";
            }
        }
        $empr_form = str_replace("!!typ_abonnement!!", $list_type_abt, $empr_form);
    }
    $empr_form = str_replace("!!nom!!", htmlentities($empr->empr_nom, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!prenom!!", htmlentities($empr->empr_prenom, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!adr1!!", htmlentities($empr->empr_adr1, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!adr2!!", htmlentities($empr->empr_adr2, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!cp!!", htmlentities($empr->empr_cp, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!ville!!", htmlentities($empr->empr_ville, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!pays!!", htmlentities($empr->empr_pays, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!mail!!", htmlentities($empr->empr_mail, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!tel1!!", htmlentities($empr->empr_tel1, ENT_QUOTES, $charset), $empr_form);
    if (!$empr->empr_sms) {
        $empr_sms_chk = '';
    } else {
        $empr_sms_chk = "checked='checked'";
    }
    $empr_form = str_replace('!!sms!!', $empr_sms_chk, $empr_form);
    $empr_form = str_replace("!!tel2!!", htmlentities($empr->empr_tel2, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!prof!!", htmlentities($empr->empr_prof, ENT_QUOTES, $charset), $empr_form);
    if ($empr->empr_year != 0) {
        $empr_form = str_replace("!!year!!", htmlentities($empr->empr_year, ENT_QUOTES, $charset), $empr_form);
    } else {
        $empr_form = str_replace("!!year!!", "", $empr_form);
    }
    if (!$empr->empr_lang) {
        $empr->empr_lang = $lang;
    }
    $empr_form = str_replace('!!combo_empr_lang!!', make_empr_lang_combo($empr->empr_lang), $empr_form);
    if (!$duplicate_empr_from_id) {
        $empr_form = str_replace('!!empr_login!!', $empr->empr_login, $empr_form);
        $empr_form = str_replace("!!empr_msg!!", htmlentities($empr->empr_msg, ENT_QUOTES, $charset), $empr_form);
    } else {
        $empr_form = str_replace('!!empr_login!!', "", $empr_form);
        $empr_form = str_replace("!!empr_msg!!", "", $empr_form);
    }
    // on récupère le select catégorie
    $requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle ";
    $res = mysql_query($requete, $link);
    $nbr_lignes = mysql_num_rows($res);
    $categ_content = '';
    $empr_grille_categ = "<select id='empr_grille_categ' style='display:none;'><option value='0' selected='selected' >" . $msg['all_categories_empr'] . "</value>";
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $categ_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_categ) {
            $categ_content .= " selected='selected'";
        }
        $categ_content .= ">{$row['1']}</option>";
        $empr_grille_categ .= "<option value='{$row['0']}'>{$row['1']}</option>";
    }
    $empr_grille_categ .= '</select>';
    $empr_form = str_replace("!!categ!!", $categ_content, $empr_form);
    // Ajout des categories et localisations pour edition des grilles
    $empr_form = str_replace("<!-- empr_grille_categ -->", $empr_grille_categ, $empr_form);
    if ($pmb_lecteurs_localises) {
        $empr_grille_location = docs_location::get_html_select(array(0), array('id' => 0, 'msg' => $msg['all_locations_empr']), array('id' => 'empr_grille_location', 'class' => 'saisie-20em', 'style' => 'display:none;'));
    } else {
        $empr_grille_location = "<input type='hidden' id='empr_grille_location' value='0' />";
    }
    $empr_form = str_replace("<!-- empr_grille_location -->", $empr_grille_location, $empr_form);
    $requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle ";
    $res = mysql_query($requete, $link);
    $grille_categ = "<option value='0' selected='selected'>" . $msg['all_categories_empr'] . "</value>";
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $categ_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_categ) {
            $categ_content .= " selected='selected'";
        }
        $categ_content .= ">{$row['1']}</option>";
        $grille_categ .= "<option value='{$row['0']}'>{$row['1']}</option>";
    }
    $empr_form = str_replace("!!categ!!", $categ_content, $empr_form);
    // on récupère le select statut
    $requete = "SELECT idstatut, statut_libelle FROM empr_statut ORDER BY statut_libelle ";
    //Si il n'y a pas de statut on prend celui définit pour l'utilisateur
    if (!$empr->empr_statut) {
        global $deflt_empr_statut;
        $empr->empr_statut = $deflt_empr_statut;
    }
    $res = mysql_query($requete, $link);
    $nbr_lignes = mysql_num_rows($res);
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $statut_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_statut) {
            $statut_content .= " selected='selected'";
        }
        $statut_content .= ">{$row['1']}</option>";
    }
    $empr_form = str_replace("!!statut!!", $statut_content, $empr_form);
    // et le select code stat
    // on récupère le select cod stat
    $requete = "SELECT idcode, libelle FROM empr_codestat ORDER BY libelle ";
    $res = mysql_query($requete, $link);
    $nbr_lignes = mysql_num_rows($res);
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $cstat_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_codestat) {
            $cstat_content .= " selected='selected'";
        }
        $cstat_content .= ">{$row['1']}</option>";
    }
    // mise à jour du sexe
    switch ($empr->empr_sexe) {
        case 1:
            $empr_form = str_replace("sexe_select_1", 'selected', $empr_form);
            break;
        case 2:
            $empr_form = str_replace("sexe_select_2", 'selected', $empr_form);
            break;
        default:
            $empr_form = str_replace("sexe_select_0", 'selected', $empr_form);
            break;
    }
    $empr_form = preg_replace("/sexe_select_[0-2]/m", '', $empr_form);
    $empr_form = str_replace("!!cstat!!", $cstat_content, $empr_form);
    // mise à jour du groupe
    if ($id) {
        $requete = "SELECT id_groupe, libelle_groupe, ifnull(empr_id,0) as inscription FROM groupe left join empr_groupe on (id_groupe=groupe_id  and empr_id=" . $id . ")  ORDER BY libelle_groupe";
    } else {
        $requete = "SELECT id_groupe, libelle_groupe, 0 as inscription FROM groupe ORDER BY libelle_groupe";
    }
    $groupe_form_aff = gen_liste_multiple($requete, "id_groupe", "libelle_groupe", "inscription", "id_grp[]", "", $id, 0, $msg[empr_form_aucungroupe], 0, $msg[empr_form_nogroupe], 5);
    $empr_form = str_replace("!!groupe_ajout!!", $groupe_form_aff, $empr_form);
    $empr_form = str_replace('!!cancel!!', $form_cancel, $empr_form);
    // ldap MaxMan
    if ($empr->empr_ldap) {
        $form_ldap = "checked";
    } else {
        $form_ldap = "";
    }
    //$empr_form = str_replace('!!empr_password!!', $empr_password, $empr_form);
    $empr_form = str_replace("!!ldap!!", $form_ldap, $empr_form);
    $empr_form = str_replace('!!empr_password!!', '', $empr_form);
    if (!$empr->empr_location) {
        $empr->empr_location = $deflt2docs_location;
    }
    if ($pmb_lecteurs_localises) {
        $loc = "\n\t\t<div class='row' id='g2_r1' etirable='yes' recept='yes' recepttype='circrow' highlight='circrow_highlight' downlight='circrow_downlight' >\n\t\t\t<div class='colonne4' id='g2_r1_f0' movable='yes' draggable='yes' dragtype='circcell' recept='yes' recepttype='circcell' highlight='circcell_highlight' downlight='circcell_downlight' title='" . htmlentities($msg['empr_location'], ENT_QUOTES, $charset) . "'>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<label for='form_empr_location' class='etiquette'>" . $msg['empr_location'] . "</label>\n\t\t\t\t\t</div>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t!!localisation!!\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t<div class='row'></div>\n\t\t</div>";
        //$loc = str_replace('!!localisation!!', docs_location::gen_combo_box_empr($empr->empr_location, 0), $loc);
        $loc = str_replace('!!localisation!!', docs_location::get_html_select(array($empr->empr_location), array(), array('id' => 'empr_location_id', 'name' => 'empr_location_id')), $loc);
    } else {
        $loc = "<input type='hidden' name='empr_location_id' id='empr_location_id' value='" . $empr->empr_location . "'>";
        $empr_form = str_replace('<!-- !!localisation!! -->', $loc, $empr_form);
    }
    $empr_form = str_replace('<!-- !!localisation!! -->', $loc, $empr_form);
    if ($pmb_opac_view_activate) {
        $opac_view_tpl = "\n\t\t\t<div class='row' id='g4_r1_f0' movable='yes' draggable='yes' dragtype='circcell' recept='yes' recepttype='circcell' highlight='circcell_highlight' downlight='circcell_downlight' title='" . htmlentities($msg['empr_form_opac_view'], ENT_QUOTES, $charset) . "'>\t\t\t\t\n\t\t\t\t\t!!opac_view!!\n\t\t\t</div>";
        $opac_view = new opac_view(0, $id);
        $opac_view_tpl = str_replace("!!opac_view!!", gen_plus("opac_view", $msg["empr_form_opac_view"], $opac_view->do_sel_list(), 0), $opac_view_tpl);
    }
    $empr_form = str_replace('<!-- !!opac_view!! -->', $opac_view_tpl, $empr_form);
    //Champs persos
    $p_perso = new parametres_perso("empr");
    $perso_ = $p_perso->show_editable_fields($id);
    if (count($perso_["FIELDS"])) {
        $perso = "<div class='row'></div>";
    } else {
        $perso = "";
    }
    $class = "colonne2";
    for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
        $p = $perso_["FIELDS"][$i];
        $perso .= "<div class='{$class}' id='g6_r0_f" . $i . "' movable='yes' draggable='yes' dragtype='circcell' recept='yes' recepttype='circcell' highlight='circcell_highlight' downlight='circcell_downlight' title='" . htmlentities($p['TITRE'], ENT_QUOTES, $charset) . "' >";
        $perso .= "<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label></div>\n";
        $perso .= "<div class='row'>";
        $perso .= $p["AFF"] . "</div>";
        $perso .= "</div>";
        if ($class == "colonne2") {
            $class = "colonne_suite";
        } else {
            $class = "colonne2";
        }
    }
    if ($class == "colonne_suite") {
        $perso .= "<div class='{$class}'>&nbsp;</div>";
    }
    $perso .= $perso_["CHECK_SCRIPTS"];
    $empr_form = str_replace("!!champs_perso!!", $perso, $empr_form);
    $empr_form = str_replace('!!empr_notice_override!!', get_rights_form($id), $empr_form);
    print pmb_bidi($empr_form);
}
function bul_do_form($obj)
{
    // $obj = objet contenant les propriétés de l'exemplaire associé
    global $bul_expl_form1, $expl_bulletinage_tpl;
    global $msg;
    // pour texte du bouton supprimer
    global $dbh, $charset;
    global $pmb_type_audit, $select_categ_prop, $pmb_antivol;
    global $id_bull, $bul_id, $serial_id, $numero, $pmb_rfid_activate, $pmb_rfid_serveur_url;
    global $deflt_explnum_statut;
    if (!$obj->abt_numeric) {
        $bul_expl_form1 = str_replace('!!expl_bulletinage_tpl!!', $expl_bulletinage_tpl, $bul_expl_form1);
    } else {
        $bul_expl_form1 = str_replace('!!expl_bulletinage_tpl!!', "", $bul_expl_form1);
    }
    $action = "./pointage_exemplarise.php?act=update&id_bull={$id_bull}&bul_id={$bul_id}";
    // statut
    $select_statut = gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "f_explnum_statut", "", $deflt_explnum_statut, "", "", "", "", 0);
    $bul_expl_form1 = str_replace('!!statut_list!!', $select_statut, $bul_expl_form1);
    // mise à jour des champs de gestion
    $bul_expl_form1 = str_replace('!!bul_id!!', $obj->expl_bulletin, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!id_form!!', md5(microtime()), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!org_cb!!', $obj->expl_cb, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!action!!', $action, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!id!!', $obj->expl_notice, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!cb!!', $obj->expl_cb, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!note!!', $obj->expl_note, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!comment!!', $obj->expl_comment, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!cote!!', htmlentities($obj->expl_cote, ENT_QUOTES, $charset), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!prix!!', $obj->expl_prix, $bul_expl_form1);
    if (!$obj->abt_numeric) {
        $bul_expl_form1 = str_replace('!!focus!!', $obj->focus, $bul_expl_form1);
    } else {
        $bul_expl_form1 = str_replace('!!focus!!', "", $bul_expl_form1);
    }
    // select "type document"
    $bul_expl_form1 = str_replace('!!type_doc!!', do_selector('docs_type', 'expl_typdoc', $obj->expl_typdoc), $bul_expl_form1);
    // select "section"
    $bul_expl_form1 = str_replace('!!section!!', do_selector_bul_section($obj->expl_section, $obj->expl_location), $bul_expl_form1);
    // select "statut"
    $bul_expl_form1 = str_replace('!!statut!!', do_selector('docs_statut', 'expl_statut', $obj->expl_statut), $bul_expl_form1);
    // select "localisation"
    $bul_expl_form1 = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where num_location=idlocation order by 2", "idlocation", "location_libelle", 'expl_location', "calcule_section(this);", $obj->expl_location, "", "", "", "", 0), $bul_expl_form1);
    // select "code statistique"
    $bul_expl_form1 = str_replace('!!codestat!!', do_selector('docs_codestat', 'expl_codestat', $obj->expl_codestat), $bul_expl_form1);
    // select "owner"
    $bul_expl_form1 = str_replace('!!owner!!', do_selector('lenders', 'expl_owner', $obj->expl_owner), $bul_expl_form1);
    $selector = "";
    if ($pmb_antivol > 0) {
        // select "type_antivol"
        $selector = "\n\t\t<div class='colonne3'>\n\t\t<!-- code stat -->\n\t\t<label class='etiquette' for='type_antivol'>{$msg['type_antivol']}</label>\n\t\t<div class='row'>\n\t\t<select name='type_antivol' id='type_antivol'>";
        $selector .= "<option value='0'";
        if ($obj->type_antivol == 0) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_aucun"] . '</option>';
        $selector .= "<option value='1'";
        if ($obj->type_antivol == 1) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_magnetique"] . '</option>';
        $selector .= "<option value='2'";
        if ($obj->type_antivol == 2) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_autre"] . '</option>';
        $selector .= '</select></div></div>';
    }
    $bul_expl_form1 = str_replace('!!type_antivol!!', $selector, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_id!!', $bul_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_no!!', htmlentities($obj->bul_no, ENT_QUOTES, $charset), $bul_expl_form1);
    $date_date_formatee = formatdate_input($obj->date_date);
    $date_clic = "onClick=\"openPopUp('./../../../select.php?what=calendrier&caller=expl&date_caller=" . str_replace('-', '', $obj->date_date) . "&param1=date_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' name='date_date' value='" . str_replace('-', '', $obj->date_date) . "' />\n\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<input class='bouton_small' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
    $bul_expl_form1 = str_replace('!!date_date!!', $date_date, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_date!!', htmlentities($obj->bul_date, ENT_QUOTES, $charset), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_titre!!', htmlentities($obj->bul_titre, ENT_QUOTES, $charset), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!serial_id!!', $serial_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!numero!!', $obj->bul_titre, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!destinataire!!', $obj->destinataire, $bul_expl_form1);
    $p_perso = new parametres_perso("expl");
    if (!$p_perso->no_special_fields) {
        $c = 0;
        $perso = "";
        $perso_ = $p_perso->show_editable_fields($obj->expl_id);
        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
            $p = $perso_["FIELDS"][$i];
            if ($c == 0) {
                $perso .= "<div class='row'>\n";
            }
            $perso .= "<div class='colonne3'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "<div class='row'>" . $p["AFF"] . "</div></div>\n";
            $c++;
            if ($c == 3) {
                $perso .= "</div>\n";
                $c = 0;
            }
        }
        if ($c == 1) {
            $perso .= "<div class='colonne2'>&nbsp;</div>\n</div>\n";
        }
        $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso;
    } else {
        $perso = "\n<script>function check_form() { return true; }</script>\n";
    }
    $bul_expl_form1 = str_replace("!!champs_perso!!", $perso, $bul_expl_form1);
    if ($pmb_rfid_activate == 1 && $pmb_rfid_serveur_url && !$obj->abt_numeric) {
        $script_rfid_encode = "if(script_rfid_encode()==false) return false;";
        $bul_expl_form1 = str_replace('!!questionrfid!!', $script_rfid_encode, $bul_expl_form1);
    } else {
        $bul_expl_form1 = str_replace('!!questionrfid!!', '', $bul_expl_form1);
    }
    $bul_expl_form1 = str_replace('!!create_notice_bul!!', '<input type="checkbox" value="1" id="create_notice_bul" name="create_notice_bul">&nbsp;' . $msg['bulletinage_create_notice'], $bul_expl_form1);
    return $bul_expl_form1;
}
Beispiel #6
0
         $script = "<script>setTimeout(\"document.preload.submit()\",2000);</script>";
     }
     print $formulaire;
     print $script;
 } else {
     // import de notice
     /* Does the file exist ? */
     if ($file_submit == "") {
         $filename = $base_path . "/admin/import/" . $nom_fichier_transfert_ftp;
         $from_file = "unimarc" . (defined("LOCATION") ? "_" . constant("LOCATION") : "") . ".fic";
     } else {
         $filename = $file_submit;
     }
     if ($isbn_mandatory == "") {
         /* l'utilisateur n'est pas passé par le téléchargement du fichier, il faut qu'il nous dise si l'ISBN est obligatoire */
         print "\n\t\t            <form class='form-{$current_module}' NAME=\"preload\" METHOD=\"post\" ACTION=\"iimport_expl.php\">\n\t\t            <h3>" . $msg['import_noti_form_titre'] . "</h3>\n\t\t            <div class='form-contenu'>\n\t\t        \t<div class='row'>\n\t\t        \t    <div class='colonne2'>\n\t\t    \t            <label class='etiquette' for='isbn_obligatoire'>{$msg['564']}</label><br />\n\t\t\t                <INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n\t\t                    <INPUT TYPE='radio' NAME='isbn_mandatory' id='io0' VALUE='0' CLASS='radio' checked='checked' /><label for='io0'> {$msg['39']} </label>\n\t\t                </div>\n\t\t                <div class='colonne-suite'>\n\t\t            \t    <label class='etiquette' for='isbn_dedoublonnage'>{$msg['568']}</label><br />\n\t\t        \t        <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di1' VALUE='1' CLASS='radio' checked='checked' /><label for='di1'> {$msg['40']} </label>\n\t\t    \t            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di0' VALUE='0' CLASS='radio' /><label for='di0'> {$msg['39']} </label>\n\t\t\t                <input type='checkbox' name='isbn_only' id='ionly' value='1' /><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n\t\t                </div>\n\t\t             </div>\n\t\t\t\t\t<div class='row'>&nbsp;</div>\n\t\t            <div class='row'>\n                        <div class='colonne2'>\t\n                    \t\t<label class='etiquette' for='statutnot'>{$msg['import_statutnot']}</label>\n                    \t\t<div>\n                    \t\t" . gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "statutnot", "", 1, "", "", "", "", 0) . "\n                    \t\t</div>\n                    \t</div>\n                    \t<div class='colonne-suite'>\n                    \t\t<label class='etiquette' for='generer_lien'>" . $msg['import_genere_liens'] . "</label><br />\n                    \t\t<INPUT TYPE='radio' NAME='link_generate' id='link1' VALUE=' 1' CLASS='radio' /><label for='link1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='link_generate' id='link0' VALUE='0' CLASS='radio' checked='checked' /><label for='link0'> {$msg['39']} </label>\n                    \t</div>\n                    </div>\n                    <div class='row'>&nbsp;</div>\n                   \t<div class='row'>\n                   \t\t<div class='colonne2'>\n                   \t\t\t&nbsp;<br />\n                   \t\t\t&nbsp;\n                   \t\t</div>\n                   \t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t<label class='etiquette' for='authorities_notices'>" . htmlentities($msg['import_with_authorities_notices'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices1' value='1' class='radio' /><label for='authorities_notices1'>" . htmlentities($msg[40], ENT_QUOTES, $charset) . "</label>          \t\t\t\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices0' value='0' class='radio' checked='checked'/><label for='authorities_notices0'>" . htmlentities($msg[39], ENT_QUOTES, $charset) . "</label>\n                    \t</div>\n                   \t</div>\n                   \t<div class='row'>&nbsp;</div>\n                   \t<div clas='row'>\n                   \t\t<div class='colonne2'>\n                   \t\t\t&nbsp;<br />\n                   \t\t\t&nbsp;\n                   \t\t</div>\n                   \t\t<div class='colonne-suite'>\n                   \t\t\t<label class='etiquette' for='authorities_default_origin'>" . htmlentities($msg['import_authorities_origin_default_value'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t" . origin::gen_combo_box("authorities", "authorities_default_origin") . "\n                   \t\t</div> \n                   \t</div>\n                   \t<div class='row'>&nbsp;</div>\n                    <div clas='row'>\n\t\t            \t<INPUT TYPE=\"SUBMIT\"  class='bouton' NAME=\"upload\" VALUE=\"" . $msg[502] . "\" />\n\t\t            </div>\n\t\t            <INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />\n\t\t            <INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import\" />\n\t\t            <INPUT NAME=\"action\" TYPE=\"hidden\" value=\"preload\" />\n\t\t            <INPUT NAME=\"" . $name_func . "\" TYPE=\"hidden\" value=\"" . ${$name_func} . "\"/>\n\t\t            </FORM>";
         break;
     }
     loadfile_in_table();
     if ($pb_fini == "EOF") {
         $formulaire = "<form class='form-{$current_module}' name=\"load\" method=\"post\" action=\"iimport_expl.php\">";
         $formulaire .= "<INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />";
         $formulaire .= "<INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import\" />";
         $formulaire .= "<INPUT NAME=\"action\" TYPE=\"hidden\" value=\"load\" />";
         $formulaire .= "<input type=\"hidden\" name=\"filename\" value=\"{$filename}\" />";
         $formulaire .= "<input type=\"hidden\" name=\"from_file\" value=\"{$from_file}\" />";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"isbn_mandatory\" VALUE=\"{$isbn_mandatory}\" />\n";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"isbn_dedoublonnage\" VALUE=\"{$isbn_dedoublonnage}\" />\n";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"isbn_only\" VALUE=\"{$isbn_only}\" />\n";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"statutnot\" VALUE=\"{$statutnot}\" />\n";
         $formulaire .= "<input type=\"hidden\" name=\"recharge\" value=\"YES\" />";
Beispiel #7
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;
     global $thesaurus_concepts_active;
     global $pmb_map_activate;
     global $pmb_notices_show_dates;
     global $thesaurus_categories_affichage_ordre;
     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;
     }
     if ($pmb_authors_qualification) {
         $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_0["id_responsability"], TYPE_NOTICE_RESPONSABILITY_PRINCIPAL), 'notice_authors'));
         $ptab[1] = str_replace('!!vedette_author!!', $vedette_ui->get_form('role', 0, 'notice'), $ptab[1]);
     } else {
         $ptab[1] = str_replace('!!vedette_author!!', "", $ptab[1]);
     }
     $ptab[1] = str_replace('!!iaut!!', 0, $ptab[1]);
     $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 = $ptab[11];
         $ptab_aut_tu = str_replace('!!iaut!!', $i, $tu_authors_tpl);
         if ($i) {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', 'display:none', $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', '', $ptab_aut_autres);
         }
         if ($pmb_authors_qualification) {
             $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_1["id_responsability"], TYPE_NOTICE_RESPONSABILITY_AUTRE), 'notice_authors'));
             $ptab_aut_autres = str_replace('!!vedette_author!!', $vedette_ui->get_form('role_autre', $i, 'notice', '', 0), $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!vedette_author!!', "", $ptab_aut_autres);
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab_aut_autres);
         $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 = $ptab[12];
         if ($i) {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', 'display:none', $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', '', $ptab_aut_autres);
         }
         if ($pmb_authors_qualification) {
             $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_2["id_responsability"], TYPE_NOTICE_RESPONSABILITY_SECONDAIRE), 'notice_authors'));
             $ptab_aut_autres = str_replace('!!vedette_author!!', $vedette_ui->get_form('role_secondaire', $i, 'notice', '', 0), $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!vedette_author!!', "", $ptab_aut_autres);
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab_aut_autres);
         $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
     //tri ?
     if ($thesaurus_categories_affichage_ordre == 0 && count($this->categories)) {
         $tmp = array();
         foreach ($this->categories as $key => $value) {
             $tmp[$key] = strip_tags($value['categ_libelle']);
         }
         $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] = $this->categories[$key];
             //On reprend les bons couples
         }
         $this->categories = array_values($tmp);
     }
     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_thesaurus = '[' . $categ->thes->getLibelle() . '] ';
             } else {
                 $nom_thesaurus = '';
             }
             $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus . $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]);
     // Indexation concept
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_NOTICE);
         $ptab[6] = str_replace('!!index_concept_form!!', $index_concept->get_form("notice"), $ptab[6]);
     } else {
         $ptab[6] = str_replace('!!index_concept_form!!', "", $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
     global $pmb_curl_timeout;
     $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]);
     $ptab[8] = str_replace('!!pmb_curl_timeout!!', $pmb_curl_timeout, $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>" . $p["COMMENT_DISPLAY"] . "</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]);
     if ($this->is_new) {
         $ptab[10] = str_replace('!!checked_yes!!', "checked", $ptab[10]);
         $ptab[10] = str_replace('!!checked_no!!', "", $ptab[10]);
     } else {
         $ptab[10] = str_replace('!!checked_no!!', "checked", $ptab[10]);
         $ptab[10] = str_replace('!!checked_yes!!', "", $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 = 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]);
     if ($this->id && $pmb_notices_show_dates) {
         $create_date = new DateTime($this->create_date);
         $update_date = new DateTime($this->update_date);
         $dates_notices = "<br>\n\t\t\t\t\t<label for='notice_date_crea' class='etiquette'>" . $msg["noti_crea_date"] . "</label>&nbsp;" . $create_date->format('d/m/Y H:i:s') . "\n\t\t\t    \t<br>\n\t\t\t    \t <label for='notice_date_mod' class='etiquette'>" . $msg["noti_mod_date"] . "</label>&nbsp;" . $update_date->format('d/m/Y H:i:s');
         $ptab[10] = str_replace('!!dates_notice!!', $dates_notices, $ptab[10]);
     } else {
         $ptab[10] = str_replace('!!dates_notice!!', "", $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);
     // autorité personnalisées
     $authperso = new authperso_notice($this->id);
     $authperso_tpl = $authperso->get_form();
     $form_notice = str_replace('!!authperso!!', $authperso_tpl, $form_notice);
     $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice);
     // map
     if ($pmb_map_activate) {
         if ($this->duplicate_from_id) {
             $map_edition = new map_edition_controler(TYPE_RECORD, $this->duplicate_from_id);
         } else {
             $map_edition = new map_edition_controler(TYPE_RECORD, $this->id);
         }
         $map_form = $map_edition->get_form();
         if ($this->duplicate_from_id) {
             $map_info = new map_info($this->duplicate_from_id);
         } else {
             $map_info = new map_info($this->id);
         }
         $map_form_info = $map_info->get_form();
         $map_notice_form = $ptab[14];
         $map_notice_form = str_replace('!!notice_map!!', $map_form . $map_form_info, $map_notice_form);
         $form_notice = str_replace('!!tab14!!', $map_notice_form, $form_notice);
     } else {
         $form_notice = str_replace('!!tab14!!', "", $form_notice);
     }
     // Nomenclature
     if ($pmb_nomenclature_activate) {
         $nomenclature = new nomenclature_record_ui($this->id);
         $nomenclature_notice_form = $ptab[15];
         $nomenclature_notice_form = str_replace('!!nomenclature_form!!', $nomenclature->get_form(), $nomenclature_notice_form);
         $form_notice = str_replace('!!tab15!!', $nomenclature_notice_form, $form_notice);
     } else {
         $form_notice = str_replace('!!tab15!!', "", $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 = pmb_mysql_query($req_loc);
         if (pmb_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 = pmb_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;
 }
Beispiel #8
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: import_func.inc.php,v 1.111.2.3 2015-02-04 08:48:20 mbertin Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/serials.class.php";
require_once $class_path . "/category_auto.class.php";
require_once $class_path . "/origin.class.php";
require_once $class_path . "/notice_doublon.class.php";
// templates
$tpl_beforeupload_expl = "\n                <form class='form-{$current_module}' ENCTYPE=\"multipart/form-data\" METHOD=\"post\" ACTION=\"iimport_expl.php\">\n                <h3>" . $msg['import_expl_form_titre'] . "</h3>\n                <div class='form-contenu'>\n                    <div class='row'>\n                        <div class='colonne2'>\n                            <label class='etiquette' >{$msg['564']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io0' VALUE='0' CLASS='radio' checked='checked' /><label for='io0'> {$msg['39']} </label>\n                        </div>\n                        <div class='colonne-suite'>\n                            <label class='etiquette' >{$msg['568']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di1' VALUE='1' CLASS='radio' checked='checked' /><label for='di1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di0' VALUE='0' CLASS='radio' /><label for='di0'> {$msg['39']} </label>\n                            <input type='checkbox' name='isbn_only' id='ionly' value='1' checked='checked' /><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n                       </div>\n                    </div>\n                    <div class='row'>&nbsp;</div>\n                    <div class='row'>\n                        <div class='colonne2'>\t\n                    \t\t<label class='etiquette' for='statutnot'>{$msg['import_statutnot']}</label>\n                    \t\t<div>\n                    \t\t" . gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "statutnot", "", 1, "", "", "", "", 0) . "\n                    \t\t</div>\n                    \t</div>\n                    \t<div class='colonne-suite'>\n                    \t\t<label class='etiquette' >" . $msg['import_genere_liens'] . "</label><br />\n                    \t\t<INPUT TYPE='radio' NAME='link_generate' id='link1' VALUE=' 1' CLASS='radio' /><label for='link1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='link_generate' id='link0' VALUE='0' CLASS='radio' checked='checked' /><label for='link0'> {$msg['39']} </label>\n                    \t</div>\n                    </div>\n                    <div class='row'>&nbsp;</div>\n                   \t<div class='row'>\n                   \t\t<div class='colonne2'>\n                   \t\t\t&nbsp;<br />\n                   \t\t\t&nbsp;\n                   \t\t</div>\n                   \t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t<label class='etiquette' for='authorities_notices'>" . htmlentities($msg['import_with_authorities_notices'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices1' value='1' class='radio' /><label for='authorities_notices1'>" . htmlentities($msg[40], ENT_QUOTES, $charset) . "</label>          \t\t\t\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices0' value='0' class='radio' checked='checked'/><label for='authorities_notices0'>" . htmlentities($msg[39], ENT_QUOTES, $charset) . "</label>\n                    \t</div>\n                   \t</div>\n                   \t<div class='row'>&nbsp;</div>\n                   \t\t<div clas='row'>\n                   \t\t\t<div class='colonne2'>\n                   \t\t\t\t&nbsp;<br />\n                   \t\t\t\t&nbsp;\n                   \t\t\t</div>\n                   \t\t\t<div class='colonne-suite'>\n                   \t\t\t\t<label class='etiquette' for='authorities_default_origin'>" . htmlentities($msg['import_authorities_origin_default_value'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t\t" . origin::gen_combo_box("authorities") . "\n                   \t\t\t</div> \n                   \t\t</div>\n                    <div class='row'><hr /></div>\n\t\t\t\t\t<div class='row'>\n                        <label class='etiquette' for='preteur statut'>{$msg['560']}</label>\n                    </div>\n                    <div class='row'>" . lender::gen_combo_box($book_lender_id) . "&nbsp;&nbsp;" . docs_statut::gen_combo_box($book_statut_id) . "\n                    </div>\n                    <div class='row'>\n                        <label class='etiquette' for='localisation'>{$msg['import_localisation']}</label>\n                    </div>\n                    <div class='row'>" . docs_location::gen_combo_box($deflt_docs_location) . "\n                    </div>\n                    <div class='row'><hr /></div>\n                    <div class='row'>\n                        <label class='etiquette' for='cote_obligatoire'>{$msg['566']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='cote_mandatory' id='cm1' VALUE='1' CLASS='radio' /><label for='cm1'> {$msg['40']} </label>\n                        <INPUT TYPE='radio' NAME='cote_mandatory' id='cm0' VALUE='0' CLASS='radio' checked='checked' /><label for='cm0'> {$msg['39']} </label>\n                    </div>\n                    <div class='row'><hr /></div>\n                    <div class='row'>\n                        <label class='etiquette'>{$msg['17']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='tdoc_codage' id='td1' VALUE='1' CLASS='radio' /><label for='td1'> " . $msg["import_expl_codage_proprio"] . "</label>\n                        <INPUT TYPE='radio' NAME='tdoc_codage' id='td0' VALUE='0' CLASS='radio' checked='checked' /><label for='td0'> " . $msg["import_expl_codage_generique"] . "</label>\n                    </div>\n                    <div class='row'>\n                        <label class='etiquette'>{$msg['24']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='statisdoc_codage' id='sd1' VALUE='1' CLASS='radio' /><label for='sd1'> " . $msg["import_expl_codage_proprio"] . "</label>\n                        <INPUT TYPE='radio' NAME='statisdoc_codage' id='sd0' VALUE='0' CLASS='radio' checked='checked' /><label for='sd0'> " . $msg["import_expl_codage_generique"] . "</label>\n                    </div>\n                    <div class='row'>\n                        <label class='etiquette'>{$msg['19']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='sdoc_codage' id='sdc1' VALUE='1' CLASS='radio' /><label for='sdc1'> " . $msg["import_expl_codage_proprio"] . "</label>\n                        <INPUT TYPE='radio' NAME='sdoc_codage' id='sdc0' VALUE='0' CLASS='radio' checked='checked' /><label for='sdc0'> " . $msg["import_expl_codage_generique"] . "</label>\n                    </div>\n                    <div class='row'><hr /></div>\n\n                    <div class='row'>\n                        <label class='etiquette' for='txt_suite'>{$msg['501']}</label>\n                        </div>\n                    <div class='row'>\n                        <INPUT NAME='userfile' class='saisie-80em' TYPE='file' size='60' />\n                        <INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />\n                        <INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import_expl\" />\n                        <INPUT NAME=\"action\" TYPE=\"hidden\" value=\"afterupload\" />\n                    </div>\n                    </div>\n                <INPUT TYPE='SUBMIT' class='bouton' NAME='upload' VALUE='" . $msg[502] . "' />\n                </FORM>";
$tpl_beforeupload_notices = "\n                    <form class='form-{$current_module}' ENCTYPE='multipart/form-data' METHOD='post' ACTION='iimport_expl.php' />\n                    <h3>" . $msg['import_noti_form_titre'] . "</h3>\n                    <div class='form-contenu'>\n                    <div class='row'>\n                        <div class='colonne2'>\n                            <label class='etiquette' for='isbn_obligatoire'>{$msg['564']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io0' VALUE='0' CLASS='radio' checked='checked' /><label for='io0'> {$msg['39']} </label>\n                            </div>\n                        <div class='colonne-suite'>\n                            <label class='etiquette' for='isbn_dedoublonnage'>{$msg['568']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di1' VALUE='1' CLASS='radio' checked='checked' /><label for='di1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di0' VALUE='0' CLASS='radio' /><label for='di0'> {$msg['39']} </label>\n                            <input type='checkbox' name='isbn_only' id='ionly' value='1' /><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n                            </div>\n                        </div>\n                        <div class='row'>&nbsp;</div>\n\t\t\t\t\t\t<div class='row'>\n\t                        <div class='colonne2'>\t\n\t                    \t\t<label class='etiquette' for='statutnot'>{$msg['import_statutnot']}</label>\n\t                    \t\t<div>\n\t                    \t\t" . gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "statutnot", "", 1, "", "", "", "", 0) . "\n\t                    \t\t</div>\n\t                    \t</div>\n\t                    \t<div class='colonne-suite'>\n\t                    \t\t<label class='etiquette' for='generer_lien'>" . $msg['import_genere_liens'] . "</label><br />\n\t                    \t\t<INPUT TYPE='radio' NAME='link_generate' id='link1' VALUE='1' CLASS='radio' /><label for='link1'> {$msg['40']} </label>\n\t                            <INPUT TYPE='radio' NAME='link_generate' id='link0' VALUE='0' CLASS='radio' checked='checked' /><label for='link0'> {$msg['39']} </label>\n\t                    \t</div>\n                   \t\t</div>\n                   \t\t<div class='row'>&nbsp;</div>\n                   \t\t<div class='row'>\n                   \t\t\t<div class='colonne2'>\n                   \t\t\t\t&nbsp;<br />\n                   \t\t\t\t&nbsp;\n                   \t\t\t</div>\n                   \t\t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t\t<label class='etiquette' for='authorities_notices'>" . htmlentities($msg['import_with_authorities_notices'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices1' value='1' class='radio' /><label for='authorities_notices1'>" . htmlentities($msg[40], ENT_QUOTES, $charset) . "</label>          \t\t\t\n\t\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices0' value='0' class='radio' checked='checked'/><label for='authorities_notices0'>" . htmlentities($msg[39], ENT_QUOTES, $charset) . "</label>\n                   \t\t\t</div>\n                   \t\t</div>\n                   \t\t<div class='row'>&nbsp;</div>\n                   \t\t<div clas='row'>\n                   \t\t\t<div class='colonne2'>\n                   \t\t\t\t&nbsp;<br />\n                   \t\t\t\t&nbsp;\n                   \t\t\t</div>\n                   \t\t\t<div class='colonne-suite'>\n                   \t\t\t\t<label class='etiquette' for='authorities_default_origin'>" . htmlentities($msg['import_authorities_origin_default_value'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t\t" . origin::gen_combo_box("authorities", "authorities_default_origin") . "\n                   \t\t\t</div> \n                   \t\t</div>\n\t                    <div class='row'>&nbsp;</div>\n                        <div class='row'>\n                            <label class='etiquette' for='txt_suite'>{$msg['501']}</label>\n                            </div>\n                        <div class='row'>\n                            <INPUT NAME='userfile' class='saisie-80em' TYPE='file' size='60' />\n                            <INPUT NAME='categ' TYPE='hidden' value='import' />\n                            <INPUT NAME='sub' TYPE='hidden' value='import' />\n                            <INPUT NAME='action' TYPE='hidden' value='afterupload' />\n                            </div>\n                        </div>\n                    <INPUT TYPE='SUBMIT' class='bouton' NAME='upload' VALUE='" . $msg[502] . "' />\n                    </FORM>";
// PRELOAD
function loadfile_in_table()
{
    global $msg;
    global $sub, $book_lender_name;
    global $noticenumber, $filename, $from_file, $pb_fini, $recharge;
    global $pmb_import_limit_read_file;
    if ($noticenumber == "") {
        $noticenumber = 0;
    }
    if (!file_exists($filename)) {
        printf($msg[506], $from_file);
        /* The file %s doesn't exist... */
        return;
    }
Beispiel #9
0
 function fill_form(&$form, $action, $suppr = '')
 {
     global $charset;
     global $msg, $lang;
     global $pmb_scan_pmbws_client_url, $pmb_scan_pmbws_url;
     global $pmb_indexation_docnum, $dbh, $pmb_explnum_statut;
     global $b_mimetype;
     global $pmb_docnum_in_directory_allow, $pmb_docnum_in_database_allow;
     global $explnum_id;
     global $pmb_diarization_docnum;
     global $base_path;
     global $thesaurus_concepts_active;
     $form = str_replace('!!action!!', $action, $form);
     $form = str_replace('!!explnum_id!!', $this->explnum_id, $form);
     $form = str_replace('!!bulletin!!', $this->explnum_bulletin, $form);
     $form = str_replace('!!notice!!', $this->explnum_notice, $form);
     $form = str_replace('!!nom!!', htmlentities($this->explnum_nom, ENT_QUOTES, $charset), $form);
     $form = str_replace('!!url!!', htmlentities($this->explnum_url, ENT_QUOTES, $charset), $form);
     //Gestion de l'interface d'indexation
     if ($pmb_indexation_docnum) {
         $checkbox = "<div class='row'>\n\t\t\t\t \t\t<input type='checkbox' id='ck_index' value='1' name='ck_index' {$this->explnum_index} /><label for='ck_index'>{$msg['docnum_a_indexer']}</label>\t\n\t\t\t\t \t</div>\n\t\t\t\t ";
         if ($this->explnum_index_sew != '' && $this->explnum_index_wew != '') {
             $fct = "\n\t\t\t\t \t<script> function suppr_index(form){\n\t\t\t\t \t\t if(!form.ck_index.checked) {\n\t\t\t\t \t\t \tconf = confirm(\"" . $msg['docnum_suppr_index'] . "\");\n\t\t\t\t \t\t\treturn conf;\n\t\t\t\t \t\t } \n\t\t\t\t \t\t return true;\n\t\t\t\t \t}</script>\n\t\t\t\t \t";
             $form = str_replace("!!submit_action!!", 'return suppr_index(this)', $form);
         } else {
             $fct = "";
             $form = str_replace("!!submit_action!!", "return testing_file(" . $this->explnum_id . ");", $form);
         }
         $form = str_replace('!!ck_indexation!!', $checkbox . $fct, $form);
     } else {
         $form = str_replace("!!ck_indexation!!", "", $form);
         $form = str_replace("!!submit_action!!", "return testing_file(" . $this->explnum_id . ");", $form);
     }
     //Gestion de l'interface de segmentation
     if ($pmb_diarization_docnum) {
         $checkbox = "<div class='row'>\n\t\t\t\t \t\t<input type='checkbox' id='ck_diarization' value='1' name='ck_diarization' /><label for='ck_diarization'>" . $msg['diarize_explnum'] . "</label>\t\n\t\t\t\t \t</div>\n\t\t\t\t ";
         $form = str_replace('!!ck_diarization!!', $checkbox, $form);
     } else {
         $form = str_replace("!!ck_diarization!!", "", $form);
     }
     //Gestion du scanner
     if ($pmb_scan_pmbws_client_url && $pmb_scan_pmbws_url) {
         $scan_addon = "\n\t\t\t\t<script>function afterscan(format) {\n\t\t\t\t\tif (document.explnum.f_fichier) {\n\t\t\t\t\t\tsitxt=document.createElement('span');\n\t\t\t\t\t\tsitxt.setAttribute('id','scanned_image_txt');\n\t\t\t\t\t\tsitxt.className='erreur';\n\t\t\t\t\t\tdocument.explnum.f_fichier.parentNode.replaceChild(sitxt,document.explnum.f_fichier);\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById('scanned_image_txt').innerHTML='" . $msg["scan_image_recorded"] . "';\n\t\t\t\t\tdocument.getElementById('scanned_image_ext').value=format;\n\t\t\t\t}</script>\n\t\t\t\t<input type='button' value='" . $msg["scan_button"] . "' onClick='openPopUp(\"" . $pmb_scan_pmbws_client_url . "?scanfield=scanned_image&urlbase=" . rawurlencode($pmb_scan_pmbws_url) . "&scanform=explnum&callbackimage=afterscan&lang={$lang}&charset={$charset}\",\"scanWindow\",900,700,0,0,\"scrollbars=yes, resizable=yes\")' class='bouton'/>\n\t\t\t\t<input type='hidden' name='scanned_image_ext' id='scanned_image_ext' value=''/>\n\t\t\t\t<input type='hidden' name='scanned_image' value=''/>\n\t\t\t\t<input type='hidden' id='scanned_texte' name='scanned_texte' value=''/>";
         $form = str_replace('<!-- !!scan_button!! -->', $scan_addon, $form);
     }
     // Ajout du bouton d'association s'il y a des segments en base
     $associer = "";
     $fct = "";
     if ($this->explnum_id) {
         $nb = 0;
         $query = "select count(*) as nb from explnum_segments where explnum_segment_explnum_num = " . $this->explnum_id;
         $result = pmb_mysql_query($query);
         if ($result && pmb_mysql_num_rows($result)) {
             $nb = pmb_mysql_fetch_object($result)->nb;
         }
         if ($nb > 0) {
             $associer = "<input type='button' class='bouton' value=\"" . $msg['associate_speakers'] . "\" name='associate_speakers' id='associate_speakers' onClick=\"document.location = '" . $base_path . "/catalog.php?categ=explnum_associate&explnum_id=" . $this->explnum_id . "';\" />";
             if ($pmb_diarization_docnum) {
                 // On ajoute une confirmation pour une deuxième segmentation => perte des associations
                 $fct = "<script type='text/javascript'>\r\n\t\t\t\t\t\t\tfunction conf_diarize_again() {\r\n\t\t\t\t\t\t\t\tif (document.getElementById('ck_diarization').checked) {\r\n\t\t\t\t\t\t\t\t\tconf = confirm('" . addslashes($msg['explnum_associate_conf_diarize_again']) . "');\r\n\t\t\t\t\t\t\t\t\tif (!conf) {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('ck_diarization').checked = false;\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdocument.getElementById('ck_diarization').addEventListener('change', conf_diarize_again, false);\r\n\t\t\t\t\t\t</script>";
             }
         }
     }
     $form = str_replace("!!associate_speakers!!", $associer, $form);
     $form = str_replace("!!fct_conf_diarize_again!!", $fct, $form);
     $form = str_replace("!!rights_form!!", $this->get_rights_form(), $form);
     // Ajout du bouton supprimer si modification
     if ($this->explnum_id && $suppr) {
         $supprimer = "\n\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t    function confirm_delete() {\n\t\t        \t\t\tresult = confirm(\"{$msg["confirmdelete_explnum"]} ?\");\n\t\t        \t\t\tif(result)\n\t\t            \t\t\tdocument.location = \"{$suppr}\";\n\t\t    \t\t\t}\n\t\t\t\t\t</script>\n\t\t\t\t\t<input type='button' class='bouton' value=\"{$msg['63']}\" name='del_ex' id='del_ex' onClick=\"confirm_delete();\" />\n\t\t\t\t\t";
     }
     $form = str_replace('!!supprimer!!', $supprimer, $form);
     //Gestion du statut de notice
     if ($pmb_explnum_statut == '1') {
         $explnum_statut_form = "&nbsp;<input type='checkbox' id='f_statut_chk' name='f_statut_chk' value='1' ";
         if ($this->explnum_statut == '1') {
             $explnum_statut_form .= "checked='checked' ";
         }
         $explnum_statut_form .= "/>&nbsp;<label class='etiquette' for='f_statut_chk'>" . htmlentities($msg['explnum_statut_msg'], ENT_QUOTES, $charset) . "</label>";
         $form = str_replace('<!-- explnum_statut -->', $explnum_statut_form, $form);
     }
     //Conserver la vignette
     if ($this->explnum_vignette) {
         $form = str_replace('!!vignette_existante!!', "&nbsp;<input type='checkbox' checked='checked' name='conservervignette' id='conservervignette' value='1'>&nbsp;<label for='conservervignette'>" . $msg[explnum_conservervignette] . "</label>", $form);
     } else {
         $form = str_replace('!!vignette_existante!!', '', $form);
     }
     global $_mimetypes_bymimetype_;
     create_tableau_mimetype();
     $selector_mimetype = "<label class='etiquette'>" . htmlentities($msg['explnum_mime_label'], ENT_QUOTES, $charset) . "</label>&nbsp;<select id='mime_vign' name='mime_vign' >\n\t\t\t<option value=''>" . htmlentities($msg['explnum_no_mimetype'], ENT_QUOTES, $charset) . "</option>\n\t\t\t";
     foreach ($_mimetypes_bymimetype_ as $key => $val) {
         //$selected="";
         //if($this->explnum_mimetype == $key)
         //$selected = "selected";
         $selector_mimetype .= "<option value='" . $key . "' {$selected} >" . htmlentities($key, ENT_QUOTES, $charset) . "</option>";
     }
     $selector_mimetype .= "</select>";
     $form = str_replace('!!mimetype_list!!', $selector_mimetype, $form);
     //Intégration de la gestion de l'interface de l'upload
     if ($pmb_docnum_in_directory_allow) {
         $div_up = "<div class='row'>";
         if ($pmb_docnum_in_database_allow) {
             $div_up .= "<input type='radio' name='up_place' id='base' value='0' !!check_base!!/> <label for='base'>{$msg['upload_repertoire_sql']}</label>";
         }
         $div_up .= "\t<input type='radio' name='up_place' id='upload' value='1' !!check_up!! />\n\t\t\t\t\t\t\t\t<label for='upload'>{$msg['upload_repertoire_server']}\n\t\t\t\t\t\t\t\t\t<input type='text' name='path' id='path' class='saisie-50emr' value='!!path!!' /><input type='button' class='bouton' name='upload_path' id='upload_path' value='...' onclick='upload_openFrame(event)'/>\n\t\t\t\t\t\t\t\t</label> \n\t\t\t\t\t\t\t\t<input type='hidden' name='id_rep' id='id_rep' value='!!id_rep!!' /> \n\t\t\t\t\t\t\t</div>";
         $form = str_replace('!!div_upload!!', $div_up, $form);
         $up = new upload_folder($this->explnum_repertoire);
         //$nom_chemin = ($up->isHashing() ? $this->explnum_rep_nom : $this->explnum_rep_nom.$this->explnum_path);
         $nom_chemin = $this->explnum_rep_nom;
         if ($up->isHashing()) {
             $nom_chemin .= "/";
         } else {
             $nom_chemin .= $this->explnum_path === '' ? "/" : $this->explnum_path;
         }
         $form = str_replace('!!path!!', htmlentities($nom_chemin, ENT_QUOTES, $charset), $form);
         $form = str_replace('!!id_rep!!', htmlentities($this->explnum_repertoire, ENT_QUOTES, $charset), $form);
         if ($this->explnum_rep_nom || $this->isEnUpload()) {
             $form = str_replace('!!check_base!!', '', $form);
             $form = str_replace('!!check_up!!', 'checked', $form);
         } else {
             $form = str_replace('!!check_base!!', '', $form);
             $form = str_replace('!!check_up!!', 'checked', $form);
         }
     } else {
         $form = str_replace('!!div_upload!!', '', $form);
     }
     //Ajout du selecteur de localisation
     if ($explnum_id) {
         if (!$this->explnum_location) {
             $requete = "select idlocation from docs_location";
             $res = pmb_mysql_query($requete);
             $i = 0;
             while ($row = pmb_mysql_fetch_array($res)) {
                 $liste_id[$i] = $row["idlocation"];
                 $i++;
             }
         } else {
             $liste_id = $this->explnum_location;
         }
     } else {
         global $deflt_docs_location;
         $liste_id[0] = $deflt_docs_location;
     }
     $docloc = new docs_location();
     $selector_location = $docloc->gen_multiple_combo($liste_id);
     $form = str_replace('!!location_explnum!!', "<div class='row'><label class='etiquette'>" . htmlentities($msg['empr_location'], ENT_QUOTES, $charset) . "</label></div>" . $selector_location, $form);
     // statut
     $select_statut = gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "f_explnum_statut", "", $this->explnum_docnum_statut, "", "", "", "", 0);
     $form = str_replace('!!statut_list!!', $select_statut, $form);
     // Indexation concept
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->explnum_id, TYPE_EXPLNUM);
         $form = str_replace('!!index_concept_form!!', $index_concept->get_form('explnum'), $form);
     } else {
         $form = str_replace('!!index_concept_form!!', "", $form);
     }
 }
function do_explnum_form()
{
    global $recept_deliv_form_explnum;
    global $deflt_explnum_statut;
    $recept_deliv_form_explnum = str_replace('!!statut_list!!', gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "f_explnum_statut", "", $deflt_explnum_statut, "", "", "", "", 0), $recept_deliv_form_explnum);
    return $recept_deliv_form_explnum;
}