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> " . $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> " . $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();\"> "; $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=¶m1=f_bull_new_date¶m2=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 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) . "¶m1=form_adhesion¶m2=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) . "¶m1=form_expiration¶m2=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}\" /> \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 .= " <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> <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> "; 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) . "¶m1=form_adhesion¶m2=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}'> </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 fill_form(&$form, $action) { global $charset; global $msg; global $pmb_antivol; global $option_num_auto; global $dbh; global $pmb_expl_show_dates; global $thesaurus_concepts_active; if (isset($option_num_auto)) { $requete = "DELETE from exemplaires_temp where sess not in (select SESSID from sessions)"; pmb_mysql_query($requete, $dbh); //Appel à la fonction de génération automatique de cb $code_exemplaire = init_gen_code_exemplaire($this->id_notice, $this->id_bulletin); do { $code_exemplaire = gen_code_exemplaire($this->id_notice, $this->id_bulletin, $code_exemplaire); $requete = "select expl_cb from exemplaires WHERE expl_cb='{$code_exemplaire}'"; $res0 = pmb_mysql_query($requete, $dbh); $requete = "select cb from exemplaires_temp WHERE cb='{$code_exemplaire}' AND sess <>'" . SESSid . "'"; $res1 = pmb_mysql_query($requete, $dbh); } while (pmb_mysql_num_rows($res0) || pmb_mysql_num_rows($res1)); //Memorise dans temps le cb et la session pour le cas de multi utilisateur session $this->cb = $code_exemplaire; $requete = "INSERT INTO exemplaires_temp (cb ,sess) VALUES ('{$this->cb}','" . SESSid . "')"; pmb_mysql_query($requete, $dbh); } $form = str_replace('!!action!!', $action, $form); if ($this->id_notice) { $form = str_replace('!!id!!', $this->id_notice, $form); } else { $form = str_replace('!!id!!', $this->id_bulletin, $form); } $form = str_replace('!!cb!!', htmlentities($this->cb, ENT_QUOTES, $charset), $form); $form = str_replace('!!nbparts!!', htmlentities($this->nbparts, ENT_QUOTES, $charset), $form); $form = str_replace('!!note!!', htmlentities($this->note, ENT_QUOTES, $charset), $form); $form = str_replace('!!comment!!', htmlentities($this->expl_comment, ENT_QUOTES, $charset), $form); if ($this->id_notice) { $form = str_replace('!!cote!!', htmlentities(prefill_cote($this->id_notice, $this->cote), ENT_QUOTES, $charset), $form); } else { $form = str_replace('!!cote!!', htmlentities(prefill_cote($this->id_bulletin_notice, $this->cote), ENT_QUOTES, $charset), $form); } $form = str_replace('!!prix!!', htmlentities($this->prix, ENT_QUOTES, $charset), $form); // select "type document" $form = str_replace('!!type_doc!!', do_selector('docs_type', 'f_ex_typdoc', $this->typdoc_id), $form); // select "section" $form = str_replace('!!section!!', $this->do_selector(), $form); // select "statut" $form = str_replace('!!statut!!', do_selector('docs_statut', 'f_ex_statut', $this->statut_id), $form); // select "localisation" //visibilité des exemplaires global $explr_visible_mod, $pmb_droits_explr_localises; if ($pmb_droits_explr_localises) { $where_clause_explr = "idlocation in (" . $explr_visible_mod . ") and"; } $form = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where {$where_clause_explr} num_location=idlocation order by 2 ", "idlocation", "location_libelle", 'f_ex_location', "calcule_section(this);", $this->location_id, "", "", "", "", 0), $form); // select "code statistique" $form = str_replace('!!codestat!!', do_selector('docs_codestat', 'f_ex_cstat', $this->codestat_id), $form); if ($pmb_antivol) { global $value_deflt_antivol; if ($this->type_antivol == "") { $this->type_antivol = $value_deflt_antivol; } // select "type_antivol" $selector = "<select name='type_antivol' id='type_antivol'>"; $selector .= "<option value='0'"; if ($this->type_antivol == 0) { $selector .= ' selected="selected"'; } $selector .= '>'; $selector .= $msg["type_antivol_aucun"] . '</option>'; $selector .= "<option value='1'"; if ($this->type_antivol == 1) { $selector .= ' selected="selected"'; } $selector .= '>'; $selector .= $msg["type_antivol_magnetique"] . '</option>'; $selector .= "<option value='2'"; if ($this->type_antivol == 2) { $selector .= ' selected="selected"'; } $selector .= '>'; $selector .= $msg["type_antivol_autre"] . '</option>'; $selector .= '</select>'; } else { $selector = ""; } $form = str_replace('!!type_antivol!!', $selector, $form); // select "owner" $form = str_replace('!!owner!!', do_selector('lenders', 'f_ex_owner', $this->owner_id), $form); //dates creation / modification if ($this->expl_id && ($pmb_expl_show_dates == '1' || $pmb_expl_show_dates == '3')) { $form = str_replace('<!-- msg_exp_cre_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_cre_date'], ENT_QUOTES, $charset) . "</label>", $form); $form = str_replace('<!-- exp_cre_date -->', format_date($this->create_date), $form); $form = str_replace('<!-- msg_exp_upd_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_upd_date'], ENT_QUOTES, $charset) . "</label>", $form); $form = str_replace('<!-- exp_upd_date -->', format_date($this->update_date), $form); } //dates dépôt / retour if ($this->expl_id && ($pmb_expl_show_dates == '2' || $pmb_expl_show_dates == '3')) { $form = str_replace('<!-- msg_exp_filing_date -->', "<label class='etiquette' >" . htmlentities($msg['filing_date'], ENT_QUOTES, $charset) . "</label>", $form); $form = str_replace('<!-- exp_filing_date -->', format_date($this->date_depot), $form); $form = str_replace('<!-- msg_exp_return_date -->', "<label class='etiquette' >" . htmlentities($msg['return_date'], ENT_QUOTES, $charset) . "</label>", $form); $form = str_replace('<!-- exp_return_date -->', format_date($this->date_retour), $form); } // Indexation concept if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->expl_id, TYPE_EXPL); $form = str_replace('<!-- index_concept_form -->', $index_concept->get_form("expl"), $form); } $p_perso = new parametres_perso("expl"); if (!$p_perso->no_special_fields) { $c = 0; $perso = "<hr />"; $perso_ = $p_perso->show_editable_fields($this->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='colonne2'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label><div class='row'>" . $p["AFF"] . "</div></div>\n"; $c++; if ($c == 2) { $perso .= "</div>\n"; $c = 0; } } if ($c == 1) { $perso .= "<div class='colonne2'> </div>\n</div>\n"; } $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso; } else { $perso = "\n<script>function check_form() { return true; }</script>\n"; } $form = str_replace("!!champs_perso!!", $perso, $form); //Remplissage ajax de la cote global $pmb_prefill_cote_ajax, $pmb_antivol; if ($pmb_prefill_cote_ajax) { $expl_ajax_cote = " completion='expl_cote' listfield='" . $this->ajax_cote_fields . ",f_ex_cb,f_ex_typdoc,f_ex_location,f_ex_owner,f_ex_statut,f_ex_cstat" . ($pmb_antivol > 0 ? ",type_antivol" : "") . "' "; } else { $expl_ajax_cote = ""; } $form = str_replace("!!expl_ajax_cote!!", $expl_ajax_cote, $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) . "¶m1=date_date¶m2=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'> </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"> ' . $msg['bulletinage_create_notice'], $bul_expl_form1); return $bul_expl_form1; }
function show_modif_form() { global $form_modif_demande, $msg, $charset, $form_linked_record, $url_base; $themes = new demandes_themes('demandes_theme', 'id_theme', 'libelle_theme', $this->theme_demande); $types = new demandes_types('demandes_type', 'id_type', 'libelle_type', $this->type_demande); if (!$this->id_demande) { $form_modif_demande = str_replace('!!form_title!!', htmlentities($msg['demandes_creation'], ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!sujet!!', '', $form_modif_demande); $form_modif_demande = str_replace('!!progression!!', '', $form_modif_demande); $form_modif_demande = str_replace('!!empr_txt!!', '', $form_modif_demande); $form_modif_demande = str_replace('!!id_empr!!', '', $form_modif_demande); $form_modif_demande = str_replace('!!titre!!', '', $form_modif_demande); $form_modif_demande = str_replace('!!select_etat!!', $this->getStateSelector(), $form_modif_demande); $form_modif_demande = str_replace('!!select_user!!', $this->getUsersSelector('', false, true), $form_modif_demande); $form_modif_demande = str_replace('!!select_theme!!', $themes->getListSelector(), $form_modif_demande); $form_modif_demande = str_replace('!!select_type!!', $types->getListSelector(), $form_modif_demande); $date = formatdate(today()); $date_debut = date("Y-m-d", time()); $date_dmde = "<input type='button' class='bouton' id='date_debut_btn' name='date_debut_btn' value='!!date_debut_btn!!' \n\t\t\t\tonClick=\"openPopUp('./select.php?what=calendrier&caller=modif_dmde&date_caller=!!date_debut!!¶m1=date_debut¶m2=date_debut_btn&auto_submit=NO&date_anterieure=YES', 'date_debut', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"/>"; $form_modif_demande = str_replace('!!date_demande!!', $date_dmde, $form_modif_demande); $form_modif_demande = str_replace('!!date_fin_btn!!', $date, $form_modif_demande); $form_modif_demande = str_replace('!!date_debut_btn!!', $date, $form_modif_demande); $form_modif_demande = str_replace('!!date_debut!!', $date_debut, $form_modif_demande); $form_modif_demande = str_replace('!!date_fin!!', $date_debut, $form_modif_demande); $form_modif_demande = str_replace('!!date_prevue!!', $date_debut, $form_modif_demande); $form_modif_demande = str_replace('!!date_prevue_btn!!', $date, $form_modif_demande); $form_modif_demande = str_replace('!!btn_suppr!!', '', $form_modif_demande); $form_modif_demande = str_replace('!!iddemande!!', '', $form_modif_demande); $act_cancel = "document.location='./demandes.php?categ=list'"; $act_form = "./demandes.php?categ=list"; } else { $btn_suppr = "<input type='submit' class='bouton' value='{$msg['63']}' onclick='this.form.act.value=\"suppr\"; return confirm_delete();' />"; $form_modif_demande = str_replace('!!form_title!!', htmlentities(sprintf($msg['demandes_modification'], ' : ' . $this->titre_demande), ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!btn_suppr!!', $btn_suppr, $form_modif_demande); $form_modif_demande = str_replace('!!titre!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!sujet!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!progression!!', htmlentities($this->progression, ENT_QUOTES, $charset), $form_modif_demande); $carac_empr = $this->getCaracEmpr($this->num_demandeur); $nom = $carac_empr['nom']; $form_modif_demande = str_replace('!!empr_txt!!', htmlentities($nom, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!idempr!!', $this->num_demandeur, $form_modif_demande); $form_modif_demande = str_replace('!!titre!!', $this->titre_demande, $form_modif_demande); $form_modif_demande = str_replace('!!select_etat!!', $this->workflow->getStateCommentById($this->etat_demande), $form_modif_demande); $form_modif_demande = str_replace('!!select_user!!', $this->getUsersSelector('', false, true), $form_modif_demande); $form_modif_demande = str_replace('!!select_theme!!', $themes->getListSelector($this->theme_demande), $form_modif_demande); $form_modif_demande = str_replace('!!select_type!!', $types->getListSelector($this->type_demande), $form_modif_demande); $form_modif_demande = str_replace('!!date_fin_btn!!', formatdate($this->deadline_demande), $form_modif_demande); $form_modif_demande = str_replace('!!date_demande!!', formatdate($this->date_demande), $form_modif_demande); $form_modif_demande = str_replace('!!date_debut!!', htmlentities($this->date_demande, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!date_fin!!', htmlentities($this->deadline_demande, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!date_prevue_btn!!', formatdate($this->date_prevue), $form_modif_demande); $form_modif_demande = str_replace('!!date_prevue!!', htmlentities($this->date_prevue, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!iddemande!!', $this->id_demande, $form_modif_demande); $act_cancel = "document.location='./demandes.php?categ=gestion&act=see_dmde&iddemande={$this->id_demande}'"; $act_form = "./demandes.php?categ=gestion"; } $form_modif_demande = str_replace('!!form_linked_record!!', $form_linked_record, $form_modif_demande); if ($this->num_linked_notice) { $display = new mono_display($this->num_linked_notice, 0, '', 0, '', '', '', 0, 0, 0, 0, "", 0, false, true); $form_modif_demande = str_replace('!!linked_record!!', htmlentities($display->result, ENT_QUOTES, $charset), $form_modif_demande); $form_modif_demande = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_modif_demande); } else { $form_modif_demande = str_replace('!!linked_record!!', "", $form_modif_demande); $form_modif_demande = str_replace('!!linked_record_id!!', 0, $form_modif_demande); } $p_perso = new parametres_perso("demandes"); if (!$p_perso->no_special_fields) { $c = 0; $perso = "<hr />"; $perso_ = $p_perso->show_editable_fields($this->id_demande); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; if ($c == 0) { $perso .= "<div class='row'>"; } $perso .= "<div class='colonne2'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "<div class='row'>" . $p["AFF"] . "</div></div>"; $c++; if ($c == 2) { $perso .= "</div>"; $c = 0; } } if ($c == 1) { $perso .= "<div class='colonne2'> </div></div>"; } $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso; } else { $perso = "<script>function check_form() { return true; }</script>"; } $form_modif_demande = str_replace("!!champs_perso!!", $perso, $form_modif_demande); $form_modif_demande = str_replace('!!form_action!!', $act_form, $form_modif_demande); $form_modif_demande = str_replace('!!cancel_action!!', $act_cancel, $form_modif_demande); print $form_modif_demande; }
function do_form() { global $msg; global $collstate_form, $statut_field, $emplacement_field, $location_field, $support_field; global $deflt_docs_location; global $deflt_arch_statut, $deflt_arch_emplacement, $deflt_arch_type; global $charset; global $pmb_etat_collections_localise; // titre formulaire if ($this->id) { $libelle = $libelle = $msg["collstate_edit_collstate"]; $link_delete = "<input type='button' class='bouton' value='{$msg['63']}' onClick=\"confirm_delete();\" />"; } else { $libelle = $msg["collstate_add_collstate"]; $link_delete = ""; } $collstate_form = str_replace('!!id!!', htmlentities($this->id, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!location_id!!', htmlentities($this->location_id, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!serial_id!!', htmlentities($this->serial_id, ENT_QUOTES, $charset), $collstate_form); $action = "./catalog.php?categ=serials&sub=collstate_update&serial_id=" . rawurlencode($this->serial_id) . "&id=" . rawurlencode($this->id); $collstate_form = str_replace('!!action!!', $action, $collstate_form); $collstate_form = str_replace('!!delete!!', $link_delete, $collstate_form); $collstate_form = str_replace('!!libelle!!', $libelle, $collstate_form); $collstate_form = str_replace('!!origine!!', htmlentities($this->origine, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!archive!!', htmlentities($this->archive, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!cote!!', htmlentities($this->cote, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!note!!', htmlentities($this->note, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!lacune!!', htmlentities($this->lacune, ENT_QUOTES, $charset), $collstate_form); $collstate_form = str_replace('!!state_collections!!', htmlentities($this->state_collections, ENT_QUOTES, $charset), $collstate_form); // champs des localisations if ($pmb_etat_collections_localise) { if (!$this->location_id) { $this->location_id = $deflt_docs_location; } $select = gen_liste("select distinct idlocation, location_libelle from docs_location order by 2 ", "idlocation", "location_libelle", 'location_id', "", $this->location_id, "", "", "", "", 0); $field = ""; if ($select) { $field = str_replace('!!location!!', $select, $location_field); } $collstate_form = str_replace('!!location_field!!', $field, $collstate_form); } else { $field = "<input type='hidden' name='location_id' id='location_id' value=''/> "; $collstate_form = str_replace('!!location_field!!', $field, $collstate_form); } // champs des emplacements if (!$this->emplacement) { $this->emplacement = $deflt_arch_emplacement; } $select = gen_liste("select archempla_id, archempla_libelle from arch_emplacement order by 2", "archempla_id", "archempla_libelle", "archempla_id", "", $this->emplacement, "", "", "", "", "", 0); $field = ""; if ($select) { $field = str_replace('!!emplacement!!', $select, $emplacement_field); } $collstate_form = str_replace('!!emplacement_field!!', $field, $collstate_form); // champs des supports if (!$this->type) { $this->type = $deflt_arch_type; } $select = gen_liste("select archtype_id, archtype_libelle from arch_type order by 2", "archtype_id", "archtype_libelle", "archtype_id", "", $this->type, "", "", "", "", 0); $field = ""; if ($select) { $field = str_replace('!!support!!', $select, $support_field); } $collstate_form = str_replace('!!support_field!!', $field, $collstate_form); // champs des statuts if (!$this->statut) { $this->statut = $deflt_arch_statut; } $select = gen_liste("select archstatut_id, archstatut_gestion_libelle from arch_statut order by 2", "archstatut_id", "archstatut_gestion_libelle", "archstatut_id", "", $this->statut, "", "", "", "", 0); $field = ""; if ($select) { $field = str_replace('!!statut!!', $select, $statut_field); } $collstate_form = str_replace('!!statut_field!!', $field, $collstate_form); // Champs perso $p_perso = new parametres_perso("collstate"); $parametres_perso = ""; if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_editable_fields($this->id); $perso = ""; for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; $perso .= "\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label>\n\t\t\t\t</div>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t" . $p["AFF"] . "\n\t\t\t\t</div>"; } $perso .= $perso_["CHECK_SCRIPTS"]; $parametres_perso .= $perso; } $collstate_form = str_replace('!!parametres_perso!!', $parametres_perso, $collstate_form); $link_annul = "onClick=\"unload_off();history.go(-1);\""; $collstate_form = str_replace('!!annul!!', $link_annul, $collstate_form); //vérification de la présence de champs perso //si non, on confirme la soumission du formulaire if ($p_perso->no_special_fields) { $return_form = "return true"; } else { $return_form = "return check_form()"; } $collstate_form = str_replace('!!return_form!!', $return_form, $collstate_form); return $collstate_form; }
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> " . $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> " . $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; }
function bul_do_form($obj, $bul_id = 0) { // $obj = objet contenant les propriétés de l'exemplaire associé global $bul_expl_form; global $msg; // pour texte du bouton supprimer global $dbh; global $pmb_type_audit, $select_categ_prop; global $pmb_antivol; global $option_num_auto; global $pmb_rfid_activate, $pmb_rfid_serveur_url, $charset; global $pmb_expl_show_dates, $pmb_expl_show_lastempr; global $thesaurus_concepts_active; if (isset($option_num_auto)) { $requete = "DELETE from exemplaires_temp where sess not in (select SESSID from sessions)"; $res = pmb_mysql_query($requete, $dbh); //Appel à la fonction de génération automatique de cb $code_exemplaire = init_gen_code_exemplaire(0, $obj->expl_bulletin); do { $code_exemplaire = gen_code_exemplaire(0, $obj->expl_bulletin, $code_exemplaire); $requete = "select expl_cb from exemplaires WHERE expl_cb='{$code_exemplaire}'"; $res0 = pmb_mysql_query($requete, $dbh); $requete = "select cb from exemplaires_temp WHERE cb='{$code_exemplaire}' AND sess <>'" . SESSid . "'"; $res1 = pmb_mysql_query($requete, $dbh); } while (pmb_mysql_num_rows($res0) || pmb_mysql_num_rows($res1)); //Memorise dans temps le cb et la session pour le cas de multi utilisateur session $obj->expl_cb = $code_exemplaire; $requete = "INSERT INTO exemplaires_temp (cb ,sess) VALUES ('{$obj->expl_cb}','" . SESSid . "')"; $res = pmb_mysql_query($requete, $dbh); } //on compte le nombre de prets pour cet exemplaire $req = "select count(arc_expl_id) as nb_prets from pret_archive where arc_expl_id = " . $obj->expl_id; $res = pmb_mysql_query($req); if (pmb_mysql_num_rows($res)) { $arch_pret = pmb_mysql_fetch_object($res); $nb_prets = $arch_pret->nb_prets; } else { $nb_prets = 0; } if ($nb_prets) { //dernière date de pret pour cet exemplaire $req = "select date_format(last_loan_date, '" . $msg["format_date"] . "') as date_last from exemplaires where expl_id = " . $obj->expl_id; $res = pmb_mysql_query($req); if (pmb_mysql_num_rows($res)) { $expl_pret = pmb_mysql_fetch_object($res); $date_last = $expl_pret->date_last; $info_nb_prets = str_replace("!!nb_prets!!", $nb_prets, $msg['expl_nbprets']); $query = "select count(pret_idexpl) "; $query .= "from pret, empr where pret_idexpl='" . $obj->expl_id . "' and pret_idempr=id_empr "; $result = pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_result($result, 0, 0)) { $info_date_last = str_replace("!!date_last!!", $date_last, $msg['expl_lastpret_encours']); } else { $info_date_last = str_replace("!!date_last!!", $date_last, $msg['expl_lastpret_retour']); } print $info_nb_prets . " " . $info_date_last; } } // l'annulation du form renvoit à : $annuler = "./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . $obj->expl_bulletin; $action = "./catalog.php?categ=serials&sub=bulletinage&action=expl_update"; $expl_nbparts = $obj->expl_cb; if (!$obj->expl_nbparts) { $expl_nbparts = 1; } else { $expl_nbparts = $obj->expl_nbparts; } // mise à jour des champs de gestion $bul_expl_form = str_replace('!!bul_id!!', $obj->expl_bulletin, $bul_expl_form); $bul_expl_form = str_replace('!!id_form!!', md5(microtime()), $bul_expl_form); $bul_expl_form = str_replace('!!org_cb!!', htmlentities($obj->expl_cb, ENT_QUOTES, $charset), $bul_expl_form); $bul_expl_form = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form); $bul_expl_form = str_replace('!!action!!', $action, $bul_expl_form); $bul_expl_form = str_replace('!!id!!', $obj->expl_notice, $bul_expl_form); $bul_expl_form = str_replace('!!cb!!', htmlentities($obj->expl_cb, ENT_QUOTES, $charset), $bul_expl_form); $bul_expl_form = str_replace('!!nbparts!!', htmlentities($expl_nbparts, ENT_QUOTES, $charset), $bul_expl_form); $bul_expl_form = str_replace('!!note!!', $obj->expl_note, $bul_expl_form); $bul_expl_form = str_replace('!!comment!!', $obj->expl_comment, $bul_expl_form); $bul_expl_form = str_replace('!!cote!!', $obj->expl_cote, $bul_expl_form); $bul_expl_form = str_replace('!!prix!!', $obj->expl_prix, $bul_expl_form); // select "type document" $bul_expl_form = str_replace('!!type_doc!!', do_selector('docs_type', 'expl_typdoc', $obj->expl_typdoc), $bul_expl_form); // select "section" $bul_expl_form = str_replace('!!section!!', do_selector_bul_section($obj->expl_section, $obj->expl_location), $bul_expl_form); // select "statut" $bul_expl_form = str_replace('!!statut!!', do_selector('docs_statut', 'expl_statut', $obj->expl_statut), $bul_expl_form); // select "localisation" //visibilité des exemplaires global $explr_visible_mod, $pmb_droits_explr_localises; if ($pmb_droits_explr_localises) { $where_clause_explr = "idlocation in (" . $explr_visible_mod . ") and"; } else { $where_clause_explr = ""; } $bul_expl_form = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where {$where_clause_explr} num_location=idlocation order by 2", "idlocation", "location_libelle", 'expl_location', "calcule_section(this);", $obj->expl_location, "", "", "", "", 0), $bul_expl_form); // select "code statistique" $bul_expl_form = str_replace('!!codestat!!', do_selector('docs_codestat', 'expl_codestat', $obj->expl_codestat), $bul_expl_form); // select "owner" $bul_expl_form = str_replace('!!owner!!', do_selector('lenders', 'expl_owner', $obj->expl_owner), $bul_expl_form); //dates creation / modification if ($obj->expl_id && ($pmb_expl_show_dates == '1' || $pmb_expl_show_dates == '3')) { $bul_expl_form = str_replace('<!-- msg_exp_cre_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_cre_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form); $bul_expl_form = str_replace('<!-- exp_cre_date -->', format_date($obj->create_date), $bul_expl_form); $bul_expl_form = str_replace('<!-- msg_exp_upd_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_upd_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form); $bul_expl_form = str_replace('<!-- exp_upd_date -->', format_date($obj->update_date), $bul_expl_form); } //dates dépôt / retour if ($obj->expl_id && ($pmb_expl_show_dates == '2' || $pmb_expl_show_dates == '3')) { $bul_expl_form = str_replace('<!-- msg_exp_filing_date -->', "<label class='etiquette' >" . htmlentities($msg['filing_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form); $bul_expl_form = str_replace('<!-- exp_filing_date -->', format_date($obj->expl_date_depot), $bul_expl_form); $bul_expl_form = str_replace('<!-- msg_exp_return_date -->', "<label class='etiquette' >" . htmlentities($msg['return_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form); $bul_expl_form = str_replace('<!-- exp_return_date -->', format_date($obj->expl_date_retour), $bul_expl_form); } // Indexation concept if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($obj->expl_id, TYPE_EXPL); $bul_expl_form = str_replace('<!-- index_concept_form -->', $index_concept->get_form("expl"), $bul_expl_form); } // select "type_antivol" $selector = ""; if ($pmb_antivol > 0) { global $value_deflt_antivol; if ($obj->type_antivol == "") { $obj->type_antivol = $value_deflt_antivol; } // 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_form = str_replace('!!type_antivol!!', $selector, $bul_expl_form); $p_perso = new parametres_perso("expl"); if (!$p_perso->no_special_fields) { $c = 0; $perso = "<hr />"; global $expl_id_from; if ($expl_id_from && !$obj->expl_id) { $perso_id_expl = $expl_id_from; } elseif ($obj->expl_id) { $perso_id_expl = $obj->expl_id; } else { $perso_id_expl = 0; } $perso_ = $p_perso->show_editable_fields($perso_id_expl); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; if ($c == 0) { $perso .= "<div class='row'>\n"; } $perso .= "<div class='colonne2'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "<div class='row'>" . $p["AFF"] . "</div></div>\n"; $c++; if ($c == 2) { $perso .= "</div>\n"; $c = 0; } } if ($c == 1) { $perso .= "<div class='colonne2'> </div>\n</div>\n"; } $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso; $perso = "<div class='row'>" . $perso . "</div>"; } else { $perso = ""; } $bul_expl_form = str_replace("!!champs_perso!!", $perso, $bul_expl_form); // circulation des périodique $perio_circ_tpl = ""; $in_circ = 0; if ($obj->expl_id) { $req = "select * from serialcirc_expl where num_serialcirc_expl_id=" . $obj->expl_id; $res_in_circ = pmb_mysql_query($req); if (pmb_mysql_num_rows($res_in_circ)) { $in_circ = 1; $perio_circ_tpl = "<label class='etiquette'>" . $msg['serialcirc_expl_in_circ'] . "</label>"; } } if (!$in_circ) { $req = "select * from abts_abts, bulletins, serialcirc where abts_abts.num_notice =bulletin_notice and bulletin_id=" . $obj->expl_bulletin . " and num_serialcirc_abt=abt_id\n\t\torder by abt_name"; $res_circ = pmb_mysql_query($req); if ($nb = pmb_mysql_num_rows($res_circ)) { $perio_circ_tpl = "<input type='checkbox' name='serial_circ_add' value='1'> " . $msg['serialcirc_add_expl']; if ($nb > 1) { $perio_circ_tpl .= "<select name='abt_id'>"; } while ($circ = pmb_mysql_fetch_object($res_circ)) { if ($nb == 1) { $perio_circ_tpl .= "<input type='hidden' name='abt_id' value='" . $circ->abt_id . "' >"; break; } $perio_circ_tpl .= "<option value='" . $circ->abt_id . "'> " . htmlentities($circ->abt_name, ENT_QUOTES, $charset) . "</option>"; } if ($nb > 1) { $perio_circ_tpl .= "</select>"; } } } $bul_expl_form = str_replace("!!perio_circ_tpl!!", $perio_circ_tpl, $bul_expl_form); // bouton supprimer si modification if ($obj->expl_id) { $del_button = "<input type='button' class='bouton' value=' {$msg['63']} ' onClick=\"confirm_expl_delete();\">"; $bt_dupliquer = "<input type='button' class='bouton' value=\"" . $msg['dupl_expl_bt'] . "\" name='dupl_ex' id='dupl_ex' onClick=\"unload_off();document.location='./catalog.php?categ=serials&sub=bulletinage&action=dupl_expl&bul_id=" . $obj->expl_bulletin . "&expl_id=" . $obj->expl_id . "' ; \" />"; if ($pmb_type_audit) { $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=2&object_id={$obj->expl_id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />"; } else { $link_audit = ""; } } else { $del_button = ""; $link_audit = ""; $bt_dupliquer = ""; } //boutons selon droits $nex = new exemplaire($obj->cb, $obj->expl_id, $obj->notice, $obj->bulletin); if ($nex->explr_acces_autorise == "MODIF") { $bt_modifier = "<input type='submit' class='bouton' value=' {$msg['77']} ' onClick=\"return test_form(this.form)\" />"; } else { $bt_modifier = ""; $del_button = ""; $bt_dupliquer = ""; } if ($pmb_rfid_activate == 1 && $pmb_rfid_serveur_url) { $script_rfid_encode = "if(script_rfid_encode()==false) return false;"; $bul_expl_form = str_replace('!!questionrfid!!', $script_rfid_encode, $bul_expl_form); } else { $bul_expl_form = str_replace('!!questionrfid!!', '', $bul_expl_form); } $bul_expl_form = str_replace('!!del!!', $del_button, $bul_expl_form); $bul_expl_form = str_replace('!!link_audit!!', $link_audit, $bul_expl_form); $bul_expl_form = str_replace('!!bt_dupliquer!!', $bt_dupliquer, $bul_expl_form); $bul_expl_form = str_replace('!!bt_modifier!!', $bt_modifier, $bul_expl_form); $bul_expl_form = str_replace('!!bul_id!!', $bul_id, $bul_expl_form); $bul_expl_form = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form); // action du bouton annuler $bul_expl_form = str_replace('!!annuler_action!!', $annuler, $bul_expl_form); // rafraichissement de la liste des sections par rapport à la localisation sélectionnée // $bul_expl_form .= "<script> calcule_section(document.forms['expl'].expl_location.options[document.forms['expl'].expl_location.selectedIndex].value); </script>"; // zone du dernier emrunteur $last_pret = ""; if ($pmb_expl_show_lastempr && $obj->expl_lastempr) { $lastempr = new emprunteur($obj->expl_lastempr, '', FALSE, 0); $last_pret = "<hr /><div class='row'><b>{$msg['expl_lastempr']} </b>"; $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($lastempr->cb) . "'>"; $last_pret .= $link . $lastempr->prenom . ' ' . $lastempr->nom . ' (' . $lastempr->cb . ')</a>'; $last_pret .= "</div>"; } // zone de l'emprunteur $query = "select empr_cb, empr_nom, empr_prenom, "; $query .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, "; $query .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, "; $query .= " IF(pret_retour>sysdate(),0,1) as retard "; $query .= " from pret, empr where pret_idexpl='" . $obj->expl_id . "' and pret_idempr=id_empr "; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $pret = pmb_mysql_fetch_object($result); $last_pret .= "<hr /><div class='row'><b>{$msg['380']}</b> "; $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($pret->empr_cb) . "'>"; $last_pret .= $link . $pret->empr_prenom . ' ' . $pret->empr_nom . ' (' . $pret->empr_cb . ')</a>'; $last_pret .= " {$msg[381]} " . $pret->aff_pret_date; $last_pret .= ". {$msg[358]} " . $pret->aff_pret_retour . "."; $last_pret .= "</div>"; } return $bul_expl_form . $last_pret; }