function get_form_label()
 {
     if ($this->form_marclist) {
         return titre_uniforme::get_marc_form()->table[$this->form_marclist];
     }
 }
     for ($i = 0; $i <= $max_subdiv; $i++) {
         eval("\$val=\$f_subdiv" . $i . ";");
         if ($val) {
             $titre_uniforme_val['subdiv'][] = $val;
         }
     }
     $titre_uniforme = new titre_uniforme($id);
     $titre_uniforme->update($titre_uniforme_val);
     include './autorites/titres_uniformes/titres_uniformes_list.inc.php';
     break;
 case 'titre_uniforme_form':
     // création/modification d'un titre_uniforme
     if (!$id) {
         $titre_uniforme = new titre_uniforme();
     } else {
         $titre_uniforme = new titre_uniforme($id);
     }
     // affichage du form pour modification
     $titre_uniforme->show_form();
     break;
 case 'titre_uniforme_last':
     $last_param = 1;
     $tri_param = "order by tu_id desc ";
     $limit_param = "limit 0, {$pmb_nb_lastautorities} ";
     $clef = "";
     $nbr_lignes = 0;
     include './autorites/titres_uniformes/titres_uniformes_list.inc.php';
     break;
 default:
     // affichage du début de la liste
     include './autorites/titres_uniformes/titres_uniformes_list.inc.php';
 function insert_authority_infos($authority_number, $type, $id_origin_authority, $authority_infos = array())
 {
     global $opac_enrichment_bnf_sparql;
     //on a un numéro d'autorité, on regarde si on l'a déjà rencontré
     $num_authority = $authority_infos['id'];
     $query = "select id_authority_source,num_authority from authorities_sources where authority_number = '" . $authority_number . "' and num_origin_authority='" . $id_origin_authority . "' and authority_type = '" . $type . "'";
     $result = pmb_mysql_query($query) or die("can't select authorities_sources :" . $query);
     if (pmb_mysql_num_rows($result)) {
         $row = pmb_mysql_fetch_object($result);
         $num_authority = $row->num_authority;
         $num_authority_source = $row->id_authority_source;
         // on cherche la préférence... dès fois que...
         $query = "select id_authority_source, num_authority from authorities_sources where authority_number = '" . $authority_number . "' and authority_type = '" . $type . "' and authority_favorite = 1";
         $result = pmb_mysql_query($query) or die("can't select authorities_sources :" . $query);
         if (pmb_mysql_num_rows($result)) {
             $row = pmb_mysql_fetch_object($result);
             $num_authority = $row->num_authority;
             $num_authority_source = $row->id_authority_source;
         }
     } else {
         // on importe l'autorité dans la base si elle n'a pas d'id
         if ($num_authority == 0) {
             switch ($type) {
                 case "author":
                     $num_authority = auteur::import($authority_infos);
                     break;
                 case "uniform_title":
                     $num_authority = titre_uniforme::import($authority_infos);
                     break;
                 case "category":
                     $num_authority = category::import($authority_infos);
                     break;
                 case "collection":
                     $num_authority = collection::import($authority_infos);
                     break;
                 case "subcollection":
                     $num_authority = subcollection::import($authority_infos);
                     break;
                 case "serie":
                     break;
             }
         }
         // on intègre la source de l'autorité
         $query = "insert into authorities_sources set\n\t\t\tnum_authority = '{$num_authority}',\n\t\t\tauthority_number = '" . $authority_number . "',\n\t\t\tauthority_type = '{$type}',\n\t\t\tnum_origin_authority = " . $id_origin_authority . ",\n\t\t\timport_date = now()";
         pmb_mysql_query($query) or die("can't insert authorities_sources :" . $query);
         $num_authority_source = pmb_mysql_insert_id();
         ////////////////////////////////////////////////////////////////
         if ($opac_enrichment_bnf_sparql && $type == 'author') {
             auteur::author_enrichment($num_authority);
         }
     }
     return $num_authority;
 }
Example #4
0
 static function getAutomaticTu($notice)
 {
     global $dbh, $charset, $opac_enrichment_bnf_sparql;
     if (!$opac_enrichment_bnf_sparql) {
         return 0;
     }
     $requete = "select code, responsability_author from notices left join responsability on (responsability_notice={$notice} and responsability_type=0)\n\t\t\tleft join notices_titres_uniformes on notice_id=ntu_num_notice where notice_id={$notice} and ntu_num_notice is null";
     $resultat = pmb_mysql_query($requete, $dbh);
     if (pmb_mysql_num_rows($resultat, $dbh)) {
         $code = pmb_mysql_result($resultat, 0, 0, $dbh);
         $id_author = pmb_mysql_result($resultat, 0, 1, $dbh);
     } else {
         $code = "";
     }
     $id_tu = 0;
     if (isISBN($code)) {
         $uri = titre_uniforme::get_data_bnf_uri($code);
         if ($uri) {
             //Recherche du titre uniforme déjà existant ?
             $requete = "select tu_id from titres_uniformes where tu_databnf_uri='" . addslashes($uri) . "'";
             $resultat = pmb_mysql_query($requete, $dbh);
             if (pmb_mysql_num_rows($resultat, $dbh)) {
                 $id_tu = pmb_mysql_result($resultat, 0, 0, $dbh);
             } else {
                 //Interrogation de data.bnf pour obtenir les infos !
                 $configbnf = array('remote_store_endpoint' => 'http://data.bnf.fr/sparql');
                 $storebnf = ARC2::getRemoteStore($configbnf);
                 $sparql = "\n\t\t\t\t\t\tPREFIX dc: <http://purl.org/dc/terms/>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tSELECT ?title ?date ?description WHERE {\n\t\t\t\t\t\t  <" . $uri . "> dc:title ?title.\n\t\t\t\t\t\t  OPTIONAL { <" . $uri . "> dc:date ?date. }\n\t\t\t\t\t\t  OPTIONAL { <" . $uri . "> dc:description ?description. }\n\t\t\t\t\t\t}";
                 $rows = $storebnf->query($sparql, 'rows');
                 // On vérifie qu'il n'y a pas d'erreur sinon on stoppe le programme et on renvoi une chaine vide
                 $err = $storebnf->getErrors();
                 if (!$err) {
                     $value = array("name" => encoding_normalize::charset_normalize($rows[0]['title'], "utf-8"), "num_author" => $id_author, "date" => encoding_normalize::charset_normalize($rows[0]['date'], "utf-8"), "comment" => encoding_normalize::charset_normalize($rows[0]['description'], "utf-8"), "databnf_uri" => $uri);
                     $id_tu = titre_uniforme::import($value);
                 }
             }
         }
     }
     if ($id_tu) {
         $titres_uniformes = array(array("num_tu" => $id_tu));
         $ntu = new tu_notice($notice);
         $ntu->update($titres_uniformes);
     }
     return $id_tu;
 }
function list_titres_uniformes($cle, $titre_uniforme_list, $nav_bar)
{
    global $titres_uniformes_list_tmpl;
    global $charset;
    $titres_uniformes_list_tmpl = str_replace("!!cle!!", htmlentities(stripslashes($cle), ENT_QUOTES, $charset), $titres_uniformes_list_tmpl);
    $titres_uniformes_list_tmpl = str_replace("!!list!!", $titre_uniforme_list, $titres_uniformes_list_tmpl);
    $titres_uniformes_list_tmpl = str_replace("!!nav_bar!!", $nav_bar, $titres_uniformes_list_tmpl);
    titre_uniforme::search_form();
    print pmb_bidi($titres_uniformes_list_tmpl);
}
// $Id: titre_uniforme_see.inc.php,v 1.15.2.1 2014-12-16 13:58:16 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
// affichage du detail pour un titre uniforme
// inclusion de classe utiles
require_once $class_path . '/titre_uniforme.class.php';
require_once $base_path . '/includes/templates/titre_uniforme.tpl.php';
require_once "{$class_path}/aut_link.class.php";
print "<div id='aut_details'>\n\n\t\t<h3><span>" . $msg["titre_uniforme_see_title"] . "</span></h3>\n";
print "<div id='aut_details_container'>\n";
if ($id) {
    $id += 0;
    // affichage des informations sur l'éditeur
    print "<div id='aut_see'>\n";
    $ourTu = new titre_uniforme($id);
    print pmb_bidi($ourTu->print_resume());
    $aut_link = new aut_link(AUT_TABLE_TITRES_UNIFORMES, $id);
    print pmb_bidi($aut_link->get_display());
    print "</div><!-- fermeture #aut_see -->\n";
    // affichage des notices associées
    print "\t<div id='aut_details_liste'>\n\n\t\t\t<h3>" . $msg["doc_titre_uniforme_title"] . "</h3>\n";
    //droits d'acces emprunteur/notice
    $acces_j = '';
    if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
        require_once "{$class_path}/acces.class.php";
        $ac = new acces();
        $dom_2 = $ac->setDomain(2);
        $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id');
    }
    if ($acces_j) {
Example #7
0
 static function update_index($id)
 {
     global $dbh;
     // On cherche tous les n-uplet de la table notice correspondant à cet auteur.
     $found = pmb_mysql_query("select distinct responsability_notice from responsability where responsability_author='" . $id . "'", $dbh);
     // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié :
     while ($mesNotices = pmb_mysql_fetch_object($found)) {
         $notice_id = $mesNotices->responsability_notice;
         notice::majNoticesGlobalIndex($notice_id);
         notice::majNoticesMotsGlobalIndex($notice_id, 'author');
     }
     // On met à jour les titres uniformes correspondant à cet auteur
     $found = pmb_mysql_query("select distinct responsability_tu_num from responsability_tu where responsability_tu_author_num='" . $id . "'", $dbh);
     // Pour chaque n-uplet trouvés on met a jour l'index du titre uniforme avec l'auteur modifié :
     while ($mesTu = pmb_mysql_fetch_object($found)) {
         titre_uniforme::update_index_tu($mesTu->responsability_tu_num);
         titre_uniforme::update_index($mesTu->responsability_tu_num);
     }
 }
    }
}
if ($bt_ajouter == "no") {
    $bouton_ajouter = "";
} else {
    $bouton_ajouter = "<input type='button' class='bouton_small' onclick=\"document.location='{$base_url}&action=add&deb_rech='+this.form.f_user_input.value\" value='" . $msg["aut_titre_uniforme_ajouter"] . "'>";
}
switch ($action) {
    case 'add':
        $titre_uniforme_form = str_replace("!!deb_saisie!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $titre_uniforme_form);
        $titre_uniforme = new titre_uniforme(0);
        $titre_uniforme->show_form();
        break;
    case 'update':
        $value = array('name' => $name, 'oeuvre_nature' => $oeuvre_nature, 'oeuvre_type' => $oeuvre_type, 'statut' => $authority_statut);
        $titre_uniforme = new titre_uniforme();
        $titre_uniforme->update($value);
        $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form);
        $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form);
        print $sel_search_form;
        print $jscript;
        show_results($dbh, $name, 0, 0, $titre_uniforme->id);
        break;
    default:
        $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form);
        $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form);
        print $sel_search_form;
        print $jscript;
        show_results($dbh, $user_input, $nbr_lignes, $page, 0);
        break;
}
Example #9
0
function keep_authority_infos($authority_number, $type, $origin_authority, $notice_id, $authority_infos = array())
{
    //on a un numéro d'autorité, on regarde si on l'a déjà rencontré
    $query = "select id_authority_source,num_authority from authorities_sources where authority_number = '" . $authority_number . "' and num_origin_authority='" . $origin_authority . "' and authority_type = '" . $type . "'";
    $result = mysql_query($query);
    if (mysql_num_rows($result)) {
        $row = mysql_fetch_object($result);
        $num_authority = $row->num_authority;
        $num_authority_source = $row->id_authority_source;
        // on cherche la préférence... dès fois que...
        $query = "select id_authority_source, num_authority from authorities_sources where authority_number = '" . $authority_number . "' and authority_type = '" . $type . "' and authority_favorite = 1";
        $result = mysql_query($query);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_object($result);
            $num_authority = $row->num_authority;
            $num_authority_source = $row->id_authority_source;
        }
    } else {
        // c'est un petit nouveau
        switch ($type) {
            case "author":
                $num_authority = auteur::import($authority_infos);
                break;
            case "uniform_title":
                $num_authority = titre_uniforme::import($authority_infos);
                break;
            case "category":
                $num_authority = category::import($authority_infos);
                break;
            case "collection":
                $num_authority = collection::import($authority_infos);
                break;
            case "subcollection":
                $num_authority = subcollection::import($authority_infos);
                break;
            case "serie":
                break;
        }
        $query = "insert into authorities_sources set \n\t\t\tnum_authority = '{$num_authority}',\n\t\t\tauthority_number = '" . $authority_number . "',\n\t\t\tauthority_type = '{$type}',\n\t\t\tnum_origin_authority = " . $origin_authority . ",\n\t\t\timport_date = now()";
        mysql_query($query);
        $num_authority_source = mysql_insert_id();
    }
    //certaines autorités sont créés avant la notice...
    if ($notice_id != 0) {
        $query = "insert into notices_authorities_sources set \n\t\tnum_authority_source = " . $num_authority_source . ",\n\t\tnum_notice = " . $notice_id;
        mysql_query($query);
    }
    return $num_authority;
}
Example #10
0
 public function create_authority()
 {
     switch ($this->notice->type) {
         case "author":
             $this->authority_id = auteur::import($this->notice->specifics_data);
             break;
         case "uniform_title":
             $this->authority_id = titre_uniforme::import($this->notice->specifics_data);
             break;
         case "collection":
             $this->authority_id = collection::import($this->notice->specifics_data);
             if ($this->authority_id != 0 && $this->notice->specifics_data['subcollections']) {
                 for ($i = 0; $i < count($this->notice->specifics_data['subcollections']); $i++) {
                     $this->notice->specifics_data['subcollections'][$i]['coll_parent'] = $this->authority_id;
                     $subcoll_id = subcollection::check_if_exists($this->notice->specifics_data['subcollections'][$i]);
                     if ($subcoll_id != 0 && $this->notice->specifics_data['subcollections'][$i]['authority_number']) {
                         $query = "insert into authorities_sources set \n\t\t\t\t\t\t\t\t\tnum_authority = " . $subcoll_id . ",\n\t\t\t\t\t\t\t\t\tauthority_number = '" . $this->notice->specifics_data['subcollections'][$i]['authority_number'] . "',\t\n\t\t\t\t\t\t\t\t\tauthority_type = 'subcollection',\n\t\t\t\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\t\t\t\tauthority_favorite = 0,\n\t\t\t\t\t\t\t\t\timport_date = now()";
                         mysql_query($query);
                     }
                 }
             }
             break;
         case "subcollection":
             $this->authority_id = subcollection::import($this->notice->specifics_data);
             if ($this->authority_id != 0 && $this->notice->specifics_data['collection'] && $this->notice->specifics_data['collection']['authority_number']) {
                 $coll_id = collection::check_if_exists($this->notice->specifics_data['collection']);
                 $query = "insert into authorities_sources set \n\t\t\t\t\t\t\tnum_authority = " . $coll_id . ",\n\t\t\t\t\t\t\tauthority_number = '" . $this->notice->specifics_data['collection']['authority_number'] . "',\t\n\t\t\t\t\t\t\tauthority_type = 'collection',\n\t\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\t\tauthority_favorite = 0,\n\t\t\t\t\t\t\timport_date = now()";
                 mysql_query($query);
             }
             break;
         case "category":
             $this->authority_id = category::import($this->notice->specifics_data, $this->id_thesaurus, $this->get_parent_category(), $this->notice->common_data['lang']);
             break;
         default:
             //	on fait rien...
             break;
     }
     if ($this->authority_id) {
         $query = "insert into authorities_sources set \n\t\t\t\tnum_authority = " . $this->authority_id . ",\n\t\t\t\tauthority_number = '" . $this->notice->common_data['authority_number'] . "',\t\n\t\t\t\tauthority_type = '" . $this->notice->type . "',\n\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\tauthority_favorite = 1,\n\t\t\t\timport_date = now(),\n\t\t\t\tupdate_date = now()";
         mysql_query($query);
     } else {
         return false;
     }
 }
 public function check_if_exists($data, $id_thesaurus = 0)
 {
     switch ($data['type_authority']) {
         // Forme associée - Nom de Personne
         case "author":
             $id = auteur::check_if_exists($data);
             break;
             // Forme associée - Titre Uniforme
         // Forme associée - Titre Uniforme
         case "uniform_title":
             $id = titre_uniforme::import_tu_exist($data);
             break;
         case "category":
             $id = category::check_if_exists($data, $id_thesaurus, 0, $this->common_data['lang']);
             break;
         default:
             $id = 0;
             break;
     }
     return $id;
 }
Example #12
0
}
require_once "{$class_path}/titre_uniforme.class.php";
// la taille d'un paquet de notices
$lot = SERIE_PAQUET_SIZE;
// defini dans ./params.inc.php
// taille de la jauge pour affichage
$jauge_size = GAUGE_SIZE;
// initialisation de la borne de départ
if (!isset($start)) {
    $start = 0;
}
$v_state = urldecode($v_state);
print "<br /><br /><h2 align='center'>" . htmlentities($msg["nettoyage_suppr_titres_uniformes"], ENT_QUOTES, $charset) . "</h2>";
$query = mysql_query("SELECT tu_id from titres_uniformes left join notices_titres_uniformes on ntu_num_tu=tu_id where ntu_num_tu is null");
$affected = 0;
if ($affected = mysql_num_rows($query)) {
    while ($ligne = mysql_fetch_object($query)) {
        $tu = new titre_uniforme($ligne->tu_id);
        $tu->delete();
    }
}
//Nettoyage des informations d'autorités pour les sous collections
titre_uniforme::delete_autority_sources();
$query = mysql_query("delete notices_titres_uniformes from notices_titres_uniformes left join titres_uniformes on ntu_num_tu=tu_id where tu_id is null");
$spec = $spec - CLEAN_TITRES_UNIFORMES;
$v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_suppr_titres_uniformes"], ENT_QUOTES, $charset) . " : ";
$v_state .= $affected . " " . htmlentities($msg["nettoyage_res_suppr_titres_uniformes"], ENT_QUOTES, $charset);
$opt = mysql_query('OPTIMIZE TABLE titres_uniformes');
// mise à jour de l'affichage de la jauge
print "<table border='0' align='center' width='{$table_size}' cellpadding='0'><tr><td class='jauge'>\n  \t\t\t<img src='../../images/jauge.png' width='{$jauge_size}' height='16'></td></tr></table>\n \t\t\t<div align='center'>100%</div>";
print "\n\t<form class='form-{$current_module}' name='process_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"{$v_state}\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t</form>\n\t<script type=\"text/javascript\"><!--\n\t\tdocument.forms['process_state'].submit();\n\t\t-->\n\t</script>";
Example #13
0
 function import($value, $from_form = 0)
 {
     global $dbh;
     // Si vide on sort
     if (trim($value['name']) == '') {
         return FALSE;
     }
     if (!$from_form) {
         $value['name'] = addslashes($value['name']);
         $value['num_author'] = addslashes($value['num_author']);
         $value['form'] = addslashes($value['form']);
         $value['date'] = addslashes($value['date']);
         $value['subject'] = addslashes($value['subject']);
         $value['place'] = addslashes($value['place']);
         $value['history'] = addslashes($value['history']);
         $value['characteristic'] = addslashes($value['characteristic']);
         $value['intended_termination'] = addslashes($value['intended_termination']);
         $value['intended_audience'] = addslashes($value['intended_audience']);
         $value['context'] = addslashes($value['context']);
         $value['equinox'] = addslashes($value['equinox']);
         $value['coordinates'] = addslashes($value['coordinates']);
         $value['tonalite'] = addslashes($value['tonalite']);
         $value['comment'] = addslashes($value['comment']);
         for ($i = 0; $i < count($value['distrib']); $i++) {
             $value['distrib'][$i] = addslashes($value['distrib'][$i]);
         }
         for ($i = 0; $i < count($value['ref']); $i++) {
             $value['ref'][$i] = addslashes($value['ref'][$i]);
         }
         for ($i = 0; $i < count($value['subdiv']); $i++) {
             $value['subdiv'][$i] = addslashes($value['subdiv'][$i]);
         }
     }
     // s'assurer que ce titre uniforme n'existe pas déjà
     /*$dummy = "SELECT * FROM titres_uniformes WHERE tu_name='".$value['name']."' ";
     		$check = mysql_query($dummy, $dbh);
     		if (mysql_num_rows($check)) {
     			$tu=mysql_fetch_object($check);
     			$tu_id=$tu->tu_id;
     			return $tu->tu_id;
     		}*/
     $tu_auteur = new auteur($value['num_author']);
     if (!$tu_auteur->id) {
         $value['num_author'] = 0;
     } else {
         $value['num_author'] = $tu_auteur->id;
     }
     $titre = titre_uniforme::import_tu_exist($value, $from_form);
     if ($titre) {
         return $titre;
     }
     $requete = "INSERT INTO titres_uniformes SET ";
     $requete .= "tu_name='" . $value["name"] . "', ";
     $requete .= "tu_num_author='" . $value["num_author"] . "', ";
     $requete .= "tu_forme='" . $value["form"] . "', ";
     $requete .= "tu_date='" . $value["date"] . "', ";
     $requete .= "tu_sujet='" . $value["subject"] . "', ";
     $requete .= "tu_lieu='" . $value["place"] . "', ";
     $requete .= "tu_histoire='" . $value["history"] . "', ";
     $requete .= "tu_caracteristique='" . $value["characteristic"] . "', ";
     $requete .= "tu_completude='" . $value["intended_termination"] . "', ";
     $requete .= "tu_public='" . $value["intended_audience"] . "', ";
     $requete .= "tu_contexte='" . $value["context"] . "', ";
     $requete .= "tu_equinoxe='" . $value["equinox"] . "', ";
     $requete .= "tu_coordonnees='" . $value["coordinates"] . "', ";
     $requete .= "tu_tonalite='" . $value["tonalite"] . "', ";
     $requete .= "tu_comment='" . $value["comment"] . "'";
     // insertion du titre uniforme	et mise à jour de l'index tu
     if (mysql_query($requete, $dbh)) {
         $tu_id = mysql_insert_id();
     } else {
         return FALSE;
     }
     // Distribution instrumentale et vocale (pour la musique)
     for ($i = 0; $i < count($value['distrib']); $i++) {
         $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$tu_id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' ";
         mysql_query($requete, $dbh);
     }
     // Référence numérique (pour la musique)
     for ($i = 0; $i < count($value['ref']); $i++) {
         $requete = "INSERT INTO tu_ref SET\n\t\t\tref_num_tu='{$tu_id}',\n\t\t\tref_name='" . $value['ref'][$i] . "',\n\t\t\tref_ordre='{$i}' ";
         mysql_query($requete, $dbh);
     }
     // Subdivision de forme
     for ($i = 0; $i < count($value['subdiv']); $i++) {
         $requete = "INSERT INTO tu_subdiv SET\n\t\t\tsubdiv_num_tu='{$tu_id}',\n\t\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\t\tsubdiv_ordre='{$i}' ";
         mysql_query($requete, $dbh);
     }
     audit::insert_creation(AUDIT_TITRE_UNIFORME, $tu_id);
     // mise à jour du champ index du titre uniforme
     if ($tu_id) {
         titre_uniforme::update_index_tu($tu_id);
     }
     return $tu_id;
 }
Example #14
0
 function import($value, $from_form = 0)
 {
     global $dbh;
     // Si vide on sort
     if (trim($value['name']) == '') {
         return FALSE;
     }
     if (!$from_form) {
         $value['name'] = addslashes($value['name']);
         $value['num_author'] = addslashes($value['num_author']);
         $value['form'] = addslashes($value['form']);
         $value['date'] = addslashes($value['date']);
         $value['subject'] = addslashes($value['subject']);
         $value['place'] = addslashes($value['place']);
         $value['history'] = addslashes($value['history']);
         $value['characteristic'] = addslashes($value['characteristic']);
         $value['intended_termination'] = addslashes($value['intended_termination']);
         $value['intended_audience'] = addslashes($value['intended_audience']);
         $value['context'] = addslashes($value['context']);
         $value['equinox'] = addslashes($value['equinox']);
         $value['coordinates'] = addslashes($value['coordinates']);
         $value['tonalite'] = addslashes($value['tonalite']);
         $value['comment'] = addslashes($value['comment']);
         $value['databnf_uri'] = addslashes($value['databnf_uri']);
         for ($i = 0; $i < count($value['distrib']); $i++) {
             $value['distrib'][$i] = addslashes($value['distrib'][$i]);
         }
         for ($i = 0; $i < count($value['ref']); $i++) {
             $value['ref'][$i] = addslashes($value['ref'][$i]);
         }
         for ($i = 0; $i < count($value['subdiv']); $i++) {
             $value['subdiv'][$i] = addslashes($value['subdiv'][$i]);
         }
         for ($i = 0; $i < count($value['authors']); $i++) {
             // les champs auteurs sont addslashes dans import auteur
             $value['authors'][$i]['type'] = addslashes($value['authors'][$i]['type']);
             $value['authors'][$i]['fonction'] = addslashes($value['authors'][$i]['fonction']);
         }
     }
     $marc_key = new marc_list("music_key");
     $marc_form = new marc_list("music_form");
     $flag_form = false;
     $flag_key = false;
     foreach ($marc_form->table as $value_form => $libelle_form) {
         if ($value_form == $value['form']) {
             $flag_form = true;
         }
     }
     foreach ($marc_key->table as $value_key => $libelle_key) {
         if ($value_key == $value['tonalite']) {
             $flag_key = true;
         }
     }
     if (count($value['authors'])) {
         for ($i = 0; $i < count($value['authors']); $i++) {
             if ($value['authors'][$i]['id']) {
                 $tu_auteur = new auteur($value['authors'][$i]['id']);
                 if (!$tu_auteur->id) {
                     // id non valide
                     $value['authors'][$i]['id'] = 0;
                 }
             }
             if (!$value['authors'][$i]['id']) {
                 // création ou déjà existant. auteur::import addslashes les champs
                 $value['authors'][$i]['id'] = auteur::import($value['authors'][$i]);
             }
         }
     }
     // $value déjà addslashes plus haut -> 1
     $titre = titre_uniforme::import_tu_exist($value, 1);
     if ($titre) {
         return $titre;
     }
     $requete = "INSERT INTO titres_uniformes SET ";
     $requete .= "tu_name='" . $value["name"] . "', ";
     $requete .= "tu_num_author='" . $value["num_author"] . "', ";
     $requete .= (!$flag_form ? "tu_forme='" : "tu_forme_marclist='") . $value['form'] . "', ";
     $requete .= "tu_date='" . $value["date"] . "', ";
     $requete .= "tu_sujet='" . $value["subject"] . "', ";
     $requete .= "tu_lieu='" . $value["place"] . "', ";
     $requete .= "tu_histoire='" . $value["history"] . "', ";
     $requete .= "tu_caracteristique='" . $value["characteristic"] . "', ";
     $requete .= "tu_completude='" . $value["intended_termination"] . "', ";
     $requete .= "tu_public='" . $value["intended_audience"] . "', ";
     $requete .= "tu_contexte='" . $value["context"] . "', ";
     $requete .= "tu_equinoxe='" . $value["equinox"] . "', ";
     $requete .= "tu_coordonnees='" . $value["coordinates"] . "', ";
     $requete .= (!$flag_key ? "tu_tonalite='" : "tu_tonalite_marclist='") . $value['tonalite'] . "', ";
     $requete .= "tu_comment='" . $value["comment"] . "', ";
     $requete .= "tu_databnf_uri='" . $value["databnf_uri"] . "'";
     // insertion du titre uniforme	et mise à jour de l'index tu
     if (pmb_mysql_query($requete, $dbh)) {
         $tu_id = pmb_mysql_insert_id();
     } else {
         return FALSE;
     }
     if (count($value['authors'])) {
         $ordre = 0;
         $rqt_ins = "INSERT INTO responsability_tu (responsability_tu_author_num, responsability_tu_num, responsability_tu_fonction, responsability_tu_type, responsability_tu_ordre) VALUES ";
         foreach ($value['authors'] as $author) {
             if ($author['id']) {
                 $rqt = $rqt_ins . " ('" . $author['id'] . "','" . $tu_id . "','" . $author['fonction'] . "','" . $author['type'] . "', {$ordre}) ";
                 $res_ins = @pmb_mysql_query($rqt);
                 $ordre++;
             }
         }
     }
     // Distribution instrumentale et vocale (pour la musique)
     for ($i = 0; $i < count($value['distrib']); $i++) {
         $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$tu_id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // Référence numérique (pour la musique)
     for ($i = 0; $i < count($value['ref']); $i++) {
         $requete = "INSERT INTO tu_ref SET\n\t\t\tref_num_tu='{$tu_id}',\n\t\t\tref_name='" . $value['ref'][$i] . "',\n\t\t\tref_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // Subdivision de forme
     for ($i = 0; $i < count($value['subdiv']); $i++) {
         $requete = "INSERT INTO tu_subdiv SET\n\t\t\tsubdiv_num_tu='{$tu_id}',\n\t\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\t\tsubdiv_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     audit::insert_creation(AUDIT_TITRE_UNIFORME, $tu_id);
     // mise à jour du champ index du titre uniforme
     if ($tu_id) {
         titre_uniforme::update_index_tu($tu_id);
         titre_uniforme::tu_enrichment($tu_id);
     }
     return $tu_id;
 }
 function do_isbd()
 {
     global $msg;
     $isbd_simple = $this->get_isbd_simple();
     $isbd_oeuvre_expressions = "";
     if (count($this->oeuvre_expressions)) {
         $isbd_oeuvre_expressions .= " .- " . $msg["aut_oeuvre_form_oeuvre_expression"];
         foreach ($this->oeuvre_expressions as $expression) {
             $oeuvre_to = new titre_uniforme($expression['to_id']);
             $isbd_oeuvre_expressions .= " " . $oeuvre_to->get_isbd_simple();
         }
     }
     $isbd_other_links = "";
     if (count($this->other_links)) {
         for ($i = 0; $i < count($this->other_links); $i++) {
             $memo_links[$this->other_links[$i]['type']][] = $i;
         }
         foreach ($memo_links as $link => $index_list) {
             $isbd_other_links .= " - " . $this->other_links[$index_list[0]]['type_name'];
             foreach ($index_list as $index) {
                 $oeuvre_link = new titre_uniforme($this->other_links[$index]['to_id']);
                 $isbd_other_links .= " " . $oeuvre_link->get_isbd_simple();
             }
         }
     }
     $this->tu_isbd = $isbd_simple . $isbd_oeuvre_expressions . $isbd_other_links;
     return $isbd_simple;
 }
Example #16
0
     $ourAuthor = new auteur($_SESSION["last_module_search"]["search_id"]);
     $r1 = $msg['author'];
     $r = $r1 . " '" . $ourAuthor->isbd_entry . "'";
     break;
 case "coll_see":
     $ourColl = new collection($_SESSION["last_module_search"]["search_id"]);
     $r1 = $msg['coll_search'];
     $r = $r1 . " '" . $ourColl->isbd_entry . "'";
     break;
 case "subcoll_see":
     $ourSubcoll = new subcollection($_SESSION["last_module_search"]["search_id"]);
     $r1 = $msg['subcoll_search'];
     $r = $r1 . " '" . $ourSubcoll->isbd_entry . "'";
     break;
 case "titre_uniforme_see":
     $ourTu = new titre_uniforme($_SESSION["last_module_search"]["search_id"]);
     $r1 = $msg['titre_uniforme_search'];
     $ourTu->do_isbd();
     $r = $r1 . " '" . $ourTu->tu_isbd . "'";
     break;
 case "publisher_see":
     $ourPub = new publisher($_SESSION["last_module_search"]["search_id"]);
     $r1 = $msg['publisher_search'];
     $r = $r1 . " '" . $ourPub->isbd_entry . "'";
     break;
 case "serie_see":
     $ourSerie = new serie($_SESSION["last_module_search"]["search_id"]);
     $r1 = $msg['serie_query'];
     $r = $r1 . " '" . $ourSerie->name . "'";
     break;
 case "concept_see":
Example #17
0
 function cleanTitresUniformes()
 {
     global $msg, $dbh, $charset, $PMBusername;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result .= "<h3>" . htmlentities($msg["nettoyage_suppr_titres_uniformes"], ENT_QUOTES, $charset) . "</h3>";
         $query = mysql_query("SELECT tu_id from titres_uniformes left join notices_titres_uniformes on ntu_num_tu=tu_id where ntu_num_tu is null", $dbh);
         $affected = 0;
         if ($affected = mysql_num_rows($query)) {
             while ($ligne = mysql_fetch_object($query)) {
                 $tu = new titre_uniforme($ligne->tu_id);
                 $tu->delete();
             }
         }
         //Nettoyage des informations d'autorités pour les sous collections
         titre_uniforme::delete_autority_sources();
         $query = mysql_query("delete notices_titres_uniformes from notices_titres_uniformes left join titres_uniformes on ntu_num_tu=tu_id where tu_id is null", $dbh);
         $affected = mysql_affected_rows();
         $result .= $affected . " " . htmlentities($msg["nettoyage_res_suppr_titres_uniformes"], ENT_QUOTES, $charset);
         $opt = mysql_query('OPTIMIZE TABLE titres_uniformes');
     } else {
         $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername);
     }
     return $result;
 }
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;
    global $opac_show_onglet_map, $opac_map_activate;
    global $opac_map_base_layer_params, $opac_map_size_search_edition, $opac_map_base_layer_type;
    global $map_emprises_query;
    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 = pmb_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 = pmb_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);
            // map
            if ($opac_map_activate) {
                $layer_params = json_decode($opac_map_base_layer_params, true);
                $baselayer = "baseLayerType: dojox.geo.openlayers.BaseLayerType." . $opac_map_base_layer_type;
                if (count($layer_params)) {
                    if ($layer_params['name']) {
                        $baselayer .= ",baseLayerName:\"" . $layer_params['name'] . "\"";
                    }
                    if ($layer_params['url']) {
                        $baselayer .= ",baseLayerUrl:\"" . $layer_params['url'] . "\"";
                    }
                    if ($layer_params['options']) {
                        $baselayer .= ",baseLayerOptions:" . json_encode($layer_params['options']);
                    }
                }
                $size = explode("*", $opac_map_size_search_edition);
                if (count($size) != 2) {
                    $map_size = "width:800px; height:480px;";
                }
                $map_size = "width:" . $size[0] . "px; height:" . $size[1] . "px;";
                if (!$map_emprises_query) {
                    $map_emprises_query = array();
                }
                $map_holds = array();
                foreach ($map_emprises_query as $map_hold) {
                    $map_holds[] = array("wkt" => $map_hold, "type" => "search", "color" => null, "objects" => array());
                }
                $r = "<div id='map_search' data-dojo-type='apps/map/map_controler' style='{$map_size}' data-dojo-props='" . $baselayer . ",mode:\"search_criteria\",hiddenField:\"map_emprises_query\",searchHolds:" . json_encode($map_holds, true) . "'></div>";
                $result = str_replace("!!map!!", $r, $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>";
            }
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</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 = pmb_mysql_query("select location_libelle from docs_location where idlocation='" . addslashes($_SESSION["last_module_search"]["search_location"]) . "'");
                            $j = pmb_mysql_fetch_array($resultat);
                            $localisation_ = $j["location_libelle"];
                            pmb_mysql_free_result($resultat);
                            $resultat = pmb_mysql_query("select section_libelle from docs_section where idsection='" . addslashes($_SESSION["last_module_search"]["search_id"]) . "'");
                            $j = pmb_mysql_fetch_array($resultat);
                            $section_ = $j["section_libelle"];
                            pmb_mysql_free_result($resultat);
                            $r1 = $localisation_ . " => " . $msg["section"];
                            $r = $r1 . " '" . $section_ . "'";
                            break;
                        case "author_see":
                            $ourAuthor = new auteur($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['author'];
                            $r = $r1 . " '" . $ourAuthor->isbd_entry . "'";
                            break;
                        case "coll_see":
                            $ourColl = new collection($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['coll_search'];
                            $r = $r1 . " '" . $ourColl->isbd_entry . "'";
                            break;
                        case "subcoll_see":
                            $ourSubcoll = new subcollection($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['subcoll_search'];
                            $r = $r1 . " '" . $ourSubcoll->isbd_entry . "'";
                            break;
                        case "titre_uniforme_see":
                            $ourTu = new titre_uniforme($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['titre_uniforme_search'];
                            $ourTu->do_isbd();
                            $r = $r1 . " '" . $ourTu->tu_isbd . "'";
                            break;
                        case "publisher_see":
                            $ourPub = new publisher($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['publisher_search'];
                            $r = $r1 . " '" . $ourPub->isbd_entry . "'";
                            break;
                        case "serie_see":
                            $ourSerie = new serie($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['serie_query'];
                            $r = $r1 . " '" . $ourSerie->name . "'";
                            break;
                        case "concept_see":
                            $ourConcept = new skos_concept($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $msg['skos_concept'];
                            $r = $r1 . " '" . $ourConcept->get_display_label() . "'";
                            break;
                        case "authperso_see":
                            $ourAuth = new authperso_authority($_SESSION["last_module_search"]["search_id"]);
                            $r1 = $ourAuth->info['authperso']['name'];
                            $r = $r1 . " '" . $ourAuth->info['isbd'] . "'";
                            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();
            }
            if ($opac_autolevel2 == 2) {
                $result = $es->show_form("./index.php?lvl={$lvl}&search_type_asked=extended_search", "./index.php?lvl=more_results&mode=extended");
            } else {
                $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>";
            }
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</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 = pmb_mysql_query("select location_libelle from docs_location where idlocation='" . addslashes($_SESSION["last_module_search"]["search_location"]) . "'");
                            $j = pmb_mysql_fetch_array($resultat);
                            $localisation_ = $j["location_libelle"];
                            pmb_mysql_free_result($resultat);
                            $resultat = pmb_mysql_query("select section_libelle from docs_section where idsection='" . addslashes($_SESSION["last_module_search"]["search_id"]) . "'");
                            $j = pmb_mysql_fetch_array($resultat);
                            $section_ = $j["section_libelle"];
                            pmb_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_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</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);
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</a></li>";
            }
            $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);
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</a></li>";
            }
            // 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>";
            }
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</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>";
            }
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</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>";
            }
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</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;
        case "map":
            $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>" . $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>";
            }
            if ($opac_show_onglet_map && $opac_map_activate) {
                $others .= "<li id='current'><a href=\"./index.php?search_type_asked=map\">" . $msg["search_by_map"] . "</a></li>";
            }
            $result = str_replace("!!others!!", $others, $result);
            // affichage page géolocalisation
            global $msg;
            global $dbh;
            global $charset, $lang;
            global $all_query, $typdoc_query, $statut_query, $docnum_query, $pmb_indexation_docnum_allfields, $pmb_indexation_docnum;
            global $categ_query, $thesaurus_auto_postage_search, $auto_postage_query;
            global $thesaurus_concepts_active, $concept_query;
            global $map_echelle_query, $map_projection_query, $map_ref_query, $map_equinoxe_query;
            global $opac_map_size_search_edition;
            global $opac_map_base_layer_type;
            global $opac_map_base_layer_params;
            global $map_emprises_query;
            // on commence par créer le champ de sélection de document
            // récupération des types de documents utilisés.
            $query = "SELECT count(typdoc), typdoc ";
            $query .= "FROM notices where typdoc!='' GROUP BY typdoc";
            $res = @pmb_mysql_query($query, $dbh);
            $toprint_typdocfield .= "  <option value=''>{$msg['tous_types_docs']}</option>\n";
            $doctype = new marc_list('doctype');
            while ($rt = pmb_mysql_fetch_row($res)) {
                $obj[$rt[1]] = 1;
                $qte[$rt[1]] = $rt[0];
            }
            foreach ($doctype->table as $key => $libelle) {
                if ($obj[$key] == 1) {
                    $toprint_typdocfield .= "  <option ";
                    $toprint_typdocfield .= " value='{$key}'";
                    if ($typdoc == $key) {
                        $toprint_typdocfield .= " selected='selected' ";
                    }
                    $toprint_typdocfield .= ">" . htmlentities($libelle . " (" . $qte[$key] . ")", ENT_QUOTES, $charset) . "</option>\n";
                }
            }
            // récupération des statuts de documents utilisés.
            $query = "SELECT count(statut), id_notice_statut, gestion_libelle ";
            $query .= "FROM notices, notice_statut where id_notice_statut=statut GROUP BY id_notice_statut order by gestion_libelle";
            $res = pmb_mysql_query($query, $dbh);
            $toprint_statutfield .= "  <option value=''>{$msg['tous_statuts_notice']}</option>\n";
            while ($obj = @pmb_mysql_fetch_row($res)) {
                $toprint_statutfield .= "  <option value='{$obj['1']}'";
                if ($statut_query == $obj[1]) {
                    $toprint_statutfield .= " selected";
                }
                $toprint_statutfield .= ">" . htmlentities($obj[2] . "  (" . $obj[0] . ")", ENT_QUOTES, $charset) . "</OPTION>\n";
            }
            $search_form_map = str_replace("!!typdocfield!!", $toprint_typdocfield, $search_form_map);
            $search_form_map = str_replace("!!statutfield!!", $toprint_statutfield, $search_form_map);
            $search_form_map = str_replace("!!all_query!!", htmlentities(stripslashes($all_query), ENT_QUOTES, $charset), $search_form_map);
            $search_form_map = str_replace("!!categ_query!!", htmlentities(stripslashes($categ_query), ENT_QUOTES, $charset), $search_form_map);
            if ($thesaurus_concepts_active) {
                $search_form_map = str_replace("!!concept_query!!", htmlentities(stripslashes($concept_query), ENT_QUOTES, $charset), $search_form_map);
            }
            // map
            $layer_params = json_decode($opac_map_base_layer_params, true);
            $baselayer = "baseLayerType: dojox.geo.openlayers.BaseLayerType." . $opac_map_base_layer_type;
            if (count($layer_params)) {
                if ($layer_params['name']) {
                    $baselayer .= ",baseLayerName:\"" . $layer_params['name'] . "\"";
                }
                if ($layer_params['url']) {
                    $baselayer .= ",baseLayerUrl:\"" . $layer_params['url'] . "\"";
                }
                if ($layer_params['options']) {
                    $baselayer .= ",baseLayerOptions:" . json_encode($layer_params['options']);
                }
            }
            $size = explode("*", $opac_map_size_search_edition);
            if (count($size) != 2) {
                $map_size = "width:800px; height:480px;";
            }
            $map_size = "width:" . $size[0] . "px; height:" . $size[1] . "px;";
            if (!$map_emprises_query) {
                $map_emprises_query = array();
            }
            $map_holds = array();
            foreach ($map_emprises_query as $map_hold) {
                $map_holds[] = array("wkt" => $map_hold, "type" => "search", "color" => null, "objects" => array());
            }
            $r = "<div id='map_search' data-dojo-type='apps/map/map_controler' style='{$map_size}' data-dojo-props='" . $baselayer . ",mode:\"search_criteria\",hiddenField:\"map_emprises_query\",searchHolds:" . json_encode($map_holds, true) . "'></div>";
            $search_form_map = str_replace("!!map!!", $r, $search_form_map);
            //champs maps
            $requete = "SELECT map_echelle_id, map_echelle_name FROM map_echelles ORDER BY map_echelle_name ";
            $projections = gen_liste($requete, "map_echelle_id", "map_echelle_name", "map_echelle_query", "", $map_echelle_query, 0, "", 0, $msg['map_echelle_vide']);
            $search_form_map = str_replace("!!map_echelle_list!!", $projections, $search_form_map);
            $requete = "SELECT map_projection_id, map_projection_name FROM map_projections ORDER BY map_projection_name ";
            $projections = gen_liste($requete, "map_projection_id", "map_projection_name", "map_projection_query", "", $map_projection_query, 0, "", 0, $msg['map_projection_vide']);
            $search_form_map = str_replace("!!map_projection_list!!", $projections, $search_form_map);
            $requete = "SELECT map_ref_id, map_ref_name FROM map_refs ORDER BY map_ref_name ";
            $refs = gen_liste($requete, "map_ref_id", "map_ref_name", "map_ref_query", "", $map_ref_query, 0, "", 0, $msg['map_ref_vide']);
            $search_form_map = str_replace("!!map_ref_list!!", $refs, $search_form_map);
            $search_form_map = str_replace("!!map_equinoxe_value!!", $map_equinoxe_query, $search_form_map);
            $checkbox = "";
            if ($thesaurus_auto_postage_search) {
                $checkbox = "\r\n\t\t\t\t\t<div class='colonne'>\r\n\t\t\t\t\t<div class='row'>\r\n\t\t\t\t\t<input type='checkbox' !!auto_postage_checked!! id='auto_postage_query' name='auto_postage_query'/><label for='auto_postage_query'>" . $msg["search_autopostage_check"] . "</label>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>";
                $checkbox = str_replace("!!auto_postage_checked!!", $auto_postage_query ? 'checked' : '', $checkbox);
            }
            $search_form_map = str_replace("!!auto_postage!!", $checkbox, $search_form_map);
            if ($pmb_indexation_docnum) {
                $checkbox = "<div class='colonne'>\r\n\t\t\t\t\t<div class='row'>\r\n\t\t\t\t\t<input type='checkbox' !!docnum_query_checked!! id='docnum_query' name='docnum_query'/><label for='docnum_query'>{$msg['docnum_indexation']}</label>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>";
                $checkbox = str_replace("!!docnum_query_checked!!", $pmb_indexation_docnum_allfields || $docnum_query ? 'checked' : '', $checkbox);
                $search_form_map = str_replace("!!docnum_query!!", $checkbox, $search_form_map);
            } else {
                $search_form_map = str_replace("!!docnum_query!!", '', $search_form_map);
            }
            //	$search_form_map = str_replace("!!base_url!!",     $this->base_url,$search_form_map);
            $result = str_replace("!!contenu!!", $search_form_map, $result);
            break;
    }
    return $result;
}