コード例 #1
0
 function show_form($url, $result_url, $result_target = '')
 {
     global $charset;
     global $search;
     global $add_field;
     global $delete_field;
     global $launch_search;
     global $page;
     global $search_form;
     global $msg;
     global $include_path;
     global $opac_extended_search_auto;
     global $opac_extended_search_dnd_interface;
     global $limitsearch;
     if ($add_field && ($delete_field === "" && !$launch_search)) {
         $search[] = $add_field;
     }
     $search_form = str_replace("!!url!!", $url, $search_form);
     //Generation de la liste des champs possibles
     if ($opac_extended_search_auto) {
         $r = "<select name='add_field' id='add_field' onChange=\"if (this.form.add_field.value!='') { this.form.action='{$url}'; this.form.target=''; this.form.submit();} else { alert('" . htmlentities($msg["multi_select_champ"], ENT_QUOTES, $charset) . "'); }\" >\n";
     } else {
         $r = "<select name='add_field' id='add_field'>\n";
     }
     $r .= "<option value='' style='color:#000000'>" . htmlentities($msg["multi_select_champ"], ENT_QUOTES, $charset) . "</option>\n";
     //Champs fixes
     reset($this->fixedfields);
     $open_optgroup = 0;
     $open_optgroup_deja_affiche = 0;
     $open_optgroup_en_attente_affiche = 0;
     while (list($id, $ff) = each($this->fixedfields)) {
         if ($ff["SEPARATOR"]) {
             if ($open_optgroup) {
                 $r .= "</optgroup>\n";
             }
             // $r.="<option disabled style='border-left:0px;border-right:0px;border-top:0px;border-bottom:1px;border-style:solid;'></option>\n";
             $r_opt_groupe = "<optgroup label='" . htmlentities($ff["SEPARATOR"], ENT_QUOTES, $charset) . "' class='erreur'>\n";
             $open_optgroup = 0;
             $open_optgroup_deja_affiche = 0;
             $open_optgroup_en_attente_affiche = 1;
         }
         if ($this->visibility($ff)) {
             if ($open_optgroup_en_attente_affiche && !$open_optgroup_deja_affiche) {
                 $r .= $r_opt_groupe;
                 $open_optgroup_deja_affiche = 1;
                 $open_optgroup_en_attente_affiche = 0;
                 $open_optgroup = 1;
             }
             $r .= "<option value='f_" . $id . "' style='color:#000000'>" . htmlentities($ff["TITLE"], ENT_QUOTES, $charset) . "</option>\n";
         }
     }
     //Champs dynamiques
     if ($open_optgroup) {
         $r .= "</optgroup>\n";
     }
     $open_optgroup = 0;
     // $r.="<option disabled style='border-left:0px;border-right:0px;border-top:0px;border-bottom:1px;border-style:solid;'></option>\n";
     $r_custom = "";
     $custom_flag = false;
     if (!$this->dynamics_not_visible) {
         foreach ($this->dynamicfields as $key => $value) {
             if (!$this->pp[$key]->no_special_fields && count($this->pp[$key]->t_fields) && $key != 'a') {
                 reset($this->pp[$key]->t_fields);
                 $r_custom_options = '';
                 $array_dyn_tmp = array();
                 while (list($id, $df) = each($this->pp[$key]->t_fields)) {
                     if ($df["OPAC_SHOW"]) {
                         $custom_flag = true;
                         $array_dyn_tmp[strtolower($df["TITRE"])] = "<option value='" . $key . "_" . $id . "' style='color:#000000'>" . htmlentities($df["TITRE"], ENT_QUOTES, $charset) . "</option>\n";
                     }
                 }
                 if (count($array_dyn_tmp)) {
                     if ($this->dynamicfields_order == "alpha") {
                         ksort($array_dyn_tmp);
                     }
                     $r_custom_options .= implode('', $array_dyn_tmp);
                 }
                 if ($r_custom_options) {
                     $r_custom .= "<optgroup label='" . $msg["search_custom_" . $value["TYPE"]] . "' class='erreur'>\n";
                     $r_custom .= $r_custom_options;
                     $r_custom .= "</optgroup>\n";
                 }
             }
         }
     }
     if ($custom_flag) {
         $r .= $r_custom;
     }
     //Champs autorités perso
     if ($open_optgroup) {
         $r .= "</optgroup>\n";
     }
     $open_optgroup = 0;
     $r_authperso = "";
     foreach ($this->authpersos as $authperso) {
         if (!$authperso['opac_multi_search']) {
             continue;
         }
         $r_authperso .= "<optgroup label='" . htmlentities($msg["authperso_multi_search_by_field_title"] . " : " . $authperso['name'], ENT_QUOTES, $charset) . "' class='erreur'>\n";
         $r_authperso .= "<option value='authperso_" . $authperso['id'] . "' style='color:#000000'>" . $msg["authperso_multi_search_tous_champs_title"] . "</option>\n";
         foreach ($authperso['fields'] as $field) {
             // On vérifie la visibilité en OPAC grâce à la propriété
             if ($field['multiple']) {
                 $r_authperso .= "<option value='a_" . $field['id'] . "' style='color:#000000'>" . htmlentities($field['label'], ENT_QUOTES, $charset) . "</option>\n";
             }
         }
         $r_authperso .= "</optgroup>\n";
     }
     $r .= $r_authperso;
     //Champs speciaux
     while (list($id, $sf) = each($this->specialfields)) {
         if ($sf["OPACVISIBILITY"]) {
             if ($sf["SEPARATOR"]) {
                 if ($open_optgroup) {
                     $r .= "</optgroup>\n";
                 }
                 // $r.="<option disabled style='border-left:0px;border-right:0px;border-top:0px;border-bottom:1px;border-style:solid;'></option>\n";
                 $r .= "<optgroup label='" . htmlentities($sf["SEPARATOR"], ENT_QUOTES, $charset) . "' class='erreur'>\n";
                 $open_optgroup = 1;
             }
             $r .= "<option value='s_" . $id . "' style='color:#000000'>" . htmlentities($sf["TITLE"], ENT_QUOTES, $charset) . "</option>\n";
         }
     }
     if ($open_optgroup) {
         $r .= "</optgroup>\n";
     }
     $open_optgroup = 0;
     $r .= "</select>";
     $search_form = str_replace("!!field_list!!", $r, $search_form);
     //Affichage des champs deja saisis
     $r = "";
     $n = 0;
     $r .= "<table class='table-no-border'>\n";
     for ($i = 0; $i < count($search); $i++) {
         if ((string) $i != $delete_field) {
             $f = explode("_", $search[$i]);
             //On regarde si l'on doit masquer des colonnes
             $notdisplaycol = array();
             if ($f[0] == "f") {
                 if ($this->fixedfields[$f[1]]["NOTDISPLAYCOL"]) {
                     $notdisplaycol = explode(",", $this->fixedfields[$f[1]]["NOTDISPLAYCOL"]);
                 }
             } elseif ($f[0] == "s") {
                 if ($this->specialfields[$f[1]]["NOTDISPLAYCOL"]) {
                     $notdisplaycol = explode(",", $this->specialfields[$f[1]]["NOTDISPLAYCOL"]);
                 }
             } elseif (array_key_exists($f[0], $this->pp)) {
                 if ($this->pp[$f[0]]->t_fields[$f[1]]["NOTDISPLAYCOL"]) {
                     $notdisplaycol = explode(",", $this->pp[$f[0]]->t_fields[$f[1]]["NOTDISPLAYCOL"]);
                 }
             } elseif (array_key_exists($f[0], $this->pp)) {
                 if ($this->pp[$f[0]]->t_fields[$f[1]]["NOTDISPLAYCOL"]) {
                     $notdisplaycol = explode(",", $this->pp[$f[0]]->t_fields[$f[1]]["NOTDISPLAYCOL"]);
                 }
             }
             $r .= "<tr>";
             $r .= "<td " . (in_array("1", $notdisplaycol) ? "style='display:none;'" : "") . ">";
             //Colonne 1
             $r .= "<input type='hidden' name='search[]' value='" . $search[$i] . "'>";
             $r .= "</td>";
             $r .= "<td class='search_first_column' " . (in_array("2", $notdisplaycol) ? "style='display:none;'" : "") . ">";
             //Colonne 2
             if ($n > 0) {
                 $inter = "inter_" . $i . "_" . $search[$i];
                 global ${$inter};
                 $r .= "<span class='search_operator'><select name='inter_" . $n . "_" . $search[$i] . "'>";
                 $r .= "<option value='and' ";
                 if (${$inter} == "and") {
                     $r .= " selected";
                 }
                 $r .= ">" . $msg["search_and"] . "</option>";
                 $r .= "<option value='or' ";
                 if (${$inter} == "or") {
                     $r .= " selected";
                 }
                 $r .= ">" . $msg["search_or"] . "</option>";
                 $r .= "<option value='ex' ";
                 if (${$inter} == "ex") {
                     $r .= " selected";
                 }
                 $r .= ">" . $msg["search_exept"] . "</option>";
                 $r .= "</select></span>";
             } else {
                 $r .= "&nbsp;";
             }
             //Colonne 2
             $r .= "</td>";
             $r .= "<td " . (in_array("3", $notdisplaycol) ? "style='display:none;'" : "") . "><span class='search_critere'>";
             //Colonne 3
             if ($f[0] == "f") {
                 $r .= htmlentities($this->fixedfields[$f[1]]["TITLE"], ENT_QUOTES, $charset);
             } elseif ($f[0] == "s") {
                 $r .= htmlentities($this->specialfields[$f[1]]["TITLE"], ENT_QUOTES, $charset);
             } elseif (array_key_exists($f[0], $this->pp)) {
                 $r .= htmlentities($this->pp[$f[0]]->t_fields[$f[1]]["TITRE"], ENT_QUOTES, $charset);
             } elseif ($f[0] == "authperso") {
                 $r .= htmlentities($this->authpersos[$f[1]]['name'], ENT_QUOTES, $charset);
             }
             $r .= "</span></td>";
             //Recherche des operateurs possibles
             $r .= "<td " . (in_array("4", $notdisplaycol) ? "style='display:none;'" : "") . ">";
             //Colonne 4
             $op = "op_" . $i . "_" . $search[$i];
             global ${$op};
             if ($f[0] == "f") {
                 $r .= "<span class='search_sous_critere'><select name='op_" . $n . "_" . $search[$i] . "'";
                 //gestion des autorités
                 $onchange = "";
                 //
                 if (isset($this->fixedfields[$f[1]]["QUERIES_INDEX"]["AUTHORITY"])) {
                     $selector = $this->fixedfields[$f[1]]["INPUT_OPTIONS"]["SELECTOR"];
                     $p1 = $this->fixedfields[$f[1]]["INPUT_OPTIONS"]["P1"];
                     $p2 = $this->fixedfields[$f[1]]["INPUT_OPTIONS"]["P2"];
                     $onchange = "onchange='operatorChanged(\"" . $n . "_" . $search[$i] . "\",this.value);'";
                 }
                 $r .= "{$onchange}>\n";
                 for ($j = 0; $j < count($this->fixedfields[$f[1]]["QUERIES"]); $j++) {
                     $q = $this->fixedfields[$f[1]]["QUERIES"][$j];
                     $r .= "<option value='" . $q["OPERATOR"] . "' ";
                     if (${$op} == $q["OPERATOR"]) {
                         $r .= " selected";
                     }
                     $r .= ">" . htmlentities($this->operators[$q["OPERATOR"]], ENT_QUOTES, $charset) . "</option>\n";
                 }
                 $r .= "</select></span>";
             } elseif (array_key_exists($f[0], $this->pp)) {
                 $datatype = $this->pp[$f[0]]->t_fields[$f[1]]["DATATYPE"];
                 $type = $this->pp[$f[0]]->t_fields[$f[1]]["TYPE"];
                 $df = $this->get_id_from_datatype($datatype, $f[0]);
                 $r .= "<span class='search_sous_critere'><select name='op_" . $n . "_" . $search[$i] . "'>\n";
                 for ($j = 0; $j < count($this->dynamicfields[$f[0]]["FIELD"][$df]["QUERIES"]); $j++) {
                     $q = $this->dynamicfields[$f[0]]["FIELD"][$df]["QUERIES"][$j];
                     $as = array_search($type, $q["NOT_ALLOWED_FOR"]);
                     if (!($as !== null && $as !== false)) {
                         if ($q['OPERATOR'] != "BOOLEAN" || $q['OPERATOR'] == "BOOLEAN" && $this->pp[$f[0]]->t_fields[$f[1]]['SEARCH']) {
                             $r .= "<option value='" . $q["OPERATOR"] . "' ";
                             if (${$op} == $q["OPERATOR"]) {
                                 $r .= "selected";
                             }
                             $r .= ">" . htmlentities($this->operators[$q["OPERATOR"]], ENT_QUOTES, $charset) . "</option>\n";
                         }
                     }
                 }
                 $r .= "</select></span>";
                 $r .= "&nbsp;";
             } elseif ($f[0] == "s") {
                 //appel de la fonction get_input_box de la classe du champ special
                 $type = $this->specialfields[$f[1]]["TYPE"];
                 for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) {
                     if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) {
                         $sf = $this->specialfields[$f[1]];
                         require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php";
                         $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($f[1], $sf, $n, $this);
                         $q = $specialclass->get_op();
                         if (count($q)) {
                             $r .= "<span class='search_sous_critere'><select name='op_" . $n . "_" . $search[$i] . "'>\n";
                             foreach ($q as $key => $value) {
                                 $r .= "<option value='" . $key . "' ";
                                 if (${$op} == $key) {
                                     $r .= "selected";
                                 }
                                 $r .= ">" . htmlentities($value, ENT_QUOTES, $charset) . "</option>\n";
                             }
                             $r .= "</select></span>";
                         } else {
                             print "&nbsp;";
                         }
                         break;
                     }
                 }
             } elseif ($f[0] == "authperso") {
                 $r .= "<span class='search_sous_critere'>\n\t\t\t\t\t\t\t<select name='op_" . $n . "_" . $search[$i] . "' >\n\t\t\t\t\t\t\t\t\t<option  value='BOOLEAN' selected>" . htmlentities($this->operators["BOOLEAN"], ENT_QUOTES, $charset) . "</option>\n\n\t\t\t\t\t\t\t\t\t\t\t</span>";
             }
             $r .= "</td>";
             //Affichage du champ de saisie
             $r .= "<td " . (count($notdisplaycol) ? "colspan='" . (count($notdisplaycol) + 1) . "'" : "") . " " . (in_array("5", $notdisplaycol) ? "style='display:none;'" : "") . ">";
             //Colonne 5
             $r .= $this->get_field($i, $n, $search[$i], $this->pp);
             $r .= "</span></td>";
             $delnotallowed = false;
             if ($f[0] == "f") {
                 $delnotallowed = $this->fixedfields[$f[1]]["DELNOTALLOWED"];
             } elseif ($f[0] == "s") {
                 $delnotallowed = $this->specialfields[$f[1]]["DELNOTALLOWED"];
             }
             //   			global $onglet_persopac;
             if (!$limitsearch) {
                 $r .= "<td " . (in_array("6", $notdisplaycol) ? "style='display:none;'" : "") . "><span class='search_cancel'>" . (!$delnotallowed ? "<input type='button' class='bouton' value='" . $msg["raz"] . "' onClick=\"this.form.delete_field.value='" . $n . "'; this.form.action='{$url}'; this.form.target=''; this.form.submit();\">" : "&nbsp;") . "</span>";
                 //Colonne 6
                 $r .= "</td>";
             }
             $r .= "</tr>\n";
             //Si c'est le dernier, on afficher le bouton rechercher...
             if ($i == count($search) - 1 || $delete_field == count($search) - 1 && $i == count($search) - 2) {
                 $r .= "\n<tr><td colspan='6' align='center' id='td_search_submit'>\n\t\t\t\t\t\t\t<span class='search_submit'><input type='submit' class='boutonrechercher' value='" . $msg["142"] . "'/></span>\n\t\t\t\t\t\t\t\t\t\n</td></tr>";
             }
             $n++;
         }
     }
     $r .= "</table>\n";
     //Recherche explicite
     $r .= "<input type='hidden' name='explicit_search' value='1'/>\n";
     $search_form = str_replace("!!already_selected_fields!!", $r, $search_form);
     $search_form .= "\n\n<script type=\"text/javascript\" >\n\n\t\t\t\tfunction valid_form_extented_search(){\n\t\t\t\tdocument.search_form.launch_search.value=1;\n\t\t\t\tdocument.search_form.action='!!result_url!!';\n\t\t\t\tdocument.search_form.page.value='';\n\t\t\t\t!!target_js!!\n\t\t\t\tdocument.search_form.submit();\n\t}\n\n\t\t\t\tfunction change_source_checkbox(changing_control, source_id) {\n\t\t\t\tvar i=0; var count=0;\n\t\t\t\tonoff = changing_control.checked;\n\t\t\t\tfor(i=0; i<document.search_form.elements.length; i++)\n\t\t\t\t{\n\t\t\t\tif(document.search_form.elements[i].name == 'source[]')\t{\n\t\t\t\tif (document.search_form.elements[i].value == source_id)\n\t\t\t\tdocument.search_form.elements[i].checked = onoff;\n\t}\n\t}\n\t\t\t\t\t\n\t}\n\n\t\t\t\t//callback du selecteur d'opérateur\n\t\t\t\tfunction operatorChanged(field,operator){\n\t\t\t\tvar selector = document.getElementById('field_'+field+'_authority_selector')\n\t\t\t\tvar f_lib = document.getElementById('field_'+field+'_lib');\n\t\t\t\tvar f_id = document.getElementById('field_'+field+'_id');\n\t\t\t\tvar f = document.getElementById('field_'+field);\n\t\t\t\tvar authority_id = document.getElementById('fieldvar_'+field+'_authority_id');\n\t\t\t\tif(operator == 'AUTHORITY'){\n\t\t\t\t//\t\t\t\tf_lib.setAttribute('class','authorities ext_search_txt');\n\t\t\t\t//\t\t\t\tif(authority_id.value != 0) f.value = authority_id.value;\n\t}else{\n\t\t\t\tf_lib.setAttribute('class','ext_search_txt');\n\t\t\t\tf.value = f_lib.value;\n\t}\n\t}\n\n\t\t\t\t//callback du selecteur AJAX pour les autorités\n\t\t\t\tfunction authoritySelected(infield){\n\t\t\t\t//pour assurer la compatibilité avec le selecteur AJAX\n\t\t\t\tinfield=infield.replace('_lib','');\n\t\t\t\tinfield=infield.replace('_authority_label','');\n\t\t\t\tvar searchField = document.getElementById(infield);\n\t\t\t\tvar f_lib = document.getElementById(infield+'_lib');\n\t\t\t\tvar f_id = document.getElementById(infield+'_id');\n\t\t\t\tvar op_name =infield.replace('field','op');\n\t\t\t\tvar op_selector = document.forms['search_form'][op_name];\n\t\t\t\tvar authority_id = document.getElementById(infield.replace('field','fieldvar')+'_authority_id');\n\t\t\t\t//on passe le champ en selecteur d'autorité !\n\t\t\t\tfor (var i=0 ; i<op_selector.options.length ; i++){\n\t\t\t\tif(op_selector.options[i].value == 'AUTHORITY')\n\t\t\t\top_selector.selectedIndex = i;\n\t}\n\t\t\t\tf_lib.setAttribute('class','authorities ext_search_txt');\n\t\t\t\tsearchField.value=f_id.value;\n\t\t\t\tauthority_id.value= f_id.value;\n\t}\n\n\t\t\t\t//callback sur la saisie libre\n\t\t\t\tfunction fieldChanged(id,value,e){\n\t\t\t\tvar ma_touche;\n\t\t\t\tif(window.event){\n\t\t\t\tma_touche=window.event.keyCode;\n\t}else{\n\t\t\t\tma_touche=e.keyCode;\n\t}\n\t\t\t\tvar f_lib = document.getElementById(id+'_lib');\n\t\t\t\tvar f_id = document.getElementById(id+'_id');\n\t\t\t\tvar f = document.getElementById(id);\n\t\t\t\tvar authority_id = document.getElementById(id.replace('field','fieldvar')+'_authority_id');\n\t\t\t\tvar selector = document.forms['search_form'][id.replace('field','op')];\n\t\t\t\t//console.log('Passe fieldChanged:'+keepingValue+', '+value);\n\t\t\t\tif (selector.options[selector.selectedIndex].value != 'AUTHORITY')\n\t\t\t\tf.value = value;\n\t\t\t\telse if(ma_touche != 13){\n\t\t\t\tf_lib.setAttribute('class','ext_search_txt');\n\t\t\t\tfor (var i=0 ; i<selector.options.length ; i++){\n\t\t\t\tif (selector.options[i].value == 'BOOLEAN')\n\t\t\t\tselector.selectedIndex = i;\n\t}\n\t\t\t\tf.value = f_lib.value;\n\t\t\t\tauthority_id.value = '';\n\t}\n\t}\n\t\t\t\t</script>";
     $search_form = str_replace("!!page!!", $page, $search_form);
     $search_form = str_replace("!!result_url!!", $result_url, $search_form);
     if ($result_target) {
         $r = "document.search_form.target='{$result_target}';";
     } else {
         $r = "";
     }
     $search_form = str_replace("!!target_js!!", $r, $search_form);
     if ($opac_extended_search_dnd_interface) {
         $search_perso = new search_persopac();
         $search_form .= '<div id="search_perso" style="display:none">' . $search_perso->get_forms_list() . '</div>';
         $search_form .= $this->show_dnd_form();
     }
     return $search_form;
 }
コード例 #2
0
ファイル: liste.inc.php プロジェクト: noble82/proyectos-ULS
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: liste.inc.php,v 1.2 2013-10-23 14:56:51 dgoron Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
// page de switch recherche notice
// inclusions principales
require_once "{$class_path}/search_persopac.class.php";
if (!$id && $id_search_persopac) {
    $id = $id_search_persopac;
}
$search_p = new search_persopac($id);
switch ($action) {
    case "add":
        // affichage du formulaire de recherche perso, en création ou en modification => $id)
        print $search_p->add_search();
        break;
    case "build":
        // affichage du formulaire de recherche perso, en création ou en modification => $id)
        print $search_p->add_search();
        break;
    case "form":
        // affichage du formulaire de recherche perso, en création ou en modification => $id)
        print $search_p->do_form();
        break;
    case "save":
        // sauvegarde issu du formulaire
コード例 #3
0
ファイル: simple_search.inc.php プロジェクト: bouchra012/PMB
function simple_search_content($value = '', $css)
{
    global $dbh;
    global $msg;
    global $charset;
    global $lang;
    global $css;
    global $search_type;
    global $class_path;
    global $es;
    global $lvl;
    global $include_path;
    global $opac_allow_extended_search, $opac_allow_term_search, $opac_allow_external_search;
    global $typdoc;
    global $opac_search_other_function, $opac_search_show_typdoc;
    global $opac_thesaurus;
    global $id_thes;
    global $base_path;
    global $opac_allow_tags_search;
    global $opac_show_onglet_empr;
    global $external_env;
    global $user_query;
    global $source;
    global $opac_recherches_pliables;
    global $opac_show_help;
    global $onglet_persopac, $opac_allow_personal_search;
    global $search_form_perso, $search_form, $search_form_perso_limitsearch, $limitsearch;
    global $opac_show_onglet_help;
    global $search_in_perio;
    global $get_query;
    global $opac_show_onglet_perio_a2z, $opac_autolevel2;
    global $opac_simple_search_suggestions;
    include $include_path . "/templates/simple_search.tpl.php";
    if ($opac_search_other_function) {
        require_once $include_path . "/" . $opac_search_other_function;
    }
    // pour la DSI
    global $opac_allow_bannette_priv;
    // bannettes privees autorisees ?
    global $bt_cree_bannette_priv;
    if ($opac_allow_bannette_priv && ($bt_cree_bannette_priv || $_SESSION['abon_cree_bannette_priv'] == 1)) {
        $_SESSION['abon_cree_bannette_priv'] = 1;
    } else {
        $_SESSION['abon_cree_bannette_priv'] = 0;
    }
    global $script_test_form;
    switch ($opac_show_onglet_empr) {
        case 1:
            $empr_link_onglet = "./index.php?search_type_asked=connect_empr";
            break;
        case 2:
            $empr_link_onglet = "./empr.php";
            break;
    }
    $search_p = new search_persopac();
    $onglets_search_perso = $search_p->directlink_user;
    $onglets_search_perso_form = $search_p->directlink_user_form;
    switch ($search_type) {
        case "simple_search":
            // les tests de formulaire
            $result = $script_test_form;
            $tests = test_field("search_input", "query", "recherche");
            $result = str_replace("!!tests!!", $tests, $result);
            // les typ_doc
            if ($opac_search_show_typdoc) {
                $query = "SELECT typdoc FROM notices where typdoc!='' GROUP BY typdoc";
                $result2 = mysql_query($query, $dbh);
                $toprint_typdocfield = " <select name='typdoc'>";
                $toprint_typdocfield .= "  <option ";
                $toprint_typdocfield .= " value=''";
                if ($typdoc == '') {
                    $toprint_typdocfield .= " selected";
                }
                $toprint_typdocfield .= ">" . $msg["simple_search_all_doc_type"] . "</option>\n";
                $doctype = new marc_list('doctype');
                while ($rt = mysql_fetch_row($result2)) {
                    $obj[$rt[0]] = 1;
                }
                foreach ($doctype->table as $key => $libelle) {
                    if ($obj[$key] == 1) {
                        $toprint_typdocfield .= "  <option ";
                        $toprint_typdocfield .= " value='{$key}'";
                        if ($typdoc == $key) {
                            $toprint_typdocfield .= " selected";
                        }
                        $toprint_typdocfield .= ">" . htmlentities($libelle, ENT_QUOTES, $charset) . "</option>\n";
                    }
                }
                $toprint_typdocfield .= "</select>";
            } else {
                $toprint_typdocfield = "";
            }
            if ($opac_search_other_function) {
                $toprint_typdocfield .= search_other_function_filters();
            }
            $toprint_typdocfield .= "<br />";
            // le contenu
            $result .= $search_input;
            // on met la valeur a jour
            $result = str_replace("!!user_query!!", htmlentities($value, ENT_QUOTES, $charset), $result);
            $result = str_replace("<!--!!typdoc_field!!-->", $toprint_typdocfield, $result);
            if ($opac_autolevel2) {
                $result = str_replace("!!action_simple_search!!", "./index.php?lvl=more_results&autolevel1=1", $result);
            } else {
                $result = str_replace("!!action_simple_search!!", "./index.php?lvl=search_result", $result);
            }
            if (!$opac_recherches_pliables) {
                $ou_chercher = "<div id='simple_search_zone'>" . do_ou_chercher() . "</div>";
            } elseif ($opac_recherches_pliables == 1) {
                $ou_chercher = "<div id='simple_search_zone'>" . gen_plus_form("zsimples", $msg["rechercher_dans"], do_ou_chercher(), false) . "</div>";
            } elseif ($opac_recherches_pliables == 2) {
                $ou_chercher = "<div id='simple_search_zone'>" . gen_plus_form("zsimples", $msg["rechercher_dans"], do_ou_chercher(), true) . "</div>";
            } elseif ($opac_recherches_pliables == 3) {
                // les options de recherches sont invisibles, pas dépliables.
                $ou_chercher = "\n" . do_ou_chercher_hidden() . "\n";
            }
            $result = str_replace("<!--!!ou_chercher!!-->", $ou_chercher, $result);
            // on se place dans le bon champ
            // $result .= form_focus("search_input", "query");
            $others = "";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            if ($opac_allow_term_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>";
            }
            if ($opac_allow_tags_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            if ($opac_allow_external_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $result = str_replace("!!others!!", $others, $result);
            $result .= $onglets_search_perso_form;
            break;
            //Recherche avancee
        //Recherche avancee
        case "extended_search":
            global $mode_aff;
            if ($mode_aff) {
                if ($mode_aff == "aff_module") {
                    //ajout de la recherche dans l'historique
                    $_SESSION["nb_queries"] = $_SESSION["nb_queries"] + 1;
                    $n = $_SESSION["nb_queries"];
                    $_SESSION["notice_view" . $n] = $_SESSION["last_module_search"];
                    switch ($_SESSION["last_module_search"]["search_mod"]) {
                        case 'etagere_see':
                            //appel de la fonction tableau_etagere du fichier etagere_func.inc.php
                            $r1 = $msg["etagere_query"];
                            $t = array();
                            $t = tableau_etagere($_SESSION["last_module_search"]["search_id"]);
                            $r = $r1 . " '" . $t[0]["nometagere"] . "'";
                            break;
                        case 'categ_see':
                            // instanciation de la categorie
                            $ourCateg = new categorie($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg["category"];
                            $r = $r1 . " '" . $ourCateg->libelle . "'";
                            break;
                        case 'indexint_see':
                            // instanciation de la classe indexation
                            $r1 = $msg["indexint_search"];
                            $ourIndexint = new indexint($_SESSION["last_module_search"]["search_id"]);
                            $r = $r1 . " '" . $ourIndexint->name . " " . $ourIndexint->comment . "'";
                            break;
                        case 'section_see':
                            $resultat = mysql_query("select location_libelle from docs_location where idlocation='" . addslashes($_SESSION["last_module_search"]["search_location"]) . "'");
                            $j = mysql_fetch_array($resultat);
                            $localisation_ = $j["location_libelle"];
                            mysql_free_result($resultat);
                            $resultat = mysql_query("select section_libelle from docs_section where idsection='" . addslashes($_SESSION["last_module_search"]["search_id"]) . "'");
                            $j = mysql_fetch_array($resultat);
                            $section_ = $j["section_libelle"];
                            mysql_free_result($resultat);
                            $r1 = $localisation_ . " => " . $msg["section"];
                            $r = $r1 . " '" . $section_ . "'";
                            break;
                    }
                    $_SESSION["human_query" . $n] = $r;
                    $_SESSION["search_type" . $n] = "module";
                } else {
                    if ($_SESSION["last_query"]) {
                        $n = $_SESSION["last_query"];
                        if ($_SESSION["lq_facette"]) {
                            $facette = true;
                        }
                    } else {
                        $n = $_SESSION["nb_queries"];
                    }
                }
                //générer les critères de la multi_critères
                //Attention ! si on est déjà dans une facette !
                if ($facette) {
                    search::unserialize_search($_SESSION["lq_facette_search"]["lq_search"]);
                } else {
                    global $search;
                    $search[0] = "s_1";
                    $op_ = "EQ";
                    //operateur
                    $op = "op_0_" . $search[0];
                    global ${$op};
                    ${$op} = $op_;
                    //contenu de la recherche
                    $field = "field_0_" . $search[0];
                    $field_ = array();
                    $field_[0] = $n;
                    global ${$field};
                    ${$field} = $field_;
                    //opérateur inter-champ
                    $inter = "inter_0_" . $search[0];
                    global ${$inter};
                    ${$inter} = "";
                    //variables auxiliaires
                    $fieldvar_ = "fieldvar_0_" . $search[0];
                    global ${$fieldvar_};
                    ${$fieldvar_} = "";
                    $fieldvar = ${$fieldvar_};
                }
            }
            if ($search_in_perio) {
                global $search;
                $search[0] = "f_34";
                //opérateur
                $op = "op_0_" . $search[0];
                global ${$op};
                $op_ = "EQ";
                ${$op} = $op_;
                //contenu de la recherche
                $field = "field_0_" . $search[0];
                $field_ = array();
                $field_[0] = $search_in_perio;
                global ${$field};
                ${$field} = $field_;
                $search[1] = "f_42";
                //opérateur
                $op = "op_1_" . $search[0];
                global ${$op};
                $op_ = "BOOLEAN";
                ${$op} = $op_;
            } else {
                if ($get_query) {
                    if ($_SESSION["last_query"] == $get_query && $_SESSION["lq_facette_test"]) {
                        search::unserialize_search($_SESSION["lq_facette_search"]["lq_search"]);
                    } else {
                        get_history($get_query);
                    }
                }
            }
            $es = new search();
            if ($onglet_persopac) {
                $search_form = $search_form_perso;
                global $search;
                if (!$search) {
                    $search_p_direct = new search_persopac($onglet_persopac);
                    $es->unserialize_search($search_p_direct->query);
                }
            }
            if ($limitsearch) {
                $search_form = $search_form_perso_limitsearch;
            }
            if ($onglet_persopac && $lvl == "search_result") {
                $es->reduct_search();
            }
            $result = $es->show_form("./index.php?lvl={$lvl}&search_type_asked=extended_search", "./index.php?lvl=search_result&search_type_asked=extended_search");
            $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_term_search) {
                $others2 = "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>\n";
            } else {
                $others2 = "";
            }
            if ($opac_allow_tags_search) {
                $others2 .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others2 .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others2 .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others2 .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            if ($opac_allow_external_search) {
                $others2 .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $result = str_replace("!!others!!", $others, $result);
            $result = str_replace("!!others2!!", $others2, $result);
            $result = "<div id='search'>" . $result . "</div>";
            $result .= $onglets_search_perso_form;
            break;
            //Recherche avancee
        //Recherche avancee
        case "external_search":
            //Si c'est une multi-critere, on l'affiche telle quelle
            global $external_type;
            if ($external_type) {
                $_SESSION["ext_type"] = $external_type;
            }
            global $mode_aff;
            //Affinage
            if ($mode_aff) {
                if ($mode_aff == "aff_module") {
                    //ajout de la recherche dans l'historique
                    $_SESSION["nb_queries"] = $_SESSION["nb_queries"] + 1;
                    $n = $_SESSION["nb_queries"];
                    $_SESSION["notice_view" . $n] = $_SESSION["last_module_search"];
                    switch ($_SESSION["last_module_search"]["search_mod"]) {
                        case 'etagere_see':
                            //appel de la fonction tableau_etagere du fichier etagere_func.inc.php
                            $r1 = $msg["etagere_query"];
                            $t = array();
                            $t = tableau_etagere($_SESSION["last_module_search"]["search_id"]);
                            $r = $r1 . " '" . $t[0]["nometagere"] . "'";
                            break;
                        case 'categ_see':
                            // instanciation de la catégorie
                            $ourCateg = new categorie($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg["category"];
                            $r = $r1 . " '" . $ourCateg->libelle . "'";
                            break;
                        case 'indexint_see':
                            // instanciation de la classe indexation
                            $r1 = $msg["indexint_search"];
                            $ourIndexint = new indexint($_SESSION["last_module_search"]["search_id"]);
                            $r = $r1 . " '" . $ourIndexint->name . " " . $ourIndexint->comment . "'";
                            break;
                        case 'section_see':
                            $resultat = mysql_query("select location_libelle from docs_location where idlocation='" . addslashes($_SESSION["last_module_search"]["search_location"]) . "'");
                            $j = mysql_fetch_array($resultat);
                            $localisation_ = $j["location_libelle"];
                            mysql_free_result($resultat);
                            $resultat = mysql_query("select section_libelle from docs_section where idsection='" . addslashes($_SESSION["last_module_search"]["search_id"]) . "'");
                            $j = mysql_fetch_array($resultat);
                            $section_ = $j["section_libelle"];
                            mysql_free_result($resultat);
                            $r1 = $localisation_ . " => " . $msg["section"];
                            $r = $r1 . " '" . $section_ . "'";
                            break;
                    }
                    $_SESSION["human_query" . $n] = $r;
                    $_SESSION["search_type" . $n] = "module";
                } else {
                    if ($_SESSION["last_query"]) {
                        $n = $_SESSION["last_query"];
                    } else {
                        $n = $_SESSION["nb_queries"];
                    }
                }
            }
            if ($_SESSION["ext_type"] == "multi") {
                global $search;
                if (!$search) {
                    $search[0] = "s_2";
                    $op_0_s_2 = "EQ";
                    $field_0_s_2 = array();
                } else {
                    //Recherche du champp source, s'il n'est pas present, on decale tout et on l'ajoute
                    $flag_found = false;
                    for ($i = 0; $i < count($search); $i++) {
                        if ($search[$i] == "s_2") {
                            $flag_found = true;
                            break;
                        }
                    }
                    if (!$flag_found) {
                        //Pas trouve, on decale tout !!
                        for ($i = count($search) - 1; $i >= 0; $i--) {
                            $search[$i + 1] = $search[$i];
                            decale("field_" . $i . "_" . $search[$i], "field_" . ($i + 1) . "_" . $search[$i]);
                            decale("op_" . $i . "_" . $search[$i], "op_" . ($i + 1) . "_" . $search[$i]);
                            decale("inter_" . $i . "_" . $search[$i], "inter_" . ($i + 1) . "_" . $search[$i]);
                            decale("fieldvar_" . $i . "_" . $search[$i], "fieldvar_" . ($i + 1) . "_" . $search[$i]);
                        }
                        $search[0] = "s_2";
                        $op_0_s_2 = "EQ";
                        $field_0_s_2 = array();
                    }
                }
                if ($mode_aff) {
                    //générer les critères de la multi_critères
                    $search[1] = "s_1";
                    $op_ = "EQ";
                    //opérateur
                    $op = "op_1_" . $search[1];
                    global ${$op};
                    ${$op} = $op_;
                    //contenu de la recherche
                    $field = "field_1_" . $search[1];
                    $field_ = array();
                    $field_[0] = $n;
                    global ${$field};
                    ${$field} = $field_;
                    //opérateur inter-champ
                    $inter = "inter_1_" . $search[1];
                    global ${$inter};
                    ${$inter} = "and";
                    //variables auxiliaires
                    $fieldvar_ = "fieldvar_1_" . $search[1];
                    global ${$fieldvar_};
                    ${$fieldvar_} = "";
                    $fieldvar = ${$fieldvar_};
                }
                $es = new search("search_fields_unimarc");
                $result = $es->show_form("./index.php?lvl={$lvl}&search_type_asked=external_search", "./index.php?lvl=search_result&search_type_asked=external_search");
            } else {
                global $mode_aff;
                //Si il y a une mode d'affichage demandé, on construit l'écran correspondant
                if ($mode_aff) {
                    $f = get_field_text($n);
                    $user_query = $f[0];
                    $look = $f[1];
                    global ${$look};
                    ${$look} = 1;
                    global $look_FIRSTACCESS;
                    $look_FIRSTACCESS = 1;
                } else {
                    if ($external_env) {
                        $external_env = unserialize(stripslashes($external_env));
                        foreach ($external_env as $varname => $varvalue) {
                            global ${$varname};
                            ${$varname} = $varvalue;
                        }
                    }
                }
                $result = $search_input;
                $result = str_replace("!!user_query!!", htmlentities(stripslashes($user_query), ENT_QUOTES, $charset), $result);
                $result = str_replace("<!--!!ou_chercher!!-->", do_ou_chercher(), $result);
                $result = str_replace("<!--!!sources!!-->", do_sources(), $result);
            }
            $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            if ($opac_allow_term_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>\n";
            }
            if ($opac_allow_tags_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            $others2 = "";
            $result = str_replace("!!others!!", $others, $result);
            $result = str_replace("!!others2!!", $others2, $result);
            $result = "<div id='search'>" . $result . "</div>";
            $result .= $onglets_search_perso_form;
            break;
            //Recherche par termes
        //Recherche par termes
        case "term_search":
            global $search_term;
            global $term_click;
            global $page_search;
            global $opac_term_search_height;
            global $opac_show_help;
            if (!$opac_term_search_height) {
                $height = 300;
            } else {
                $height = $opac_term_search_height;
            }
            $search_form_term = "\n\t\t\t<div id='search'>\n\t\t\t<ul class='search_tabs'>!!others!!" . ($opac_show_onglet_help ? "<li><a href=\"./index.php?lvl=infopages&pagesid={$opac_show_onglet_help}\">" . $msg["search_help"] . "</a></li>" : '') . "\n\t\t\t</ul>\n\t\t\t<div id='search_crl'></div>\n\t\t\t<form class='form-{$current_module}' name='term_search_form' method='post' action='./index.php?lvl={$lvl}&search_type_asked=term_search'>\n\t\t\t\t<div class='form-contenu'>\n\t\t\t\t<!-- sel_thesaurus -->\n\t\t\t\t\t\t\t<span class='libSearchTermes'>" . $msg["term_search_search_for"] . "</span><input type='text' class='saisie-50em' name='search_term' value='" . htmlentities(stripslashes($search_term), ENT_QUOTES, $charset) . "'>\n\t\t\t\t\t<!--\tBouton Rechercher -->\n\t\t\t\t\t\t<input type='submit' class='boutonrechercher' value='{$msg['142']}' onClick=\"this.form.page_search.value=''; this.form.term_click.value='';\"/>\n";
            if ($opac_show_help) {
                $search_form_term .= "<input type='submit' class='bouton' value='{$msg['search_help']}' onClick='window.open(\"help.php?whatis=search_terms\", \"search_help\", \"scrollbars=yes, toolbar=no, dependent=yes, width=400, height=400, resizable=yes\"); return false' />\n";
            }
            $search_form_term .= "<input type='hidden' name='term_click' value='" . htmlentities(stripslashes($term_click), ENT_QUOTES, $charset) . "'/>\n\t\t\t\t<input type='hidden' name='page_search' value='" . $page_search . "'/>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t\t<script type='text/javascript'>\n\t\t\t\tdocument.forms['term_search_form'].elements['search_term'].focus();\n\t\t\t\t</script>\n\t\t\t</div>\n\t\t\t";
            //recuperation du thesaurus session
            if (!$id_thes) {
                $id_thes = thesaurus::getSessionThesaurusId();
            } else {
                thesaurus::setSessionThesaurusId($id_thes);
            }
            //affichage du selectionneur de thesaurus et du lien vers les thesaurus
            $liste_thesaurus = thesaurus::getThesaurusList();
            $sel_thesaurus = '';
            $lien_thesaurus = '';
            if ($opac_thesaurus != 0) {
                //la liste des thesaurus n'est pas affichée en mode monothesaurus
                $sel_thesaurus = "<select class='saisie-30em' id='id_thes' name='id_thes' ";
                $sel_thesaurus .= "onchange = \"document.location = './index.php?lvl=index&search_type_asked=term_search&id_thes='+document.getElementById('id_thes').value; \">";
                foreach ($liste_thesaurus as $id_thesaurus => $libelle_thesaurus) {
                    $sel_thesaurus .= "<option value='" . $id_thesaurus . "' ";
                    if ($id_thesaurus == $id_thes) {
                        $sel_thesaurus .= " selected";
                    }
                    $sel_thesaurus .= ">" . htmlentities($libelle_thesaurus, ENT_QUOTES, $charset) . "</option>";
                }
                $sel_thesaurus .= "<option value=-1 ";
                if ($id_thes == -1) {
                    $sel_thesaurus .= "selected ";
                }
                $sel_thesaurus .= ">" . htmlentities($msg['thes_all'], ENT_QUOTES, $charset) . "</option>";
                $sel_thesaurus .= "</select>&nbsp;";
                $lien_thesaurus = "<a href='./autorites.php?categ=categories&sub=thes'>" . $msg[thes_lien] . "</a>";
            }
            $search_form_term = str_replace("<!-- sel_thesaurus -->", $sel_thesaurus, $search_form_term);
            $search_form_term = str_replace("<!-- lien_thesaurus -->", $lien_thesaurus, $search_form_term);
            $result = $search_form_term;
            $others = "";
            $others .= "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            $others .= "<li id='current'>" . $msg["search_by_terms"] . "</li>";
            if ($opac_allow_tags_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            if ($opac_allow_external_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $result = str_replace("!!others!!", $others, $result);
            $result .= "\n\t\t\t<a name='search_frame'/>\n\t\t\t<iframe style='border: solid 1px black;' name='term_search' class='frame_term_search' src='" . $base_path . "/term_browse.php?search_term=" . rawurlencode(stripslashes($search_term)) . "&term_click=" . rawurlencode(stripslashes($term_click)) . "&page_search={$page_search}&id_thes={$id_thes}' width='100%' height='" . $height . "'></iframe>\n\t\t\t<br /><br />";
            $result .= $onglets_search_perso_form;
            break;
        case "tags_search":
            // les tests de formulaire
            $result = $script_test_form;
            $tests = test_field("search_input", "query", "recherche");
            $result = str_replace("!!tests!!", $tests, $result);
            if ($opac_search_other_function) {
                $toprint_typdocfield .= search_other_function_filters();
            }
            // le contenu
            $result .= $search_input;
            // on met la valeur a jour
            $result = str_replace("!!user_query!!", htmlentities($value, ENT_QUOTES, $charset), $result);
            $result = str_replace("<!--!!typdoc_field!!-->", "", $result);
            $result = str_replace("<!--!!ou_chercher!!-->", "", $result);
            // on se place dans le bon champ
            // $result .= form_focus("search_input", "query");
            $others = "";
            $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            if ($opac_allow_term_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>";
            }
            if ($opac_allow_tags_search) {
                $others .= "<li id='current'>" . $msg["tags_search"] . "</li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            if ($opac_allow_external_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $result = str_replace("!!others!!", $others, $result);
            // Ajout de la liste des tags
            if ($user_query == "") {
                $result .= "<h3><span>{$msg['search_result_for']}<b>" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "</b></span></h3>";
                $tag = new tags();
                $result .= $tag->listeAlphabetique();
            }
            $result .= $onglets_search_perso_form;
            break;
            // *****************
            // Pour affichage compte emprunteur en onglet
        // *****************
        // Pour affichage compte emprunteur en onglet
        case "connect_empr":
            // les tests de formulaire
            $result = $search_input;
            $others = "";
            $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            if ($opac_allow_term_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>";
            }
            if ($opac_allow_tags_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li id='current'>" . $msg["onglet_empr_connect"] . "</li>";
                } else {
                    $others .= "<li id='current'>" . $msg["onglet_empr_compte"] . "</li>";
                }
            }
            if ($opac_allow_external_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $result = str_replace("!!account_or_form_empr_connect!!", affichage_onglet_compte_empr(), $result);
            $result = str_replace("!!others!!", $others, $result);
            $result .= $onglets_search_perso_form;
            break;
        case "search_perso":
            // les tests de formulaire
            $result = $search_input;
            $others = "";
            $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n";
            if ($opac_allow_personal_search) {
                $others .= "<li id='current'>" . $msg["search_perso_menu"] . "</li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            if ($opac_allow_term_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>";
            }
            if ($opac_allow_tags_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            if ($opac_allow_external_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $search_p = new search_persopac();
            $result = str_replace("!!contenu!!", $search_p->do_list(), $result);
            $result = str_replace("!!others!!", $others, $result);
            break;
        case "perio_a2z":
            global $opac_perio_a2z_abc_search;
            global $opac_perio_a2z_max_per_onglet;
            $result = $search_input;
            $others .= "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n";
            if ($opac_allow_personal_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>";
            }
            $others .= $onglets_search_perso;
            if ($opac_allow_extended_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>";
            }
            if ($opac_allow_term_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>";
            }
            if ($opac_allow_tags_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>";
            }
            if ($opac_show_onglet_perio_a2z) {
                $others .= "<li id='current'>" . $msg["a2z_onglet"] . "</li>";
            }
            if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) {
                if (!$_SESSION["user_code"]) {
                    $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>";
                } else {
                    $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>";
                }
            }
            if ($opac_allow_external_search) {
                $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>";
            }
            $result = str_replace("!!others!!", $others, $result);
            // affichage des _perio_a2z
            $a2z = new perio_a2z(0, $opac_perio_a2z_abc_search, $opac_perio_a2z_max_per_onglet);
            $a2z_form = $a2z->get_form();
            $a2z_form .= $onglets_search_perso_form;
            $result = str_replace("!!contenu!!", $a2z_form, $result);
            break;
    }
    return $result;
}