Пример #1
0
function critere_isbn($val1)
{
    $val = $val1;
    if (isEAN($val1)) {
        // la saisie est un EAN -> on tente de le formater en ISBN
        $val1 = z_EANtoISBN($val1);
        // si échec, on prend l'EAN comme il vient
        if (!$val1) {
            $val1 = $val;
        }
    } else {
        if (isISBN($val1)) {
            // si la saisie est un ISBN
            $val1 = z_formatISBN($val1, 13);
            // si échec, ISBN erroné on le prend sous cette forme
            if (!$val1) {
                $val1 = $val;
            }
        } else {
            // ce n'est rien de tout ça, on prend la saisie telle quelle
            $val1 = $val;
        }
    }
    return $val1;
}
Пример #2
0
function traite_val($value, $idf)
{
    switch ($idf) {
        case "22":
            if (isISBN($value)) {
                // si la saisie est un ISBN
                $code = formatISBN($value);
                // si échec, ISBN erroné on le prend sous cette forme
                if (!$code) {
                    $code = $value;
                }
            } else {
                $code = $value;
            }
            $ret = $code;
            break;
        default:
            $ret = $value;
            break;
    }
    return $ret;
}
Пример #3
0
 function doContent()
 {
     global $tdoc;
     global $fonction_auteur;
     //mention titre
     $this->isbd = $this->titre;
     $this->isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']';
     if ($this->notice->tit3) {
         $this->isbd .= " = " . $this->notice->tit3;
     }
     if ($this->notice->tit4) {
         $this->isbd .= " : " . $this->notice->tit4;
     }
     if ($this->notice->tit2) {
         $this->isbd .= " ; " . $this->notice->tit2;
     }
     //mention responsabilité
     $mention_resp = array();
     $as = array_search("0", $this->responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
         $mention_resp_lib = $auteur->isbd_entry;
         if ($auteur_0["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_0["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         $mention_resp_lib = $auteur->isbd_entry;
         if ($auteur_1["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_1["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         $mention_resp_lib = $auteur->isbd_entry;
         if ($auteur_2["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_2["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $libelle_mention_resp = implode("; ", $mention_resp);
     if ($libelle_mention_resp) {
         $this->isbd .= "&nbsp;/ {$libelle_mention_resp}";
     }
     // mention edition
     if ($this->notice->mention_edition) {
         $this->isbd .= ".&nbsp;-&nbsp;" . $this->notice->mention_edition;
     }
     // zone de l'adresse
     // on récupère la collection au passage, si besoin est
     if ($this->notice->subcoll_id) {
         $collection = new subcollection($this->notice->subcoll_id);
         $ed_obj = new editeur($collection->editeur);
         $editeurs .= $ed_obj->isbd_entry;
         $collections = $collection->isbd_entry;
     } elseif ($this->notice->coll_id) {
         $collection = new collection($this->notice->coll_id);
         $ed_obj = new editeur($collection->parent);
         $editeurs .= $ed_obj->isbd_entry;
         $collections = $collection->isbd_entry;
     } elseif ($this->notice->ed1_id) {
         $editeur = new editeur($this->notice->ed1_id);
         $editeurs .= $editeur->isbd_entry;
     }
     if ($this->notice->ed2_id) {
         $editeur = new editeur($this->notice->ed2_id);
         $ed_isbd = $editeur->isbd_entry;
         $editeurs ? $editeurs .= '&nbsp;; ' . $ed_isbd : ($editeurs = $ed_isbd);
     }
     if ($this->notice->year) {
         $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year);
     }
     if ($editeurs) {
         $this->isbd .= ".&nbsp;-&nbsp;{$editeurs}";
     }
     // zone de la collation
     if ($this->notice->npages) {
         $collation = $this->notice->npages;
     }
     if ($this->notice->ill) {
         $collation .= ': ' . $this->notice->ill;
     }
     if ($this->notice->size) {
         $collation .= '; ' . $this->notice->size;
     }
     if ($this->notice->accomp) {
         $collation .= '+ ' . $this->notice->accomp;
     }
     if ($collation) {
         $this->isbd .= ".&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         if ($this->notice->nocoll) {
             $collections .= '; ' . $this->notice->nocoll;
         }
         $this->isbd .= ".&nbsp;-&nbsp;({$collections})" . ' ';
     }
     if (substr(trim($this->isbd), -1) != ".") {
         $this->isbd .= '.';
     }
     // ISBN ou NO. commercial
     if ($this->notice->code) {
         if (isISBN($this->notice->code)) {
             $zoneNote = 'ISBN ';
         }
         $zoneNote .= $this->notice->code;
     }
     //prix code
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneNote .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneNote) {
                 $zoneNote .= '&nbsp; ' . $this->notice->prix;
             } else {
                 $zoneNote = $this->notice->prix;
             }
         }
     }
     if ($zoneNote) {
         $this->isbd .= "<br /><br />{$zoneNote}.";
     }
 }
Пример #4
0
 $EAN = '';
 $isbn = '';
 $code = '';
 if (isEAN($ex_query)) {
     // la saisie est un EAN -> on tente de le formater en ISBN
     $EAN = $ex_query;
     $isbn = EANtoISBN($ex_query);
     // si échec, on prend l'EAN comme il vient
     if (!$isbn) {
         $code = str_replace("*", "%", $ex_query);
     } else {
         $code = $isbn;
         $code10 = formatISBN($code, 10);
     }
 } else {
     if (isISBN($ex_query)) {
         // si la saisie est un ISBN
         $isbn = formatISBN($ex_query);
         // si échec, ISBN erroné on le prend sous cette forme
         if (!$isbn) {
             $code = str_replace("*", "%", $ex_query);
         } else {
             $code10 = $isbn;
             $code = formatISBN($code10, 13);
         }
     } else {
         // ce n'est rien de tout ça, on prend la saisie telle quelle
         $code = str_replace("*", "%", $ex_query);
         // filtrer par typdoc_query si selectionné
         if ($typdoc_query) {
             $where_typedoc = " and typdoc='{$typdoc_query}' ";
Пример #5
0
 function make_search($prefixe = "")
 {
     global $search;
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_multi_search_operator;
     global $pmb_search_stemming_active;
     $this->error_message = "";
     $last_table = "";
     $field_keyName = $this->keyName;
     //Pour chaque champ
     for ($i = 0; $i < count($search); $i++) {
         //construction de la requete
         $s = explode("_", $search[$i]);
         //Recuperation de l'operateur
         $op = "op_" . $i . "_" . $search[$i];
         //Recuperation du contenu de la recherche
         $field_ = "field_" . $i . "_" . $search[$i];
         global ${$field_};
         $field = ${$field_};
         //Recuperation de l'operateur inter-champ
         $inter = "inter_" . $i . "_" . $search[$i];
         global ${$inter};
         global ${$op};
         //Recuperation des variables auxiliaires
         $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i];
         global ${$fieldvar_};
         $fieldvar = ${$fieldvar_};
         //Si c'est un champ fixe
         if ($s[0] == "f") {
             $ff = $this->fixedfields[$s[1]];
             //Choix du moteur
             if ($this->memory_engine_allowed && !$ff['MEMORYENGINEFORBIDDEN']) {
                 $this->current_engine = 'MEMORY';
             } else {
                 $this->current_engine = 'MyISAM';
             }
             //Calcul des variables
             $var_table = array();
             for ($j = 0; $j < count($ff["VAR"]); $j++) {
                 switch ($ff["VAR"][$j]["TYPE"]) {
                     case "input":
                         $var_table[$ff["VAR"][$j]["NAME"]] = @implode(",", $fieldvar[$ff["VAR"][$j]["NAME"]]);
                         break;
                     case "global":
                         $global_name = $ff["VAR"][$j]["NAME"];
                         global ${$global_name};
                         $var_table[$ff["VAR"][$j]["NAME"]] = ${$global_name};
                         break;
                     case "calculated":
                         $calc = $ff["VAR"][$j]["OPTIONS"]["CALC"][0];
                         switch ($calc["TYPE"]) {
                             case "value_from_query":
                                 $query_calc = $calc["QUERY"][0]["value"];
                                 @reset($var_table);
                                 while (list($var_name, $var_value) = @each($var_table)) {
                                     $query_calc = str_replace("!!" . $var_name . "!!", $var_value, $query_calc);
                                 }
                                 $r_calc = pmb_mysql_query($query_calc);
                                 $var_table[$ff["VAR"][$j]["NAME"]] = @pmb_mysql_result($r_calc, 0, 0);
                                 break;
                         }
                         break;
                 }
             }
             $q_index = $ff["QUERIES_INDEX"];
             //Recuperation de la requete associee au champ et a l'operateur
             $q = $ff["QUERIES"][$q_index[${$op}]];
             //Si c'est une requete conditionnelle, on sélectionne la bonne requete et on supprime les autres
             if ($q[0]["CONDITIONAL"]) {
                 $k_default = 0;
                 $q_temp = array();
                 $q_temp["OPERATOR"] = $q["OPERATOR"];
                 for ($k = 0; $k < count($q) - 1; $k++) {
                     if ($var_table[$q[$k]["CONDITIONAL"]["name"]] == $q[$k]["CONDITIONAL"]["value"]) {
                         break;
                     }
                     if ($q[$k]["CONDITIONAL"]["value"] == "default") {
                         $k_default = $k;
                     }
                 }
                 if ($k == count($q) - 1) {
                     $k = $k_default;
                 }
                 $q_temp[0] = $q[$k];
                 $q = $q_temp;
             }
             //Remplacement par les variables eventuelles pour chaque requete
             for ($k = 0; $k < count($q) - 1; $k++) {
                 reset($var_table);
                 while (list($var_name, $var_value) = each($var_table)) {
                     $q[$k]["MAIN"] = str_replace("!!" . $var_name . "!!", $var_value, $q[$k]["MAIN"]);
                     $q[$k]["MULTIPLE_TERM"] = str_replace("!!" . $var_name . "!!", $var_value, $q[$k]["MULTIPLE_TERM"]);
                 }
             }
             $last_main_table = "";
             // pour les listes, si un opérateur permet une valeur vide, il en faut une...
             if ($this->op_empty[${$op}] && !is_array($field)) {
                 $field = array();
                 $field[0] = "";
             }
             // si sélection d'autorité et champ vide : on ne doit pas le prendre en compte
             if (${$op} == 'AUTHORITY') {
                 $suppr = false;
                 foreach ($field as $k => $v) {
                     if ($v == 0) {
                         unset($field[$k]);
                         $suppr = true;
                     }
                 }
                 if ($suppr) {
                     $field = array_values($field);
                 }
             }
             //Pour chaque valeur du champ
             for ($j = 0; $j < count($field); $j++) {
                 //Pour chaque requete
                 $field_origine = $field[$j];
                 for ($z = 0; $z < count($q) - 1; $z++) {
                     //Pour chaque valeur du cha
                     //Si le nettoyage de la saisie est demande
                     if ($q[$z]["KEEP_EMPTYWORD"]) {
                         $field[$j] = strip_empty_chars($field_origine);
                     } elseif ($q[$z]["REGDIACRIT"]) {
                         $field[$j] = strip_empty_words($field_origine);
                     } elseif ($q[$z]["DETECTDATE"]) {
                         $field[$j] = detectFormatDate($field_origine, $q[$z]["DETECTDATE"]);
                     }
                     $main = $q[$z]["MAIN"];
                     //Si il y a plusieurs termes possibles on construit la requete avec le terme !!multiple_term!!
                     if ($q[$z]["MULTIPLE_WORDS"]) {
                         $terms = explode(" ", $field[$j]);
                         //Pour chaque terme,
                         $multiple_terms = array();
                         for ($k = 0; $k < count($terms); $k++) {
                             $multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
                         }
                         $final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                         $main = str_replace("!!multiple_term!!", $final_term, $main);
                         //Si la saisie est un ISBN
                     } else {
                         if ($q[$z]["ISBN"]) {
                             //Code brut
                             $terms[0] = $field[$j];
                             //EAN ?
                             if (isEAN($field[$j])) {
                                 //C'est un isbn ?
                                 if (isISBN($field[$j])) {
                                     $rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
                                     //On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
                                     $terms[1] = formatISBN($rawisbn, 10);
                                     $terms[2] = formatISBN($rawisbn, 13);
                                     $terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
                                     $terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
                                 }
                             } else {
                                 if (isISBN($field[$j])) {
                                     $rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
                                     //On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
                                     $terms[1] = formatISBN($rawisbn, 10);
                                     $terms[2] = formatISBN($rawisbn, 13);
                                     $terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
                                     $terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
                                 }
                             }
                             //Pour chaque terme,
                             $multiple_terms = array();
                             for ($k = 0; $k < count($terms); $k++) {
                                 $multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
                             }
                             $final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                             $main = str_replace("!!multiple_term!!", $final_term, $main);
                         } else {
                             if ($q[$z]["BOOLEAN"]) {
                                 if ($q[$z]['STEMMING']) {
                                     $stemming = $pmb_search_stemming_active;
                                 } else {
                                     $stemming = 0;
                                 }
                                 $aq = new analyse_query($field[$j], 0, 0, 1, 0, $stemming);
                                 $aq1 = new analyse_query($field[$j], 0, 0, 1, 1, $stemming);
                                 if ($q[$z]["KEEP_EMPTY_WORDS_FOR_CHECK"]) {
                                     $err = $aq1->error;
                                 } else {
                                     $err = $aq->error;
                                 }
                                 if (!$err) {
                                     if (is_array($q[$z]["TABLE"])) {
                                         for ($z1 = 0; $z1 < count($q[$z]["TABLE"]); $z1++) {
                                             $is_fulltext = false;
                                             if ($q[$z]["FULLTEXT"][$z1]) {
                                                 $is_fulltext = true;
                                             }
                                             if (!$q[$z]["KEEP_EMPTY_WORDS"][$z1]) {
                                                 $members = $aq->get_query_members($q[$z]["TABLE"][$z1], $q[$z]["INDEX_L"][$z1], $q[$z]["INDEX_I"][$z1], $q[$z]["ID_FIELD"][$z1], $q[$z]["RESTRICT"][$z1], 0, 0, $is_fulltext);
                                             } else {
                                                 $members = $aq1->get_query_members($q[$z]["TABLE"][$z1], $q[$z]["INDEX_L"][$z1], $q[$z]["INDEX_I"][$z1], $q[$z]["ID_FIELD"][$z1], $q[$z]["RESTRICT"][$z1], 0, 0, $is_fulltext);
                                             }
                                             $main = str_replace("!!pert_term_" . ($z1 + 1) . "!!", $members["select"], $main);
                                             $main = str_replace("!!where_term_" . ($z1 + 1) . "!!", $members["where"], $main);
                                         }
                                     } else {
                                         $is_fulltext = false;
                                         if ($q[$z]["FULLTEXT"]) {
                                             $is_fulltext = true;
                                         }
                                         if ($q[$z]["KEEP_EMPTY_WORDS"]) {
                                             $members = $aq1->get_query_members($q[$z]["TABLE"], $q[$z]["INDEX_L"], $q[$z]["INDEX_I"], $q[$z]["ID_FIELD"], $q[$z]["RESTRICT"], 0, 0, $is_fulltext);
                                         } else {
                                             $members = $aq->get_query_members($q[$z]["TABLE"], $q[$z]["INDEX_L"], $q[$z]["INDEX_I"], $q[$z]["ID_FIELD"], $q[$z]["RESTRICT"], 0, 0, $is_fulltext);
                                         }
                                         $main = str_replace("!!pert_term!!", $members["select"], $main);
                                         $main = str_replace("!!where_term!!", $members["where"], $main);
                                     }
                                 } else {
                                     $main = "select notice_id from notices where notice_id=0";
                                     $this->error_message = sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message);
                                 }
                             } else {
                                 if ($q[$z]["WORD"]) {
                                     if ($q[$z]['CLASS'] == "searcher_all_fields") {
                                         //Pour savoir si la recherche tous champs inclut les docnum ou pas
                                         global $mutli_crit_indexation_docnum_allfields;
                                         if ($var_table["is_num"]) {
                                             $mutli_crit_indexation_docnum_allfields = 1;
                                         } else {
                                             $mutli_crit_indexation_docnum_allfields = -1;
                                         }
                                     }
                                     //recherche par terme...
                                     if ($q[$z]["FIELDS"]) {
                                         $searcher = new $q[$z]['CLASS']($field[$j], $q[$z]["FIELDS"]);
                                     } else {
                                         $searcher = new $q[$z]['CLASS']($field[$j]);
                                     }
                                     $main = $searcher->get_full_query();
                                     //   							print "<br><br>".$main;
                                 } else {
                                     $main = str_replace("!!p!!", addslashes($field[$j]), $main);
                                 }
                             }
                         }
                     }
                     //Y-a-t-il une close repeat ?
                     if ($q[$z]["REPEAT"]) {
                         //Si oui, on repete !!
                         $onvals = $q[$z]["REPEAT"]["ON"];
                         global ${$onvals};
                         $onvalst = explode($q[$z]["REPEAT"]["SEPARATOR"], ${$onvals});
                         $mains = array();
                         for ($ir = 0; $ir < count($onvalst); $ir++) {
                             $mains[] = str_replace("!!" . $q[$z]["REPEAT"]["NAME"] . "!!", $onvalst[$ir], $main);
                         }
                         $main = implode(" " . $q[$z]["REPEAT"]["OPERATOR"] . " ", $mains);
                         $main = "select * from (" . $main . ") as sbquery" . ($q[$z]["REPEAT"]["ORDERTERM"] ? " order by " . $q[$z]["REPEAT"]["ORDERTERM"] : "");
                     }
                     if ($z < count($q) - 2) {
                         pmb_mysql_query($main);
                     }
                 }
                 if ($fieldvar["operator_between_multiple_authorities"]) {
                     $operator = $fieldvar["operator_between_multiple_authorities"][0];
                 } elseif ($q["DEFAULT_OPERATOR"]) {
                     $operator = $q["DEFAULT_OPERATOR"];
                 } else {
                     $operator = $pmb_multi_search_operator ? $pmb_multi_search_operator : "or";
                 }
                 if (count($field) > 1) {
                     if ($operator == "or") {
                         //Ou logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "insert ignore into " . $prefixe . "mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             } else {
                                 $requete = "insert ignore into mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             }
                             pmb_mysql_query($requete, $dbh);
                             //pmb_mysql_query("drop table mf_".$j,$dbh);
                             pmb_mysql_query("drop table " . $last_main_table, $dbh);
                         }
                         //else pmb_mysql_query("drop table mf_".$j,$dbh);
                         if ($prefixe) {
                             $last_main_table = $prefixe . "mf_" . $j;
                         } else {
                             $last_main_table = "mf_" . $j;
                         }
                     } elseif ($operator == "and") {
                         //ET logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "create temporary table " . $prefixe . "and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select " . $prefixe . "mf_" . $j . ".* from " . $prefixe . "mf_" . $j . " where " . $last_tables . ".notice_id=" . $prefixe . "mf_" . $j . ".notice_id)";
                             } else {
                                 $requete = "create temporary table and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select mf_" . $j . ".* from mf_" . $j . " where " . $last_tables . ".notice_id=mf_" . $j . ".notice_id)";
                             }
                             pmb_mysql_query($requete, $dbh);
                             pmb_mysql_query("drop table " . $last_tables, $dbh);
                         }
                         if ($prefixe) {
                             $last_tables = $prefixe . "mf_" . $j;
                         } else {
                             $last_tables = "mf_" . $j;
                         }
                         if ($prefixe) {
                             $last_main_table = $prefixe . "and_result_" . $j;
                         } else {
                             $last_main_table = "and_result_" . $j;
                         }
                     }
                 }
                 //else print $main;
             }
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         } elseif (array_key_exists($s[0], $this->pp)) {
             $datatype = $this->pp[$s[0]]->t_fields[$s[1]]["DATATYPE"];
             $df = $this->dynamicfields[$s[0]]["FIELD"][$this->get_id_from_datatype($datatype, $s[0])];
             $q_index = $df["QUERIES_INDEX"];
             $q = $df["QUERIES"][$q_index[${$op}]];
             //Choix du moteur
             if ($this->memory_engine_allowed && !$df['MEMORYENGINEFORBIDDEN']) {
                 $this->current_engine = 'MEMORY';
             } else {
                 $this->current_engine = 'MyISAM';
             }
             //Pour chaque valeur du champ
             $last_main_table = "";
             if (count($field) == 0) {
                 $field[0] = "";
             }
             for ($j = 0; $j < count($field); $j++) {
                 if ($q["KEEP_EMPTYWORD"]) {
                     $field[$j] = strip_empty_chars($field[$j]);
                 } elseif ($q["REGDIACRIT"]) {
                     $field[$j] = strip_empty_words($field[$j]);
                 }
                 $main = $q["MAIN"];
                 //Si il y a plusieurs termes possibles
                 if ($q["MULTIPLE_WORDS"]) {
                     $terms = explode(" ", $field[$j]);
                     //Pour chaque terme
                     $multiple_terms = array();
                     for ($k = 0; $k < count($terms); $k++) {
                         $mt = str_replace("!!p!!", addslashes($terms[$k]), $q["MULTIPLE_TERM"]);
                         $mt = str_replace("!!field!!", $s[1], $mt);
                         $multiple_terms[] = $mt;
                     }
                     $final_term = implode(" " . $q["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                     $main = str_replace("!!multiple_term!!", $final_term, $main);
                 } else {
                     $main = str_replace("!!p!!", addslashes($field[$j]), $main);
                 }
                 $main = str_replace("!!field!!", $s[1], $main);
                 if ($q["WORD"]) {
                     //recherche par terme...
                     $searcher = new $q['CLASS']($field[$j], $s[1]);
                     $main = $searcher->get_full_query();
                 }
                 //Choix de l'operateur dans la liste
                 if ($q["DEFAULT_OPERATOR"]) {
                     $operator = $q["DEFAULT_OPERATOR"];
                 } else {
                     $operator = $pmb_multi_search_operator ? $pmb_multi_search_operator : "or";
                 }
                 if (count($field) > 1) {
                     if ($operator == "or") {
                         //Ou logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "insert ignore into " . $prefixe . "mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             } else {
                                 $requete = "insert ignore into mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             }
                             pmb_mysql_query($requete, $dbh);
                             //pmb_mysql_query("drop table mf_".$j,$dbh);
                             pmb_mysql_query("drop table " . $last_main_table, $dbh);
                         }
                         //else pmb_mysql_query("drop table mf_".$j,$dbh);
                         if ($prefixe) {
                             $last_main_table = $prefixe . "mf_" . $j;
                         } else {
                             $last_main_table = "mf_" . $j;
                         }
                     } elseif ($operator == "and") {
                         //ET logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "create temporary table " . $prefixe . "and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select " . $prefixe . "mf_" . $j . ".* from " . $prefixe . "mf_" . $j . " where " . $last_tables . ".notice_id=" . $prefixe . "mf_" . $j . ".notice_id)";
                             } else {
                                 $requete = "create temporary table and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select mf_" . $j . ".* from mf_" . $j . " where " . $last_tables . ".notice_id=mf_" . $j . ".notice_id)";
                             }
                             pmb_mysql_query($requete, $dbh);
                             pmb_mysql_query("drop table " . $last_tables, $dbh);
                         }
                         if ($prefixe) {
                             $last_tables = $prefixe . "mf_" . $j;
                         } else {
                             $last_tables = "mf_" . $j;
                         }
                         if ($prefixe) {
                             $last_main_table = $prefixe . "and_result_" . $j;
                         } else {
                             $last_main_table = "and_result_" . $j;
                         }
                     }
                 }
                 //else print $main;
             }
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         } elseif ($s[0] == "s") {
             //instancier la classe de traitement du champ special
             $type = $this->specialfields[$s[1]]["TYPE"];
             for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) {
                 if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) {
                     $sf = $this->specialfields[$s[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"]($s[1], $i, $sf, $this);
                     $last_main_table = $specialclass->make_search();
                     break;
                 }
             }
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         } elseif ($s[0] == "authperso") {
             $aq = new analyse_query($field[0], 0, 0, 1, 1, $opac_stemming_active);
             $members = $aq->get_query_members("authperso_authorities", "authperso_infos_global", "authperso_index_infos_global", "id_authperso_authority");
             $clause = "where " . $members["where"] . " and notice_id=notice_authperso_notice_num and notice_authperso_authority_num=id_authperso_authority and authperso_authority_authperso_num=" . $s[1];
             $main = "select distinct notice_id FROM notices,notices_authperso,authperso_authorities {$clause} ";
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         }
         if ($prefixe) {
             $table = $prefixe . "t_" . $i . "_" . $search[$i];
             $requete = "create temporary table " . $prefixe . "t_" . $i . "_" . $search[$i] . " ENGINE=" . $this->current_engine . " " . $main;
             pmb_mysql_query($requete, $dbh);
             $requete = "alter table " . $prefixe . "t_" . $i . "_" . $search[$i] . " add idiot int(1)";
             @pmb_mysql_query($requete);
             $requete = "alter table " . $prefixe . "t_" . $i . "_" . $search[$i] . " add unique({$field_keyName})";
             pmb_mysql_query($requete);
         } else {
             $table = "t_" . $i . "_" . $search[$i];
             $requete = "create temporary table t_" . $i . "_" . $search[$i] . " ENGINE=" . $this->current_engine . " " . $main;
             pmb_mysql_query($requete, $dbh);
             $requete = "alter table t_" . $i . "_" . $search[$i] . " add idiot int(1)";
             @pmb_mysql_query($requete);
             $requete = "alter table t_" . $i . "_" . $search[$i] . " add unique({$field_keyName})";
             pmb_mysql_query($requete);
         }
         if ($last_main_table) {
             $requete = "drop table " . $last_main_table;
             pmb_mysql_query($requete);
         }
         if ($prefixe) {
             $requete = "create temporary table " . $prefixe . "t" . $i . " ENGINE=" . $this->current_engine . " ";
         } else {
             $requete = "create temporary table t" . $i . " ENGINE=" . $this->current_engine . " ";
         }
         $isfirst_criteria = false;
         switch (${$inter}) {
             case "and":
                 $requete .= "select " . $table . ".* from {$last_table},{$table} where " . $table . ".{$field_keyName}=" . $last_table . ".{$field_keyName} and {$table}.idiot is null and {$last_table}.idiot is null";
                 @pmb_mysql_query($requete, $dbh);
                 break;
             case "or":
                 //Si la table précédente est vide, c'est comme au premier jour !
                 $requete_c = "select count(*) from " . $last_table;
                 if (!@pmb_mysql_result(pmb_mysql_query($requete_c), 0, 0)) {
                     $isfirst_criteria = true;
                 } else {
                     $requete .= "select * from " . $table;
                     @pmb_mysql_query($requete, $dbh);
                     if ($prefixe) {
                         $requete = "alter table " . $prefixe . "t" . $i . " add idiot int(1)";
                         @pmb_mysql_query($requete);
                         $requete = "alter table " . $prefixe . "t" . $i . " add unique({$field_keyName})";
                         @pmb_mysql_query($requete);
                     } else {
                         $requete = "alter table t" . $i . " add idiot int(1)";
                         @pmb_mysql_query($requete);
                         $requete = "alter table t" . $i . " add unique({$field_keyName})";
                         @pmb_mysql_query($requete);
                     }
                     if ($prefixe) {
                         $requete = "insert into " . $prefixe . "t" . $i . " ({$field_keyName},idiot) select distinct " . $last_table . "." . $field_keyName . "," . $last_table . ".idiot from " . $last_table . " left join " . $table . " on " . $last_table . ".{$field_keyName}=" . $table . ".{$field_keyName} where " . $table . ".{$field_keyName} is null";
                     } else {
                         $requete = "insert into t" . $i . " ({$field_keyName},idiot) select distinct " . $last_table . "." . $field_keyName . "," . $last_table . ".idiot from " . $last_table . " left join " . $table . " on " . $last_table . ".{$field_keyName}=" . $table . ".{$field_keyName} where " . $table . ".{$field_keyName} is null";
                         //print $requete;
                     }
                     @pmb_mysql_query($requete, $dbh);
                 }
                 break;
             case "ex":
                 //$requete_not="create temporary table ".$table."_b select notices.notice_id from notices left join ".$table." on notices.notice_id=".$table.".notice_id where ".$table.".notice_id is null";
                 //@pmb_mysql_query($requete_not);
                 //$requete_not="alter table ".$table."_b add idiot int(1), add unique(notice_id)";
                 //@pmb_mysql_query($requete_not);
                 $requete .= "select " . $last_table . ".* from {$last_table} left join " . $table . " on " . $table . ".{$field_keyName}=" . $last_table . ".{$field_keyName} where " . $table . ".{$field_keyName} is null";
                 @pmb_mysql_query($requete);
                 //$requete="drop table ".$table."_b";
                 //@pmb_mysql_query($requete);
                 if ($prefixe) {
                     $requete = "alter table " . $prefixe . "t" . $i . " add idiot int(1)";
                     @pmb_mysql_query($requete);
                     $requete = "alter table " . $prefixe . "t" . $i . " add unique({$field_keyName})";
                     @pmb_mysql_query($requete);
                 } else {
                     $requete = "alter table t" . $i . " add idiot int(1)";
                     @pmb_mysql_query($requete);
                     $requete = "alter table t" . $i . " add unique({$field_keyName})";
                     @pmb_mysql_query($requete);
                 }
                 break;
             default:
                 $isfirst_criteria = true;
                 @pmb_mysql_query($requete, $dbh);
                 $requete = "alter table {$table} add idiot int(1)";
                 @pmb_mysql_query($requete);
                 $requete = "alter table {$table} add unique({$field_keyName})";
                 @pmb_mysql_query($requete);
                 break;
         }
         if (!$isfirst_criteria) {
             pmb_mysql_query("drop table if exists {$last_table}", $dbh);
             pmb_mysql_query("drop table if exists {$table}", $dbh);
             if ($prefixe) {
                 $last_table = $prefixe . "t" . $i;
             } else {
                 $last_table = "t" . $i;
             }
         } else {
             pmb_mysql_query("drop table if exists {$last_table}", $dbh);
             $last_table = $table;
         }
     }
     return $last_table;
 }
Пример #6
0
function convert_ris($notice, $s, $islast, $isfirst, $param_path)
{
    global $cols;
    global $ty;
    global $intitules;
    global $base_path, $origine;
    global $tab_functions;
    global $lot;
    global $charset;
    if (mb_detect_encoding($notice) == 'UTF-8' && $charset == "iso-8859-1") {
        $notice = utf8_decode($notice);
    }
    if (!$tab_functions) {
        $tab_functions = new marc_list('function');
    }
    $fields = explode("\n", $notice);
    $error = "";
    if ($fields) {
        $data = "<notice>\n";
    }
    $lignes = organize_line($fields);
    foreach ($lignes as $champ => $value) {
        switch ($champ) {
            case 'CT':
            case 'TI':
            case 'T1':
                //Titre principal
                $titre = $value;
                break;
            case 'T2':
                //Autre info sur titre
                $titre_other = $value;
                break;
            case 'PB':
                //Editeur
                $editeur_nom = $value;
                break;
            case 'CY':
                //Editeur
                $editeur_ville = $value;
                break;
            case 'AU':
                //Autres auteurs
                $autres_auteurs = $value;
                break;
            case 'A1':
                //Auteur principal
                $auteur_principal = $value;
                break;
            case 'A2':
                //Auteur secondaire
                $auteur_secondaire = $value;
                break;
            case 'SN':
                //ISBN/ISSN
                $code = trim($value);
                $pos = strpos($code, "(");
                if ($pos !== false) {
                    $code = substr($code, 0, $pos);
                }
                if (isISBN($code)) {
                    $infos_isbn = $code;
                } elseif (isISSN($code)) {
                    $infos_issn = $code;
                } else {
                    $error = "wrong ISBN/ISSN \n";
                }
                break;
            case 'UR':
                //URL
                $url = $value;
                break;
            case 'PY':
                //Date de publication (YYYY/MM/DD)
                $dates = explode("/", $value);
                if ($dates[0]) {
                    $year = $dates[0];
                }
                if ($dates[1]) {
                    $month = $dates[1];
                }
                if ($dates[2]) {
                    $day = $dates[2];
                }
                $publication_date = $year;
                if ($year && $month && $day) {
                    $date_sql = str_replace("/", "-", $value);
                    $mention_date = $value;
                } else {
                    if ($year && $month && !$day) {
                        $date_sql = $year . "-" . $month . "-01";
                        $mention_date = $year . "/" . $month;
                    } else {
                        if ($year && !$month && !$day) {
                            $date_sql = $year . "-01-01";
                            $mention_date = $year;
                        }
                    }
                }
                break;
            case 'TY':
                //Document type
                switch ($value) {
                    case 'ABST':
                        $subtype = 'Abstract';
                        break;
                    case 'BOOK':
                        $subtype = 'Book';
                        break;
                    case 'CHAP':
                        $subtype = 'Chapter';
                        break;
                    case 'COMP':
                        $subtype = 'Computing Program';
                        break;
                    case 'CONF':
                        $subtype = 'Conference Proceedings';
                        break;
                    case 'INPR':
                        $subtype = 'Preprint';
                        break;
                    case 'NEWS':
                    case 'JFULL':
                        $subtype = 'Journal';
                        break;
                    case 'MGZN':
                    case 'JOUR':
                        $subtype = 'Article';
                        break;
                    case 'MAP':
                        $subtype = 'Map';
                        break;
                    case 'UNPB':
                    case 'RPRT':
                        $subtype = 'Report';
                        break;
                    case 'SLIDE':
                        $subtype = 'Presentation';
                        break;
                    case 'THES':
                        $subtype = 'Thesis';
                        break;
                    default:
                        $subtype = 'Article';
                        break;
                }
                break;
            case 'N1':
                //Notes
                $notes = $value;
                break;
            case 'SP':
                //Start page
                $start_page = $value;
                break;
            case 'EP':
                //End page
                $end_page = $value;
                break;
            case 'KW':
                //Mots cles
                $keywords = $value;
                break;
            case 'AD':
                //Collectivite
                $collectivite = $value;
                break;
            case 'IS':
                //Numéro de bulletin
                $bull_num = $value;
                break;
            case 'VL':
                //Volume
                $bull_vol = $value;
                break;
            case 'AB':
                //Résumé
                $resume = $value;
                break;
            case 'JF':
                //Titre du pério
                $perio_title = $value;
                break;
            default:
                $data .= '';
                break;
        }
    }
    //Construction du fichier
    $data .= "<rs>n</rs>\n\t\t  <dt>a</dt>\n\t\t  <bl>a</bl>\n\t\t  <hl>2</hl>\n\t\t  <el>1</el>\n\t\t  <ru>i</ru>\n";
    //Soyons sûr que le microtime ne sera plus le même..
    usleep(1);
    $data .= "<f c='001' ind='  '>\n";
    $data .= htmlspecialchars(microtime(), ENT_QUOTES, $charset);
    $data .= "</f>\n";
    if ($titre) {
        $data .= "<f c='200' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($titre, ENT_QUOTES, $charset) . "</s>";
        if ($titre_other) {
            $data .= "\t<s c='e'>" . htmlspecialchars($titre_other, ENT_QUOTES, $charset) . "</s>";
        }
        $data .= "</f>\n";
    }
    if ($editeur_nom || $publication_date || $editeur_ville) {
        $data .= "<f c='210' ind='  '>\n";
        if ($editeur_ville) {
            $data .= "\t<s c='a'>" . htmlspecialchars($editeur_ville, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($editeur_nom) {
            $data .= "\t<s c='c'>" . htmlspecialchars($editeur_nom, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($publication_date) {
            $data .= "\t<s c='d'>" . htmlspecialchars($publication_date, ENT_QUOTES, $charset) . "</s>";
        }
        $data .= "</f>\n";
    }
    if ($start_page || $end_page) {
        $data .= "<f c='215' ind='  '>\n";
        if ($start_page && $end_page) {
            $data .= "\t<s c='a'>" . htmlspecialchars($start_page . "-" . $end_page, ENT_QUOTES, $charset) . "</s>\n";
        }
        if (!$start_page && $end_page) {
            $data .= "\t<s c='a'>" . htmlspecialchars($end_page, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($start_page && !$end_page) {
            $data .= "\t<s c='a'>" . htmlspecialchars($start_page, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "</f>\n";
    }
    if ($notes) {
        $note = explode('###', $notes);
        $doi = "";
        $pubmedid = "";
        for ($i = 0; $i < count($note); $i++) {
            if (strpos($note[$i], "doi:") !== false) {
                $doi = $note[$i];
            } else {
                if (strpos($note[$i], "PubMed ID:") !== false) {
                    $pubmedid = $note[$i];
                } else {
                    if (strlen($note[$i]) > 9000) {
                        $word = wordwrap($note[$i], 9000, "####");
                        $words = explode("####", $word);
                        for ($j = 0; $j < count($words); $j++) {
                            $data .= "<f c='300' ind='  '>\n";
                            $data .= "\t<s c='a'>" . htmlspecialchars($words[$j], ENT_QUOTES, $charset) . "</s>\n";
                            $data .= "</f>\n";
                        }
                    } else {
                        $data .= "<f c='300' ind='  '>\n";
                        $data .= "\t<s c='a'>" . htmlspecialchars($note[$i], ENT_QUOTES, $charset) . "</s>\n";
                        $data .= "</f>\n";
                    }
                }
            }
        }
    }
    if ($resume) {
        $data .= "<f c='330' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($resume, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($perio_title) {
        $data .= "<f c='461' ind='  '>\n";
        $data .= "\t<s c='t'>" . htmlspecialchars($perio_title, ENT_QUOTES, $charset) . "</s>\n";
        if ($infos_issn) {
            $data .= "\t<s c='x'>" . htmlspecialchars($infos_issn, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "\t<s c='9'>lnk:perio</s>\n";
        $data .= "</f>\n";
    }
    if ($bull_num || $bull_vol) {
        $data .= "<f c='463' ind='  '>\n";
        if ($bull_num && $bull_vol) {
            $data .= "\t<s c='v'>" . "vol. " . htmlspecialchars($bull_vol, ENT_QUOTES, $charset) . ", no. " . htmlspecialchars($bull_num, ENT_QUOTES, $charset) . "</s>\n";
        } else {
            if ($bull_num && !$bull_vol) {
                $data .= "\t<s c='v'>no. " . htmlspecialchars($bull_num, ENT_QUOTES, $charset) . "</s>\n";
            } else {
                if (!$bull_num && $bull_vol) {
                    $data .= "\t<s c='v'>vol. " . htmlspecialchars($bull_vol, ENT_QUOTES, $charset) . "</s>\n";
                }
            }
        }
        if ($date_sql) {
            $data .= "\t<s c='d'>" . htmlspecialchars($date_sql, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($mention_date) {
            $data .= "\t<s c='e'>" . htmlspecialchars($mention_date, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "\t<s c='9'>lnk:bull</s>\n";
        $data .= "</f>\n";
    }
    if ($keywords) {
        $mots = explode('###', $keywords);
        for ($i = 0; $i < count($mots); $i++) {
            $data .= "<f c='610' ind='0 '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($mots[$i], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "</f>\n";
        }
    }
    if ($auteur_principal) {
        $aut = explode(", ", $auteur_principal);
        $data .= "<f c='700' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($aut[0], ENT_QUOTES, $charset) . "</s>\n";
        $data .= "\t<s c='b'>" . htmlspecialchars($aut[1], ENT_QUOTES, $charset) . "</s>\n";
        if ($aut[2]) {
            $data .= "\t<s c='c'>" . htmlspecialchars($aut[2], ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "</f>\n";
    }
    if ($collectivite) {
        $collectivites = explode("###", $collectivite);
        if (count($collectivites) == 1 && !$auteur_principal) {
            $coll_elt = explode(", ", $collectivites[0], 2);
            $coll_nom = $coll_elt[0];
            $coll_pays = trim(substr($coll_elt[1], strrpos($coll_elt[1], ", ") + 1));
            $coll_lieu = trim(substr($coll_elt[1], 0, -(strlen($coll_pays) + 2)));
            $data .= "<f c='710' ind='0 '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($coll_nom, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='e'>" . htmlspecialchars($coll_lieu, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='m'>" . htmlspecialchars($coll_pays, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "</f>\n";
        } else {
            for ($i = 0; $i < count($collectivites); $i++) {
                $coll_elt = explode(", ", $collectivites[$i], 2);
                $coll_nom = $coll_elt[0];
                $coll_pays = trim(substr($coll_elt[1], strrpos($coll_elt[1], ", ") + 1));
                $coll_lieu = trim(substr($coll_elt[1], 0, -(strlen($coll_pays) + 2)));
                $data .= "<f c='711' ind='0 '>\n";
                $data .= "\t<s c='a'>" . htmlspecialchars($coll_nom, ENT_QUOTES, $charset) . "</s>\n";
                $data .= "\t<s c='e'>" . htmlspecialchars($coll_lieu, ENT_QUOTES, $charset) . "</s>\n";
                $data .= "\t<s c='m'>" . htmlspecialchars($coll_pays, ENT_QUOTES, $charset) . "</s>\n";
                $data .= "</f>\n";
            }
        }
    }
    if ($autres_auteurs) {
        $others = explode("###", $autres_auteurs);
        for ($i = 0; $i < count($others); $i++) {
            $aut = explode(", ", $others[$i]);
            $data .= "<f c='701' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($aut[0], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='b'>" . htmlspecialchars($aut[1], ENT_QUOTES, $charset) . "</s>\n";
            if ($aut[2]) {
                $data .= "\t<s c='c'>" . htmlspecialchars($aut[2], ENT_QUOTES, $charset) . "</s>\n";
            }
            $data .= "</f>\n";
        }
    }
    if ($auteur_secondaire) {
        $secs = explode("###", $auteur_secondaire);
        for ($i = 0; $i < count($secs); $i++) {
            $aut = explode(", ", $secs);
            $data .= "<f c='702' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($aut[0], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='b'>" . htmlspecialchars($aut[1], ENT_QUOTES, $charset) . "</s>\n";
            if ($aut[2]) {
                $data .= "\t<s c='c'>" . htmlspecialchars($aut[2], ENT_QUOTES, $charset) . "</s>\n";
            }
            $data .= "</f>\n";
        }
    }
    if ($url) {
        $data .= "<f c='856' ind='  '>\n";
        $data .= "\t<s c='u'>" . htmlspecialchars($url, ENT_QUOTES, $charset) . "</s>";
        $data .= "</f>\n";
    }
    if ($subtype) {
        $data .= "<f c='900' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($subtype, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "\t<s c='l'>Sub-Type</s>\n";
        $data .= "\t<s c='n'>subtype</s>\n";
        $data .= "</f>\n";
    }
    if ($doi) {
        $doi = trim(str_replace("doi:", "", $doi));
        if ($doi) {
            $data .= "<f c='900' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($doi, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='l'>DOI id</s>\n";
            $data .= "\t<s c='n'>pmi_doi_identifier</s>\n";
            $data .= "</f>\n";
        }
    }
    if ($pubmedid) {
        $pubmedid = trim(str_replace("PubMed ID:", "", $pubmedid));
        if ($pubmedid) {
            $data .= "<f c='900' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($pubmedid, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='l'>Numéro PUBMED</s>\n";
            $data .= "\t<s c='n'>pmi_xref_dbase_id</s>\n";
            $data .= "</f>\n";
        }
    }
    $data .= "</notice>\n";
    if (!$error) {
        $r['VALID'] = true;
    } else {
        $r['VALID'] = false;
    }
    $r['ERROR'] = $error;
    $r['DATA'] = $data;
    return $r;
}
Пример #7
0
 function print_resume($level = 2, $css)
 {
     global $fonction_auteur;
     global $base_path;
     // récupération localisation
     require_once $base_path . "/includes/localisation.inc.php";
     global $msg;
     global $css;
     global $opac_show_book_pics;
     global $charset;
     if (!$this->id) {
         return;
     }
     // adaptation par rapport au niveau de détail souhaité
     // niveau par défaut : 2
     // niveau 3 : format public
     switch ($level) {
         case 1:
             global $notice_level1_display;
             global $notice_level1_no_coll_info;
             global $notice_level1_no_author_info;
             global $notice_level1_no_authors_info;
             global $notice_level1_no_publisher_info;
             $notice_display = $notice_level1_display;
             $notice_no_coll_information = $notice_level1_no_coll_info;
             $notice_no_author_information = $notice_level1_no_author_info;
             $notice_no_authors_information = $notice_level1_no_authors_info;
             $notice_no_publisher_information = $notice_level1_no_publisher_info;
             // utilise les bons champs IMPORTANT
             $this->check_fields(N_VALID_TYPDOC | N_VALID_AUTHORS | N_VALID_PARENT_TITLE);
             break;
         case 3:
             // Format Public
             global $notice_level3_display;
             global $notice_level3_no_coll_info;
             global $notice_level3_no_author_info;
             global $notice_level3_no_authors_info;
             global $notice_level3_no_publisher_info;
             $notice_display = $notice_level3_display;
             $notice_no_coll_information = $notice_level3_no_coll_info;
             $notice_no_author_information = $notice_level3_no_author_info;
             $notice_no_authors_information = $notice_level3_no_authors_info;
             $notice_no_publisher_information = $notice_level3_no_publisher_info;
             // utilise les bons champs IMPORTANT
             $this->check_fields(N_VALID_TYPDOC | N_VALID_AUTHORS | N_VALID_PUBLISHERS | N_VALID_COLLECTION | N_VALID_PARENT_TITLE);
             break;
         case 2:
         default:
             global $notice_level2_display;
             global $notice_level2_no_coll_info;
             global $notice_level2_no_author_info;
             global $notice_level2_no_authors_info;
             global $notice_level2_no_publisher_info;
             $notice_display = $notice_level2_display;
             $notice_no_coll_information = $notice_level2_no_coll_info;
             $notice_no_author_information = $notice_level2_no_author_info;
             $notice_no_authors_information = $notice_level2_no_authors_info;
             $notice_no_publisher_information = $notice_level2_no_publisher_info;
             // utilise les bons champs IMPORTANT
             $this->check_fields(N_VALID_TYPDOC | N_VALID_AUTHORS | N_VALID_PUBLISHERS | N_VALID_COLLECTION);
             break;
     }
     $print = $notice_display;
     // remplacement des champs statiques
     // $print = str_replace("!!notice_id!!", $this->id, $print);
     if ($this->id != "") {
         $print = str_replace("!!notice_id!!", "<font size=1>{$msg['notice_id_start']} " . $this->id . " {$msg['notice_id_end']}</font>" . "<br />", $print);
         $print = str_replace("!!notice_id_only!!", $this->id, $print);
     } else {
         $print = str_replace("!!notice_id!!", "", $print);
         $print = str_replace("!!notice_id_only!!", "", $print);
     }
     if ($this->niveau_hierar != "2") {
         $print = str_replace("!!niveau_hierar!!", "<b>" . $msg["hierarchical_level"] . "</b> " . $this->niveau_hierar . "<br />", $print);
     } else {
         $print = str_replace("!!niveau_hierar!!", "", $print);
     }
     if ($this->typdoc != "") {
         if ($this->niveau_hierar != "2") {
             // ce n'est pas un article
             $print = str_replace("!!typdoc!!", $this->typdoc . " " . $msg["article"], $print);
             $print = str_replace("!!typdocpic!!", "<img src=./images/icon_" . $this->typdoc . ".gif> " . $this->niveau_hierar, $print);
         } else {
             // c'est un article
             $print = str_replace("!!typdoc!!", $this->typdoc, $print);
             $print = str_replace("!!typdocpic!!", "<img src=./images/icon_" . $this->typdoc . ".gif>" . $this->niveau_hierar, $print);
         }
     } else {
         $print = str_replace("!!typdoc!!", "", $print);
         $print = str_replace("!!typdocpic!!", "", $print);
     }
     if ($this->tit1 != "") {
         switch ($this->niveau_biblio) {
             case "s":
                 $tit1_ico = "<a href='#' onClick='window.open(\"./includes/messages/fr_FR/icons.html\", \"icones__PMB\", \"scrollbars=yes, toolbar=no, dependent=yes, width=400, height=400, resizable=yes\"); return false' title='" . $msg["serial"] . "'><img src='./images/icon_per.gif' border='0' alt='" . $msg["serial"] . "' align='absmiddle'/>\n\t\t\t\t<img src='./images/icon_" . $this->typdoc . ".gif' border='0' align='absmiddle'/></a>";
                 break;
             case "a":
                 $tit1_ico = "<a href='#' onClick='window.open(\"./includes/messages/fr_FR/icons.html\", \"icones__PMB\", \"scrollbars=yes, toolbar=no, dependent=yes, width=400, height=400, resizable=yes\"); return false' title='" . $msg["article"] . "'><img src='./images/icon_art.gif' border='0' alt='" . $msg["article"] . "' align='absmiddle'/>\n\t\t\t\t<img src='./images/icon_" . $this->typdoc . ".gif' border='0' align='absmiddle'/></a>";
                 break;
             case "m":
             default:
                 $tit1_ico = "<a href='#' onClick='window.open(\"./includes/messages/fr_FR/icons.html\", \"icones__PMB\", \"scrollbars=yes, toolbar=no, dependent=yes, width=400, height=400, resizable=yes\"); return false' title='" . $this->typdocdisplay . "'><img src='./images/icon_" . $this->typdoc . ".gif' border='0' align='absmiddle'/></a>";
                 break;
         }
         $print = str_replace("!!tit1!!", $this->tit1, $print);
         $print = str_replace("!!tit1_ico!!", $tit1_ico, $print);
         $print = str_replace("!!tit1display!!", "<b>{$msg['tit1display_start']}</b>" . $this->tit1 . "{$msg['tit1display_end']}<br />", $print);
     } else {
         $print = str_replace("!!tit1!!", "", $print);
     }
     if ($this->tit2 != "") {
         $print = str_replace("!!tit2!!", "<b>{$msg['tit2_start']}</b>" . $this->tit2 . "<br />", $print);
     } else {
         $print = str_replace("!!tit2!!", "", $print);
     }
     if ($this->tit3 != "") {
         $print = str_replace("!!tit3!!", "<b>{$msg['tit3_start']}</b>" . $this->tit3 . "<br />", $print);
     } else {
         $print = str_replace("!!tit3!!", "", $print);
     }
     if ($this->tit4 != "") {
         $print = str_replace("!!tit4!!", "<b>{$msg['tit4_start']}</b>" . $this->tit4 . "<br />", $print);
     } else {
         $print = str_replace("!!tit4!!", "", $print);
     }
     if ($this->typdocdisplay != "") {
         $print = str_replace("!!typdocdisplay!!", "<b>{$msg['typdocdisplay_start']}</b> " . $this->typdocdisplay . "<br />", $print);
     } else {
         $print = str_replace("!!typdocdisplay!!", $this->typdoc, $print);
     }
     if ($this->tparent != "") {
         if ($this->tnvol) {
             $tparent_libelle = "<b>{$msg['tparent_start']}</b>" . $this->tparent . " [" . $this->tnvol . "]<br />";
         } else {
             $tparent_libelle = "<b>{$msg['tparent_start']}</b>" . $this->tparent . "<br />";
         }
         $print = str_replace("!!tparent!!", $tparent_libelle, $print);
     } else {
         $print = str_replace("!!tparent!!", "", $print);
     }
     if ($this->tnvol != "") {
         $print = str_replace("!!tnvol!!", "<b>{$msg['tnvol_start']}</b>" . $this->tnvol . "<br />", $print);
     } else {
         $print = str_replace("!!tnvol!!", "", $print);
     }
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
         if ($auteur_0["fonction"]) {
             $f_auteur = " (" . $fonction_auteur[$auteur_0["fonction"]] . ")";
         } else {
             $f_auteur = "";
         }
         $mention_resp_lib = "<b>" . $msg[auteur_start] . "</b> " . "<a href='index.php?lvl=author_see&id=" . $auteur_0["id"] . "' title='" . $auteur->info_bulle . "'>{$auteur->isbd_entry}</a> " . $f_auteur . "<br />";
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($auteur_1["fonction"]) {
             $f_auteur = " (" . $fonction_auteur[$auteur_1["fonction"]] . ")";
         } else {
             $f_auteur = "";
         }
         $mention_resp_lib = "<b>" . $msg[auteur_start] . "</b> " . "<a href='index.php?lvl=author_see&id=" . $auteur_1["id"] . "' title='" . $auteur->info_bulle . "'>{$auteur->isbd_entry}</a> " . $f_auteur . "<br />";
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($auteur_2["fonction"]) {
             $f_auteur = " (" . $fonction_auteur[$auteur_2["fonction"]] . ")";
         } else {
             $f_auteur = "";
         }
         $mention_resp_lib = "<b>" . $msg[auteur_start] . "</b> " . "<a href='index.php?lvl=author_see&id=" . $auteur_2["id"] . "' title='" . $auteur->info_bulle . "'>{$auteur->isbd_entry}</a> " . $f_auteur . "<br />";
         $mention_resp[] = $mention_resp_lib;
     }
     if (!$mention_resp) {
         $mention_resp = array();
     }
     $libelle_mention_resp = implode(" ", $mention_resp);
     // **********************************************
     if ($this->ed1 != "") {
         $print = str_replace("!!ed1!!", "<b>{$msg['ed1_start']}</b>" . $this->ed1 . "<br />", $print);
     } else {
         $print = str_replace("!!ed1!!", "", $print);
     }
     if ($this->ed2 != "") {
         $print = str_replace("!!ed2!!", "<b>{$msg['ed2_start']}</b>" . $this->ed2 . "<br />", $print);
     } else {
         $print = str_replace("!!ed2!!", "", $print);
     }
     if ($this->coll != "") {
         $print = str_replace("!!coll!!", "<b>{$msg['coll_start']}</b>" . $this->coll . "<br />", $print);
     } else {
         $print = str_replace("!!coll!!", "", $print);
     }
     if ($this->subcoll != "") {
         $print = str_replace("!!subcoll!!", "<b>{$msg['subcoll_start']}</b>" . $this->subcoll . "<br />", $print);
     } else {
         $print = str_replace("!!subcoll!!", "", $print);
     }
     if ($this->year != "") {
         $print = str_replace("!!year!!", "<b>{$msg['year_start']}</b>" . $this->year . "<br />", $print);
     } else {
         $print = str_replace("!!year!!", "", $print);
     }
     if ($this->nocoll != "") {
         $print = str_replace("!!nocoll!!", "<b>{$msg['nocoll_start']}</b>" . $this->nocoll . "<br />", $print);
     } else {
         $print = str_replace("!!nocoll!!", "", $print);
     }
     if ($this->code != "") {
         // Si c'est un livre, c'est magique alors on affiche l'image tirée de chez amazon europe.
         if ($this->typdoc == 'a' && $opac_show_book_pics == '1') {
             $code_chiffre = pmb_preg_replace('/-|\\.| /', '', $this->code);
             //if (@fopen("http://images-eu.amazon.com/images/P/".$code_chiffre.".08.MZZZZZZZ.jpg","r"))
             if (isISBN($this->code)) {
                 $print = str_replace("!!image_petit!!", "<img src='http://images-eu.amazon.com/images/P/" . $code_chiffre . ".08.MZZZZZZZ.jpg' align='right' hspace='4' vspace='2'>", $print);
             } else {
                 $print = str_replace("!!image_petit!!", "", $print);
             }
         } else {
             $print = str_replace("!!image_petit!!", "", $print);
         }
         $print = str_replace("!!code!!", "<b>{$msg['code_start']}</b>" . $this->code . "<br />", $print);
     } else {
         $print = str_replace("!!image_petit!!", "", $print);
         $print = str_replace("!!code!!", "", $print);
     }
     if ($this->npages != "") {
         $print = str_replace("!!npages!!", "<b>{$msg['npages_start']}</b>" . $this->npages . "<br />", $print);
     } else {
         $print = str_replace("!!npages!!", "", $print);
     }
     if ($this->ill != "") {
         $print = str_replace("!!ill!!", "<b>{$msg['ill_start']}</b>" . $this->ill . "<br />", $print);
     } else {
         $print = str_replace("!!ill!!", "", $print);
     }
     if ($this->size != "") {
         $print = str_replace("!!size!!", "<b>{$msg['size_start']}</b>" . $this->size . "<br />", $print);
     } else {
         $print = str_replace("!!size!!", "", $print);
     }
     if ($this->accomp != "") {
         $print = str_replace("!!accomp!!", "<b>{$msg['accomp_start']}</b>" . $this->accomp . "<br />", $print);
     } else {
         $print = str_replace("!!accomp!!", "", $print);
     }
     if ($this->n_gen != "") {
         $print = str_replace("!!n_gen!!", "<b>{$msg['n_gen_start']}</b>" . nl2br(htmlentities($this->n_gen, ENT_QUOTES, $charset)) . "<br />", $print);
     } else {
         $print = str_replace("!!n_gen!!", "", $print);
     }
     if ($this->n_contenu != "") {
         $print = str_replace("!!n_contenu!!", "<b>{$msg['n_contenu_start']}</b>" . nl2br(htmlentities($this->n_contenu, ENT_QUOTES, $charset)) . "<br />", $print);
     } else {
         $print = str_replace("!!n_contenu!!", "", $print);
     }
     if ($this->n_resume != "") {
         $print = str_replace("!!n_resume!!", "<b>{$msg['n_resume_start']}</b>" . nl2br(htmlentities($this->n_resume, ENT_QUOTES, $charset)) . "<br />", $print);
     } else {
         $print = str_replace("!!n_resume!!", "", $print);
     }
     if ($this->index_l != "") {
         $print = str_replace("!!index_l!!", "<b>{$msg['index_l_start']}</b>" . nl2br($this->index_l) . "<br />", $print);
     } else {
         $print = str_replace("!!index_l!!", "", $print);
     }
     if ($this->lang != "") {
         $print = str_replace("!!lang!!", $this->lang . "<br />", $print);
     } else {
         $print = str_replace("!!lang!!", "", $print);
     }
     if ($this->org_lang != "") {
         $print = str_replace("!!org_lang!!", $this->org_lang . "<br />", $print);
     } else {
         $print = str_replace("!!org_lang!!", "", $print);
     }
     if ($this->lien != "") {
         $print = str_replace("!!lien!!", "<br /><a href=\"" . $this->lien . "\" title=" . $this->lien . " alt=" . $this->lien . "><img src=./images/docweb.gif border=0> {$this->lien}</a>", $print);
     } else {
         $print = str_replace("!!lien!!", "", $print);
     }
     if ($this->eformat != "") {
         $print = str_replace("!!eformat!!", "[" . $this->eformat . "]<br />" . "<br />", $print);
     } else {
         $print = str_replace("!!eformat!!", "", $print);
     }
     if ($this->prix != "") {
         $print = str_replace("!!prix!!", "<b>{$msg['price_start']}</b> " . $this->prix . " <b>{$msg['price_end']}</b> ", $print);
     } else {
         $print = str_replace("!!prix!!", "", $print);
     }
     // remplacement des champs dynamiques
     if (preg_match("#!!auteur!!#", $print)) {
     }
     if ($libelle_mention_resp) {
         $print = str_replace("!!auteur!!", $libelle_mention_resp, $print);
     } else {
         $print = str_replace("!!auteur!!", $notice_no_authors_information, $print);
     }
     if (preg_match("#!!editeur!!#", $print)) {
         $remplacement = "";
         if ($this->ed1_id) {
             $remplacement = "<b>{$msg['editeur_start']}</b> " . "<a href='index.php?lvl=publisher_see&id={$this->ed1_id}'>{$this->ed1}</a>" . "<br />";
         } elseif ($this->ed2_id) {
             $remplacement = "<b>{$msg['editeur_start']}</b> " . "<a href='index.php?lvl=publisher_see&id={$this->ed2_id}'>{$this->ed2}</a>" . "<br />";
         } else {
             $remplacement = "";
         }
         $print = str_replace("!!editeur!!", $remplacement, $print);
     }
     if (preg_match("#!!collection!!#", $print)) {
         $remplacement = "";
         if ($this->coll_id) {
             $remplacement = "<b>{$msg['coll_start']}</b> <a href='index.php?lvl=coll_see&id={$this->coll_id}'>{$this->coll}</a>";
         }
         if ($this->subcoll_id) {
             $remplacement .= $remplacement ? ", " : "";
             $remplacement .= "(<a href='index.php?lvl=subcoll_see&id={$this->subcoll_id}'>{$this->subcoll}</a>)<br />";
         } else {
             $remplacement .= "<br />";
         }
         if ($remplacement == "") {
             $remplacement = "";
         }
         $print = str_replace("!!collection!!", $remplacement, $print);
     }
     if (preg_match("#!!level1!!#", $print)) {
         if ($this->tparent) {
             if ($this->tnvol) {
                 $titre_affiche = $this->tit1 . " - " . $this->tparent . " [" . $this->tnvol . "]";
             } else {
                 $titre_affiche = $this->tit1 . " - " . $this->tparent;
             }
         } else {
             $titre_affiche = $this->tit1;
         }
         if ($this->tit1) {
             $titre = "<a href='index.php?lvl=notice_display&id=" . $this->id . "'>{$titre_affiche}</a>";
         } elseif ($this->tit2) {
             $titre = "<a href='index.php?lvl=notice_display&id=" . $this->id . "'>{$this->tit2}</a>";
         } elseif ($this->tit3) {
             $titre = "<a href='index.php?lvl=notice_display&id=" . $this->id . "'>{$this->tit3}</a>";
         } elseif ($this->tit4) {
             $titre = "<a href='index.php?lvl=notice_display&id=" . $this->id . "'>{$this->tit4}</a>";
         } else {
             $titre = "";
         }
         // ***
         //$this->responsabilites
         $as = array_search("0", $this->responsabilites["responsabilites"]);
         if ($as !== FALSE && $as !== NULL) {
             $auteur_0 = $this->responsabilites["auteurs"][$as];
             $auteur = new auteur($auteur_0["id"]);
             $auteur = $auteur->isbd_entry;
         } else {
             $as = array_keys($this->responsabilites["responsabilites"], "1");
             for ($i = 0; $i < count($as); $i++) {
                 $indice = $as[$i];
                 $auteur_1 = $this->responsabilites["auteurs"][$indice];
                 $auteur = new auteur($auteur_1["id"]);
                 $aut1_libelle[] = $auteur->isbd_entry;
             }
             if (!$aut1_libelle) {
                 $aut1_libelle = array();
             }
             $auteur = implode(", ", $aut1_libelle);
         }
         // ***
         $remplacement = $titre;
         if ($remplacement != "" && $auteur != "") {
             $remplacement .= " / " . $auteur;
         }
         $print = str_replace("!!level1!!", $remplacement, $print);
     }
     return $print;
 }
Пример #8
0
 function process_isbn($isbn)
 {
     /* We've got everything, let's have a look if ISBN already exists in notices table */
     $isbn_nettoye = preg_replace('/-|\\.| |\\(|\\)|\\[|\\]|\\:|\\;|[A-WY-Z]/i', '', $isbn);
     $isbn_nettoye_13 = substr($isbn_nettoye, 0, 13);
     $isbn_nettoye_10 = substr($isbn_nettoye, 0, 10);
     $isbn_OK = "";
     if (isEAN($isbn_nettoye_13)) {
         /* it's an EAN -> convert it to ISBN */
         $isbn_OK = EANtoISBN($isbn_nettoye_13);
     }
     if (!$isbn_OK) {
         if (isISBN($isbn_nettoye_10)) {
             $isbn_OK = formatISBN($isbn_nettoye_10);
         }
     }
     if (!$isbn_OK) {
         $isbn_OK = clean_string($isbn);
     }
     return $isbn_OK;
 }
Пример #9
0
    die("no access");
}
// les requis par display.inc.php
include "{$include_path}/marc_tables/{$pmb_indexation_lang}/empty_words";
include "{$class_path}/iso2709.class.php";
$rqsql = "select * from z_notices, z_bib where znotices_query_id ='{$last_query_id}' and bib_id=znotices_bib_id order by {$tri1}, {$tri2}";
$resultat3 = mysql_query($rqsql);
$test_resultat = 0;
$retour_affichage = "";
$i = 0;
while ($ligne3 = mysql_fetch_array($resultat3)) {
    $znotices_id = $ligne3["znotices_id"];
    $resultat_titre = $ligne3["titre"];
    $resultat_auteur = $ligne3["auteur"];
    $resultat_isbd = $ligne3["isbd"];
    if (isISBN($ligne3["isbn"])) {
        $resultat_isbn = formatISBN($ligne3["isbn"]);
    } else {
        $resultat_isbn = $ligne3["isbn"];
    }
    $resultat_bib_name = $ligne3["bib_nom"];
    $resultat_bib_format = $ligne3["format"];
    $test_resultat++;
    $lien = "<a ";
    if ($i == 0) {
        $lien .= " id='premierresultat' ";
    }
    $i++;
    $lien .= " href='./catalog.php?categ=z3950&action=import&id_notice={$id_notice}&znotices_id=" . $znotices_id . "&last_query_id=" . $last_query_id . "&tri1=" . $tri1 . "&tri2=" . $tri2 . "' >" . $resultat_titre . " / " . $resultat_auteur . "</a>";
    $retour_affichage .= zshow_isbd($resultat_isbd, $lien);
    $retour_affichage .= "<small><strong>( {$resultat_bib_name} / {$resultat_bib_format} )<br /></strong></small><br />";
 function do_isbd($short = 0, $ex = 1)
 {
     global $dbh;
     global $msg;
     global $tdoc;
     global $charset;
     global $opac_notice_affichage_class;
     $this->notice_isbd = "";
     if ($this->notice_expired) {
         return $this->notice_isbd;
     }
     // constitution de la mention de titre
     if ($this->notice->serie_name) {
         $serie_temp .= inslink($this->notice->serie_name, str_replace("!!id!!", "es" . $this->notice->tparent_id, $this->lien_rech_serie));
         if ($this->notice->tnvol) {
             $serie_temp .= ',&nbsp;' . $this->notice->tnvol;
         }
     }
     if ($serie_temp) {
         $this->notice_isbd .= $serie_temp . ".&nbsp;" . $this->notice->tit1;
     } else {
         $this->notice_isbd .= $this->notice->tit1;
     }
     $this->notice_isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']';
     if ($this->notice->tit3) {
         $this->notice_isbd .= "&nbsp;= " . $this->notice->tit3;
     }
     if ($this->notice->tit4) {
         $this->notice_isbd .= "&nbsp;: " . $this->notice->tit4;
     }
     if ($this->notice->tit2) {
         $this->notice_isbd .= "&nbsp;; " . $this->notice->tit2;
     }
     if ($this->auteurs_tous) {
         $this->notice_isbd .= " / " . $this->auteurs_tous;
     }
     // mention d'edition
     if ($this->notice->mention_edition) {
         $this->notice_isbd .= " &nbsp;. -&nbsp; " . $this->notice->mention_edition;
     }
     if ($this->notice->coll) {
         $collections = $this->notice->coll->titre . ($this->notice->coll->num ? ", " . $this->notice->coll->num : "");
     }
     if (is_array($this->publishers)) {
         for ($i = 0; $i < count($this->publishers); $i++) {
             $editeur[$i] = $this->publishers[$i]["name"] . ($this->publishers[$i]["city"] ? " (" . $this->publishers[$i]["city"] . ")" : "");
         }
         $editeurs = implode("&nbsp;: ", $editeur);
     }
     if ($this->notice->year) {
         $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year);
     } else {
         if ($this->notice->niveau_biblio == 'm' && $this->notice->niveau_hierar == 0) {
             $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]");
         }
     }
     if ($editeurs) {
         $this->notice_isbd .= "&nbsp;.&nbsp;-&nbsp;{$editeurs}";
     }
     // zone de la collation
     if ($this->notice->npages) {
         $collation = $this->notice->npages;
     }
     if ($this->notice->ill) {
         $collation .= '&nbsp;: ' . $this->notice->ill;
     }
     if ($this->notice->size) {
         $collation .= '&nbsp;; ' . $this->notice->size;
     }
     if ($this->notice->accomp) {
         $collation .= '&nbsp;+ ' . $this->notice->accomp;
     }
     if ($collation) {
         $this->notice_isbd .= "&nbsp;.&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         $this->notice_isbd .= ".&nbsp;-&nbsp;({$collections})" . ' ';
     }
     $this->notice_isbd .= '.';
     // ISBN ou NO. commercial
     if ($this->notice->code) {
         if (isISBN($this->notice->code)) {
             $zoneISBN = '<b>ISBN</b>&nbsp;: ';
         } else {
             $zoneISBN .= '<b>' . $msg["issn"] . '</b>&nbsp;: ';
         }
         $zoneISBN .= $this->notice->code;
     }
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneISBN .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneISBN) {
                 $zoneISBN .= '&nbsp; ' . $this->notice->prix;
             } else {
                 $zoneISBN = $this->notice->prix;
             }
         }
     }
     if ($zoneISBN) {
         $this->notice_isbd .= "<br />" . $zoneISBN;
     }
     // note generale
     if ($this->notice->n_gen) {
         $zoneNote = nl2br(htmlentities(implode("\n", $this->notice->n_gen), ENT_QUOTES, $charset));
     }
     if ($zoneNote) {
         $this->notice_isbd .= "<br />" . $zoneNote;
     }
     // langues
     if (count($this->langues)) {
         $langues = "<span class='etiq_champ'>{$msg[537]}</span>&nbsp;: " . $this->construit_liste_langues($this->langues);
     }
     if (count($this->languesorg)) {
         $langues .= " <span class='etiq_champ'>{$msg[711]}</span>&nbsp;: " . $this->construit_liste_langues($this->languesorg);
     }
     if ($langues) {
         $this->notice_isbd .= "<br />" . $langues;
     }
     if (count($this->notice->notice_pperso)) {
         foreach ($this->notice->notice_pperso as $pperso) {
             // est-ce bien de type pmb
             if ($pperso['value'] && $pperso['libelle'] && $pperso['name']) {
                 switch ($pperso['type']) {
                     case 'url':
                         $html_pprerso .= "<span class='etiq_champ'>" . $pperso['libelle'] . "</span>&nbsp;: <a href='" . $pperso['value'] . "' >" . $pperso['value'] . "</a>";
                         break;
                     default:
                         $html_pprerso .= "<span class='etiq_champ'>" . $pperso['libelle'] . "</span>&nbsp;: " . $pperso['value'];
                         break;
                 }
             }
         }
     }
     if ($html_pprerso) {
         $this->notice_isbd .= "<br />" . $html_pprerso;
     }
     if (!$short) {
         $this->notice_isbd .= "<table>";
         $this->notice_isbd .= $this->aff_suite();
         $this->notice_isbd .= "</table>";
     } else {
         $this->notice_isbd .= $this->genere_in_perio();
     }
 }
Пример #11
0
function convert_medline($notice, $s, $islast, $isfirst, $param_path)
{
    global $cols;
    global $ty;
    global $intitules;
    global $base_path, $origine;
    global $tab_functions;
    global $lot;
    global $charset;
    if (!$tab_functions) {
        $tab_functions = new marc_list('function');
    }
    $fields = explode("\n", $notice);
    $error = "";
    if ($fields) {
        $data = "<notice>\n";
    }
    $lignes = organize_line($fields);
    foreach ($lignes as $champ => $value) {
        switch ($champ) {
            case 'TI':
                //Titre principal
                $titre = $value;
                break;
            case 'PL':
                //Editeur
                $editeur = $value;
                break;
            case 'AU':
                //Auteur principal
                $auteur = explode(", ", $value);
                break;
            case 'IS':
                //ISBN/ISSN
                $code = $value;
                $pos = strpos($code, "(");
                $endcode = substr($code, $pos);
                $code = trim(substr($code, 0, $pos));
                if (isISBN($code)) {
                    $infos_isbn = $code . " " . $endcode;
                } elseif (isISSN($code)) {
                    $infos_issn = $code . " " . $endcode;
                } else {
                    $error = "wrong ISBN/ISSN \n";
                }
                break;
            case 'DP':
                //Date de publication
                $date = $value;
                if ($date) {
                    $date_elt = explode(' ', $date);
                    if ($date_elt[0]) {
                        $year = $date_elt[0];
                    }
                    if ($date_elt[2]) {
                        $day = $date_elt[2];
                    }
                    if ($date_elt[1]) {
                        $mois = $date_elt[1];
                        switch ($mois) {
                            case 'Jan':
                                $month = "01";
                                break;
                            case 'Feb':
                                $month = "02";
                                break;
                            case 'Mar':
                                $month = "03";
                                break;
                            case 'Apr':
                                $month = "04";
                                break;
                            case 'May':
                                $month = "05";
                                break;
                            case 'Jun':
                                $month = "06";
                                break;
                            case 'Jul':
                                $month = "07";
                                break;
                            case 'Aug':
                                $month = "08";
                                break;
                            case 'Sep':
                                $month = "09";
                                break;
                            case 'Oct':
                                $month = "10";
                                break;
                            case 'Nov':
                                $month = "11";
                                break;
                            case 'Dec':
                                $month = "12";
                                break;
                        }
                    }
                    if ($year && $month && $day) {
                        $date_sql = $year . "-" . $month . "-" . $day;
                    } else {
                        if ($year && $month) {
                            $date_sql = $year . "-" . $month . "-01";
                        } else {
                            if ($year) {
                                $date_sql = $year . "-01-01";
                            }
                        }
                    }
                }
                break;
            case 'IP':
                //Numéro de bulletin
                $bull_num = $value;
                break;
            case 'VI':
                //Volume
                $bull_vol = $value;
                break;
            case 'AB':
                //Résumé
                $resume = $value;
                break;
            case 'JT':
                //Titre du pério
                $perio_title = $value;
                break;
            case 'LA':
                //Langue
                $langue = $value;
                break;
            case 'TT':
                //Titre parallele
                $titre_parallele = $value;
                break;
            case 'PG':
                //Pagination
                $pagination = $value;
                break;
            case 'PMID':
                //Pubmed ID
                $pubmed_id = $value;
                break;
            case 'PT':
                //Document Type
                $doc_type = $value;
                break;
            case 'AID':
                //DOI
                $ids = explode(",", $value);
                if (is_array($ids)) {
                    for ($i = 0; $i < count($ids); $i++) {
                        if (strpos($ids[$i], "[doi]") !== false) {
                            $doi = trim(substr($ids[$i], 0, strpos($ids[$i], "[doi]")));
                        }
                    }
                }
                break;
            case 'AD':
                $collectivite = $value;
                break;
            default:
                $data .= '';
                break;
        }
    }
    //Construction du fichier
    $data .= "<rs>n</rs>\n\t\t  <dt>a</dt>\n\t\t  <bl>a</bl>\n\t\t  <hl>2</hl>\n\t\t  <el>1</el>\n\t\t  <ru>i</ru>\n";
    if ($pubmed_id) {
        $data .= "<f c='001' ind='  '>\n";
        $data .= htmlspecialchars($pubmed_id, ENT_QUOTES, $charset);
        $data .= "</f>\n";
    }
    if ($infos_isbn || $pubmed_id) {
        $data .= " <f c='010' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($pubmed_id ? $pubmed_id : $infos_isbn, ENT_QUOTES, $charset) . "</s>";
        $data .= "</f>\n";
    }
    if ($langue) {
        $data .= "<f c='101' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($langue, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($titre) {
        $data .= "<f c='200' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($titre, ENT_QUOTES, $charset) . "</s>\n";
        if ($titre_parallele) {
            $data .= "\t<s c='d'>" . htmlspecialchars($titre_parallele, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "</f>\n";
    }
    if ($editeur) {
        $data .= "<f c='210' ind='  '>\n";
        if ($editeur) {
            $data .= "\t<s c='c'>" . htmlspecialchars($editeur, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "</f>\n";
    }
    if ($pagination) {
        $data .= "<f c='215' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($pagination, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($resume) {
        $data .= "<f c='330' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($resume, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($perio_title) {
        $data .= "<f c='461' ind='  '>\n";
        $data .= "\t<s c='t'>" . htmlspecialchars($perio_title, ENT_QUOTES, $charset) . "</s>\n";
        if ($infos_issn) {
            $data .= "\t<s c='x'>" . htmlspecialchars($infos_issn, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "\t<s c='9'>lnk:perio</s>\n";
        $data .= "</f>\n";
    }
    if ($bull_num || $bull_vol || $date || $date_sql) {
        $data .= "<f c='463' ind='  '>\n";
        if ($bull_num && $bull_vol) {
            $data .= "\t<s c='v'>" . "vol. " . htmlspecialchars($bull_vol, ENT_QUOTES, $charset) . ", no. " . htmlspecialchars($bull_num, ENT_QUOTES, $charset) . "</s>\n";
        } else {
            if ($bull_num && !$bull_vol) {
                $data .= "\t<s c='v'>no. " . htmlspecialchars($bull_num, ENT_QUOTES, $charset) . "</s>\n";
            } else {
                if (!$bull_num && $bull_vol) {
                    $data .= "\t<s c='v'>vol. " . htmlspecialchars($bull_vol, ENT_QUOTES, $charset) . "</s>\n";
                }
            }
        }
        if ($date) {
            $data .= "\t<s c='e'>" . htmlspecialchars($date, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($date_sql) {
            $data .= "\t<s c='d'>" . htmlspecialchars($date_sql, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "\t<s c='9'>lnk:bull</s>\n";
        $data .= "</f>\n";
    }
    if ($collectivite) {
        if ($auteur) {
            for ($i = 0; $i < count($auteur); $i++) {
                $data .= "<f c='701' ind='  '>\n";
                $data .= "\t<s c='a'>" . htmlspecialchars($auteur[$i], ENT_QUOTES, $charset) . "</s>\n";
                $data .= "</f>\n";
            }
        }
        $coll = explode(",", $collectivite, 2);
        $data .= "<f c='710' ind='0 '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($coll[0], ENT_QUOTES, $charset) . "</s>\n";
        $data .= "\t<s c='e'>" . htmlspecialchars($coll[1], ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    } else {
        if ($auteur) {
            $data .= "<f c='700' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($auteur[0], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "</f>\n";
            if ($auteur) {
                for ($i = 1; $i < count($auteur); $i++) {
                    $data .= "<f c='701' ind='  '>\n";
                    $data .= "\t<s c='a'>" . htmlspecialchars($auteur[$i], ENT_QUOTES, $charset) . "</s>\n";
                    $data .= "</f>\n";
                }
            }
        }
    }
    if ($doc_type) {
        switch ($doc_type) {
            case 'Abstracts':
            case 'Meeting Abstracts':
                $doctype = "Abstract";
                break;
            case 'Academic Dissertations':
                $doctype = "Thesis";
                break;
            case 'Annual Reports':
            case 'Technical Report':
                $doctype = "Report";
                break;
            case 'Book Reviews':
            case 'Review':
                $doctype = "Review";
                break;
            case 'Classical Article':
            case 'Corrected and Republished Article':
            case 'Journal Article':
            case 'Newspaper Article':
                $doctype = "Article";
                break;
            case 'Comment':
            case 'Published Erratum':
                $doctype = "Erratum";
                break;
            case 'Congresses':
                $doctype = "Conference Proceedings";
                break;
            case 'Database':
                $doctype = "Database";
                break;
            case 'Dictionary':
                $doctype = "Dictionary";
                break;
            case 'Directory':
                $doctype = "Directory";
                break;
            case 'Editorial':
                $doctype = "Editorial";
                break;
            case 'Encyclopedias':
                $doctype = "Encyclopedia";
                break;
            case 'Letter':
                $doctype = "Letter";
                break;
            case 'Unpublished Works':
                $doctype = "Preprint";
                break;
            default:
                $doctype = "Article";
                break;
        }
        if ($doctype) {
            $data .= "<f c='900' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($doctype, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='l'>Sub-Type</s>\n";
            $data .= "\t<s c='n'>subtype</s>\n";
            $data .= "</f>\n";
        }
    }
    if ($doi) {
        $data .= "<f c='900' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($doi, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "\t<s c='l'>DOI id</s>\n";
        $data .= "\t<s c='n'>pmi_doi_identifier</s>\n";
        $data .= "</f>\n";
    }
    if ($pubmed_id) {
        $data .= "<f c='856' ind='  '>\n";
        $data .= "\t<s c='u'>http://www.ncbi.nlm.nih.gov/pubmed/{$pubmed_id}</s>\n";
        $data .= "</f>\n";
        $data .= "<f c='900' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($pubmed_id, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "\t<s c='l'>Numéro PUBMED</s>\n";
        $data .= "\t<s c='n'>pmi_xref_dbase_id</s>\n";
        $data .= "</f>\n";
    }
    $data .= "</notice>\n";
    if (!$error) {
        $r['VALID'] = true;
    } else {
        $r['VALID'] = false;
    }
    $r['ERROR'] = $error;
    $r['DATA'] = $data;
    return $r;
}
Пример #12
0
     $format = $ligne_format["format"];
 }
 $resultat_titre = $ligne["titre"];
 $resultat_auteur = $ligne["auteur"];
 $resultat_isbd = $ligne["isbd"];
 $test_resultat++;
 $lien = $resultat_titre . " / " . $resultat_auteur;
 print pmb_bidi(zshow_isbd($resultat_isbd, $lien));
 if ($action != "integrerexpl") {
     if ($source == 'form') {
         $notice = new z3950_notice('form');
     } else {
         // avant affichage du formulaire : détecter si notice déjà présente pour proposer MAJ
         $isbn_verif = traite_code_isbn($ligne['isbn']);
         $suite_rqt = "";
         if (isISBN($isbn_verif)) {
             if (strlen($isbn_verif) == 13) {
                 $suite_rqt = " or code='" . formatISBN($isbn_verif, 13) . "' ";
             } else {
                 $suite_rqt = "or code='" . formatISBN($isbn_verif, 10) . "' ";
             }
         }
         if ($isbn_verif) {
             $requete = "SELECT notice_id FROM notices WHERE code='{$isbn_verif}' " . $suite_rqt;
             $myQuery = mysql_query($requete, $dbh);
             $temp_nb_notice = mysql_num_rows($myQuery);
             if ($temp_nb_notice) {
                 $not_id = mysql_result($myQuery, 0, 0);
             } else {
                 $not_id = 0;
             }
Пример #13
0
 $EAN = '';
 $isbn = '';
 $code = '';
 if (isEAN($ref)) {
     // la saisie est un EAN -> on tente de le formater en ISBN
     $EAN = $ref;
     $isbn = EANtoISBN($ref);
     // si échec, on prend l'EAN comme il vient
     if (!$isbn) {
         $code = str_replace("*", "%", $ref);
     } else {
         $code = $isbn;
         $code10 = formatISBN($code, 10);
     }
 } else {
     if (isISBN($ref)) {
         // si la saisie est un ISBN
         $isbn = formatISBN($ref);
         // si échec, ISBN erroné on le prend sous cette forme
         if (!$isbn) {
             $code = str_replace("*", "%", $ref);
         } else {
             $code10 = $isbn;
             $code = formatISBN($code10, 13);
         }
     } else {
         // ce n'est rien de tout ça, on prend la saisie telle quelle
         $code = str_replace("*", "%", $ref);
     }
 }
 if ($EAN && $isbn) {
Пример #14
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 do_isbd()
 {
     global $dbh;
     global $langue_doc;
     global $msg;
     global $tdoc;
     global $fonction_auteur;
     global $charset;
     global $thesaurus_mode_pmb, $thesaurus_categories_categ_in_line, $pmb_keyword_sep, $thesaurus_categories_affichage_ordre;
     global $pmb_show_notice_id, $pmb_opac_url, $pmb_show_permalink;
     // constitution de la mention de titre
     if ($this->tit_serie) {
         $this->isbd = $this->tit_serie;
         if ($this->notice->tnvol) {
             $this->isbd .= ',&nbsp;' . $this->notice->tnvol;
         }
     }
     $this->isbd ? $this->isbd .= '.&nbsp;' . $this->tit1 : ($this->isbd = $this->tit1);
     $this->isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']';
     $tit2 = $this->notice->tit2;
     $tit3 = $this->notice->tit3;
     $tit4 = $this->notice->tit4;
     if ($tit3) {
         $this->isbd .= "&nbsp;= {$tit3}";
     }
     if ($tit4) {
         $this->isbd .= "&nbsp;: {$tit4}";
     }
     if ($tit2) {
         $this->isbd .= "&nbsp;; {$tit2}";
     }
     $mention_resp = array();
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites["auteurs"][$as];
         $mention_resp_lib = $auteur_0["auteur_titre"];
         if ($auteur_0["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_0["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $mention_resp_lib = $auteur_1["auteur_titre"];
         if ($auteur_1["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_1["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $mention_resp_lib = $auteur_2["auteur_titre"];
         if ($auteur_2["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_2["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $libelle_mention_resp = implode("; ", $mention_resp);
     if ($libelle_mention_resp) {
         $this->isbd .= "&nbsp;/ {$libelle_mention_resp}";
     }
     // mention d'édition
     if ($this->notice->mention_edition) {
         $this->isbd .= ".&nbsp;-&nbsp;" . $this->notice->mention_edition;
     }
     // zone de l'adresse
     // on récupère la collection au passage, si besoin est
     if ($this->collections) {
         $collections = $this->collections[0]["name"];
     }
     $editeurs = array();
     for ($i = 0; $i < count($this->publishers); $i++) {
         $editeurs[] = $this->publishers[$i]["name"] . ($this->publishers[$i]["city"] ? " (" . $this->publishers[$i]["city"] . ")" : "");
     }
     $editeurs = implode("&nbsp;; ", $editeurs);
     if ($this->notice->year) {
         $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year);
     } else {
         $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]");
     }
     $this->isbd .= ".&nbsp;-&nbsp;{$editeurs}";
     // zone de la collation (ne concerne que a2)
     if ($this->notice->npages) {
         $collation = $this->notice->npages;
     }
     if ($this->notice->ill) {
         $collation .= ': ' . $this->notice->ill;
     }
     if ($this->notice->size) {
         $collation .= '; ' . $this->notice->size;
     }
     if ($this->notice->accomp) {
         $collation .= '+ ' . $this->notice->accomp;
     }
     if ($collation) {
         $this->isbd .= ".&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         if ($this->notice->nocoll) {
             $collections .= '; ' . $this->notice->nocoll;
         }
         $this->isbd .= ".&nbsp;-&nbsp;({$collections})" . ' ';
     }
     $this->isbd .= '.';
     // note générale
     if ($this->notice->n_gen) {
         $zoneNote = nl2br(htmlentities($this->notice->n_gen, ENT_QUOTES, $charset)) . ' ';
     }
     // ISBN ou NO. commercial
     if ($this->notice->code) {
         if (isISBN($this->notice->code)) {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;ISBN ';
             } else {
                 $zoneNote = 'ISBN ';
             }
         } else {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;';
             }
         }
         $zoneNote .= $this->notice->code;
     }
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneNote .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneNote) {
                 $zoneNote .= '&nbsp; ' . $this->notice->prix;
             } else {
                 $zoneNote = $this->notice->prix;
             }
         }
     }
     if ($zoneNote) {
         $this->isbd .= "<br /><br />{$zoneNote}.";
     }
     if ($pmb_show_notice_id || $pmb_show_permalink) {
         $this->isbd .= "<br />";
     }
     if ($pmb_show_notice_id) {
         $prefixe = explode(",", $pmb_show_notice_id);
         $this->isbd .= "<b>" . $msg['notice_id_libelle'] . "&nbsp;</b>" . ($prefixe[1] ? $prefixe[1] : '') . $this->notice_id . "<br />";
     }
     // Permalink OPAC
     if ($pmb_show_permalink) {
         $this->isbd .= "<b>" . $msg["notice_permalink_opac"] . "&nbsp;</b><a href='" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "' target=\"__LINK__\">" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "</a><br />";
     }
     // niveau 1
     if ($this->level == 1) {
         $this->isbd .= "<!-- !!bouton_modif!! -->";
         if ($this->expl) {
             $this->isbd .= "<br /><b>{$msg[285]}</b>";
             $this->isbd .= $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl);
             //if ($this->show_explnum) {
             //	$explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0,$this->link_explnum);
             //	if ($explnum_assoc) $this->isbd .= "<b>$msg[explnum_docs_associes]</b>".$explnum_assoc;
             //	}
         }
         $this->do_image($this->isbd);
         return;
     }
     // résumé
     if ($this->notice->n_resume) {
         // $this->isbd .= "<br /><b>${msg[267]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_resume,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[267]}</b>&nbsp;: " . nl2br($this->notice->n_resume);
     }
     // note de contenu
     if ($this->notice->n_contenu) {
         // $this->isbd .= "<br /><b>${msg[266]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_contenu,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[266]}</b>&nbsp;: " . nl2br($this->notice->n_contenu);
     }
     // catégories
     if ($this->categories_toutes) {
         $this->isbd .= "<br /><b>{$msg[23]}</b>&nbsp;: " . $this->categories_toutes;
     }
     // langues
     if (count($this->langues)) {
         $langues = "<b>{$msg[537]}</b>&nbsp;: " . construit_liste_langues($this->langues);
     }
     if (count($this->languesorg)) {
         $langues .= " <b>{$msg[711]}</b>&nbsp;: " . construit_liste_langues($this->languesorg);
     }
     if ($langues) {
         $this->isbd .= "<br />{$langues}";
     }
     // indexation libre
     if ($this->notice->index_l) {
         $this->isbd .= "<br /><b>{$msg[324]}</b>&nbsp;: " . $this->notice->index_l;
     }
     // indexation interne
     if ($this->notice->indexint_name) {
         $this->isbd .= "<br /><b>{$msg[indexint_catal_title]}</b>&nbsp;: " . $this->notice->indexint_name;
     }
     //lien vers la notice déjà existante dans le catalogue
     if ($this->permalink) {
         $this->isbd .= "<br /><b>" . $msg['catalog_link'] . "</b>&nbsp;: <a target='_blank' href='" . $this->permalink . "'>" . $this->permalink . "</a>";
     }
     if ($this->docnums) {
         $this->isbd .= "<br /><br />";
         $this->isbd .= "<b>" . $msg["entrepot_notice_docnum"] . "</b>";
         $nb_doc = 0;
         $display .= "<table>\n\t\t\t\t\t\t<tbody>";
         $i = 0;
         foreach ($this->docnums as $docnum) {
             if (!$docnum["a"]) {
                 continue;
             }
             $i++;
             $nb_doc++;
             if ($nb_doc == 1) {
                 $display .= "<tr>";
             }
             //$alt = htmlentities($docnum_tab[$i]['explnum_doc_nomfichier'],ENT_QUOTES,$charset).' - '.htmlentities($docnum_tab[$i]['explnum_doc_mimetype'],ENT_QUOTES,$charset);
             $display .= "<td class='docnum' style='width:25%;border:0px solid #CCCCCC;padding : 5px 5px'>\n\t\t\t\t\t<a target='_blank' alt='{$alt}' title='{$alt}' href=\"" . htmlentities($docnum["a"], ENT_QUOTES, $charset) . "\">\n\t\t\t\t\t\t<img src='./images/mimetype/unknown.gif' alt='{$alt}' title='{$alt}' >\n\t\t\t\t\t</a>\n\t\t\t\t\t<br />";
             if ($docnum["b"]) {
                 $display .= "<a href=\"" . htmlentities($docnum["a"], ENT_QUOTES, $charset) . "\">" . htmlentities($docnum["b"], ENT_QUOTES, $charset) . "</a>\t\t\t\t\t\n\t\t\t\t</td>";
             }
             if ($nb_doc == 4) {
                 $display .= "</tr>";
                 $nb_doc = 0;
             }
         }
         $display .= "</tbody></table>";
         $this->isbd .= $display;
     }
     $this->do_image($this->isbd);
     if ($this->expl) {
         $expl_aff = $this->show_expl_per_notice();
         if ($expl_aff) {
             $this->isbd .= "<br /><br /><b>{$msg[285]}</b>";
             $this->isbd .= $expl_aff;
         }
     }
     $this->isbd .= "<!-- !!bouton_modif!! -->";
     //if ($this->show_explnum) {
     //	$explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum);
     //	if ($explnum_assoc) $this->isbd .= "<b>$msg[explnum_docs_associes]</b>".$explnum_assoc;
     //}
     return;
 }
Пример #16
0
         if (!$isbn) {
             $code = str_replace("*", "%", $ex_query);
         } else {
             $code10 = $isbn;
             $code = formatISBN($code10, 13);
         }
     } else {
         // ce n'est rien de tout ça, on prend la saisie telle quelle
         $code = str_replace("*", "%", $ex_query);
     }
 }
 $isbn_OK = $code;
 $new_notice = 0;
 $notice_id = 0;
 // le paramétrage est-il : dédoublonnage sur code ? / Ne dédoublonner que sur code ISBN (ignorer les ISSN) ?
 if ($isbn_dedoublonnage && !$isbn_only || $isbn_dedoublonnage && $isbn_only && isISBN($isbn)) {
     $trouvees = 0;
     if ($EAN && $isbn) {
         // cas des EAN purs : constitution de la requête
         $requete = "SELECT distinct notice_id FROM notices ";
         $requete .= " WHERE notices.code in ('{$code}','{$EAN}'" . ($code10 ? ",'{$code10}'" : "") . ") limit 1";
         $myQuery = pmb_mysql_query($requete, $dbh);
         $trouvees = pmb_mysql_num_rows($myQuery);
     } elseif ($isbn) {
         // recherche d'un isbn
         $requete = "SELECT distinct notice_id FROM notices ";
         $requete .= " WHERE notices.code in ('{$code}'" . ($code10 ? ",'{$code10}'" : "") . ") limit 1";
         $myQuery = pmb_mysql_query($requete, $dbh);
         $trouvees = pmb_mysql_num_rows($myQuery);
     } elseif ($code) {
         // note : le code est recherché dans le champ code des notices
Пример #17
0
if (!$objet_appelant) {
    $objet_appelant = "f_cb";
}
// traitement de la soumission
if ($suite) {
    // un CB a été soumis
    if ($cb) {
        if (isEAN($cb)) {
            // la saisie est un EAN -> on tente de le formater en ISBN
            $code = EANtoISBN($cb);
            // si échec, on prend l'EAN comme il vient
            if (!$code) {
                $code = $cb;
            }
        } else {
            if (isISBN($cb)) {
                // si la saisie est un ISBN
                $code = formatISBN($cb, 13);
                // si échec, ISBN erroné on le prend sous cette forme
                if (!$code) {
                    $code = $cb;
                }
            } else {
                // ce n'est rien de tout ça, on prend la saisie telle quelle
                $code = $cb;
            }
        }
        $code_temp = $code;
    }
    if ($code_temp) {
        if ($bulletin) {
Пример #18
0
function show_results($dbh, $user_input, $nbr_lignes = 0, $page = 0, $id = 0)
{
    global $nb_per_page;
    global $base_url;
    global $caller;
    global $msg;
    global $no_display;
    global $charset;
    global $niveau_biblio, $modele_id, $serial_id;
    global $acces_j;
    if ($niveau_biblio) {
        $filtre_notice = " and niveau_biblio='{$niveau_biblio}' ";
    }
    // on récupére le nombre de lignes qui vont bien
    if ($user_input == "") {
        $requete_count = "SELECT COUNT(1) FROM notices ";
        $requete_count .= $acces_j;
        $requete_count .= "where notice_id!='" . $no_display . "' {$filtre_notice} ";
    } else {
        $aq = new analyse_query(stripslashes($user_input));
        if ($aq->error) {
            error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
            exit;
        }
        $members = $aq->get_query_members("notices", "index_wew", "index_sew", "notice_id");
        $isbn_verif = traite_code_isbn(stripslashes($user_input));
        $suite_rqt = "";
        if (isISBN($isbn_verif)) {
            if (strlen($isbn_verif) == 13) {
                $suite_rqt = "  code like '" . formatISBN($isbn_verif, 13) . "' or code like '" . addslashes($isbn_verif) . "' ";
            } else {
                $suite_rqt = " code like '" . formatISBN($isbn_verif, 10) . "' or code like '" . addslashes($isbn_verif) . "' ";
            }
            $requete_count = "select count(1) from notices ";
            $requete_count .= $acces_j;
            $requete_count .= "where ( " . $suite_rqt . " ) ";
            $requete_count .= "and notice_id!='" . $no_display . "' {$filtre_notice}";
        } else {
            $requete_count = "select count(1) from notices ";
            $requete_count .= $acces_j;
            $requete_count .= "where (" . $members["where"] . " or code like '" . addslashes($isbn_verif) . "' ) ";
            $requete_count .= "and notice_id!='" . $no_display . "' {$filtre_notice}";
        }
    }
    $res = mysql_query($requete_count, $dbh);
    $nbr_lignes = @mysql_result($res, 0, 0);
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        // on lance la vraie requête
        if ($user_input == "") {
            $requete = "SELECT notice_id, tit1, serie_name, tnvol, code FROM notices ";
            $requete .= $acces_j;
            $requete .= "left join series on serie_id=tparent_id ";
            $requete .= "where notice_id!='" . $no_display . "' {$filtre_notice} ORDER BY index_sew, code LIMIT {$debut},{$nb_per_page} ";
        } else {
            $isbn_verif = traite_code_isbn(stripslashes($user_input));
            $suite_rqt = "";
            if (isISBN($isbn_verif)) {
                if (strlen($isbn_verif) == 13) {
                    $suite_rqt = "  code like '" . formatISBN($isbn_verif, 13) . "' or code like '" . addslashes($isbn_verif) . "' ";
                } else {
                    $suite_rqt = " code like '" . formatISBN($isbn_verif, 10) . "' or code like '" . addslashes($isbn_verif) . "' ";
                }
                $requete = "select notice_id, tit1, serie_name, tnvol, code from notices ";
                $requete .= $acces_j;
                $requete .= "left join series on serie_id=tparent_id ";
                $requete .= "where (  " . $suite_rqt . " ) ";
                $requete .= "and notice_id!='" . $no_display . "' {$filtre_notice} group by notice_id limit {$debut},{$nb_per_page}";
            } else {
                $requete = "select notice_id, tit1, serie_name, tnvol, code, " . $members["select"] . " as pert from notices ";
                $requete .= $acces_j;
                $requete .= "left join series on serie_id=tparent_id where (" . $members["where"] . " or (code like '" . addslashes($isbn_verif) . "' )) ";
                $requete .= "and notice_id!='" . $no_display . "' {$filtre_notice} group by notice_id order by pert desc, index_sew, code limit {$debut},{$nb_per_page}";
            }
        }
        $res = @mysql_query($requete, $dbh);
        while ($notice = mysql_fetch_object($res)) {
            $notice_entry = "";
            if ($notice->serie_name) {
                $notice_entry .= $notice->serie_name;
                if ($notice->tnvol) {
                    $notice_entry .= ", " . $notice->tnvol;
                }
            }
            $notice_entry ? $notice_entry .= '. ' . $notice->tit1 : ($notice_entry = $notice->tit1);
            if ($niveau_biblio) {
                $location = "./catalog.php?categ=serials&sub=modele&act=copy&modele_id={$modele_id}&serial_id={$serial_id}&new_serial_id={$notice->notice_id}";
                $display = new mono_display($notice->notice_id, 0, '', 0, '', '', '', 0, 0, 0, 0, "", 0, false, true);
                print pmb_bidi("<div class='row'>\n\t\t\t\t\t\t\t\t<div class='left'>\n\t\t\t\t\t\t\t\t\t<a href='#' onclick=\"copier_modele('{$location}')\">" . $display->result . "</a>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='right'>\n\t\t\t\t\t\t\t\t\t" . htmlentities($notice->code, ENT_QUOTES, $charset) . "\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>");
            } else {
                $display = new mono_display($notice->notice_id, 0, '', 0, '', '', '', 0, 0, 0, 0, "", 0, false, true);
                print pmb_bidi("<div class='row'>\n\t\t\t\t\t\t\t\t<div class='left'>\n\t\t\t\t\t\t\t\t\t<a href='#' onclick=\"set_parent('{$caller}', '{$notice->notice_id}', '" . htmlentities(addslashes($notice_entry), ENT_QUOTES, $charset) . " ({$notice->code})')\">" . $display->result . "</a>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='right'>\n\t\t\t\t\t\t\t\t\t" . htmlentities($notice->code, ENT_QUOTES, $charset) . "\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>");
            }
        }
        mysql_free_result($res);
        // constitution des liens
        $nbepages = ceil($nbr_lignes / $nb_per_page);
        $suivante = $page + 1;
        $precedente = $page - 1;
    }
    print "<div class='row'>&nbsp;<hr /></div><div align='center'>";
    $url_base = $base_url . "&user_input=" . rawurlencode(stripslashes($user_input));
    $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, false, true);
    print $nav_bar;
    print "</div>";
}
 function do_isbd($short = 0, $ex = 1)
 {
     global $dbh;
     global $msg;
     global $tdoc;
     global $charset, $opac_url_base;
     $this->notice_isbd = "";
     //In
     //Recherche des notices parentes
     $requete = "select linked_notice, relation_type, rank from notices_relations where num_notice=" . $this->notice_id . " order by relation_type,rank";
     $result_linked = mysql_query($requete, $dbh);
     //Si il y en a, on prépare l'affichage
     if (mysql_num_rows($result_linked)) {
         global $relation_listup;
         if (!$relation_listup) {
             $relation_listup = new marc_list("relationtypeup");
         }
     }
     $r_type = array();
     $ul_opened = false;
     //Pour toutes les notices liées
     while ($r_rel = mysql_fetch_object($result_linked)) {
         $parent_notice = new notice_affichage($r_rel->linked_notice, $this->liens, 1, $this->to_print);
         $parent_notice->visu_expl = 0;
         $parent_notice->visu_explnum = 0;
         $parent_notice->do_header();
         //Presentation differente si il y en a un ou plusieurs
         if (mysql_num_rows($result_linked) == 1) {
             $this->notice_isbd .= "<br /><b>" . $relation_listup->table[$r_rel->relation_type] . "</b> <a href='" . str_replace("!!id!!", $r_rel->linked_notice, $this->lien_rech_notice) . "&seule=1'>" . $parent_notice->notice_header . "</a><br /><br />";
         } else {
             if (!$r_type[$r_rel->relation_type]) {
                 $r_type[$r_rel->relation_type] = 1;
                 if ($ul_opened) {
                     $this->notice_isbd .= "</ul>";
                 } else {
                     $this->notice_isbd .= "<br />";
                     $ul_opened = true;
                 }
                 $this->notice_isbd .= "<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>";
                 $this->notice_isbd .= "<ul class='notice_rel'>\n";
             }
             $this->notice_isbd .= "<li><a href='" . str_replace("!!id!!", $r_rel->linked_notice, $this->lien_rech_notice) . "&seule=1'>" . $parent_notice->notice_header . "</a></li>\n";
         }
         if (mysql_num_rows($result_linked) > 1) {
             $this->notice_isbd .= "</ul>\n";
         }
     }
     // constitution de la mention de titre
     if ($this->notice->serie_name) {
         $serie_temp .= inslink($this->notice->serie_name, str_replace("!!id!!", $this->notice->tparent_id, $this->lien_rech_serie));
         if ($this->notice->tnvol) {
             $serie_temp .= ',&nbsp;' . $this->notice->tnvol;
         }
     }
     if ($serie_temp) {
         $this->notice_isbd .= $serie_temp . ".&nbsp;" . $this->notice->tit1;
     } else {
         $this->notice_isbd .= $this->notice->tit1;
     }
     //commentaire du type de document
     //$this->notice_isbd .= ' ['.$tdoc->table[$this->notice->typdoc].']';
     if ($this->notice->tit3) {
         $this->notice_isbd .= "&nbsp;= " . $this->notice->tit3;
     }
     if ($this->notice->tit4) {
         $this->notice_isbd .= "&nbsp;: " . $this->notice->tit4;
     }
     if ($this->notice->tit2) {
         $this->notice_isbd .= "&nbsp;; " . $this->notice->tit2;
     }
     if ($this->auteurs_tous) {
         $this->notice_isbd .= " / " . $this->auteurs_tous;
     }
     // mention d'edition
     if ($this->notice->mention_edition) {
         $this->notice_isbd .= " &nbsp;. -&nbsp; " . $this->notice->mention_edition;
     }
     // zone de collection et editeur
     if ($this->notice->subcoll_id) {
         $collection = new subcollection($this->notice->subcoll_id);
         $editeurs .= inslink($collection->publisher_isbd, str_replace("!!id!!", $collection->publisher, $this->lien_rech_editeur));
         $collections = inslink($collection->isbd_entry, str_replace("!!id!!", $this->notice->subcoll_id, $this->lien_rech_subcollection));
     } elseif ($this->notice->coll_id) {
         $collection = new collection($this->notice->coll_id);
         $editeurs .= inslink($collection->publisher_isbd, str_replace("!!id!!", $collection->parent, $this->lien_rech_editeur));
         $collections = inslink($collection->isbd_entry, str_replace("!!id!!", $this->notice->coll_id, $this->lien_rech_collection));
     } elseif ($this->notice->ed1_id) {
         $editeur = new publisher($this->notice->ed1_id);
         $editeurs .= inslink($editeur->isbd_entry, str_replace("!!id!!", $this->notice->ed1_id, $this->lien_rech_editeur));
     }
     if ($this->notice->ed2_id) {
         $editeur = new publisher($this->notice->ed2_id);
         $editeurs ? $editeurs .= '&nbsp;: ' . inslink($editeur->isbd_entry, str_replace("!!id!!", $this->notice->ed2_id, $this->lien_rech_editeur)) : ($editeurs = inslink($editeur->isbd_entry, str_replace("!!id!!", $this->notice->ed2_id, $this->lien_rech_editeur)));
     }
     if ($this->notice->year) {
         $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year);
     } elseif ($this->notice->niveau_biblio == 'm' && $this->notice->niveau_hierar == 0) {
         $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]");
     }
     if ($editeurs) {
         $this->notice_isbd .= "&nbsp;.&nbsp;-&nbsp;{$editeurs}";
     }
     // zone de la collation
     if ($this->notice->npages) {
         $collation = $this->notice->npages;
     }
     if ($this->notice->ill) {
         $collation .= '&nbsp;: ' . $this->notice->ill;
     }
     if ($this->notice->size) {
         $collation .= '&nbsp;; ' . $this->notice->size;
     }
     if ($this->notice->accomp) {
         $collation .= '&nbsp;+ ' . $this->notice->accomp;
     }
     if ($collation) {
         $this->notice_isbd .= "&nbsp;.&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         if ($this->notice->nocoll) {
             $collections .= '; ' . $this->notice->nocoll;
         }
         $this->notice_isbd .= ".&nbsp;-&nbsp;({$collections})" . ' ';
     }
     $this->notice_isbd .= '.';
     // ISBN ou NO. commercial
     if ($this->notice->code) {
         if (isISBN($this->notice->code)) {
             $zoneISBN = 'ISBN ';
         } else {
             $zoneISBN .= '.&nbsp;- ';
         }
         $zoneISBN .= $this->notice->code;
     }
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneISBN .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneISBN) {
                 $zoneISBN .= '&nbsp; ' . $this->notice->prix;
             } else {
                 $zoneISBN = $this->notice->prix;
             }
         }
     }
     if ($zoneISBN) {
         $this->notice_isbd .= "<br />" . $zoneISBN;
     }
     // note generale
     if ($this->notice->n_gen) {
         $zoneNote = nl2br(htmlentities($this->notice->n_gen, ENT_QUOTES, $charset));
     }
     if ($zoneNote) {
         $this->notice_isbd .= "<br />" . $zoneNote;
     }
     // langues
     if (count($this->langues)) {
         $langues = "<b>{$msg[537]}</b>&nbsp;: " . $this->construit_liste_langues($this->langues);
     }
     if (count($this->languesorg)) {
         $langues .= " <b>{$msg[711]}</b>&nbsp;: " . $this->construit_liste_langues($this->languesorg);
     }
     if ($langues) {
         $this->notice_isbd .= "<br />" . $langues;
     }
     if (!$short) {
         $this->notice_isbd .= "<br />\n\t    \t\t<img class='img_plus' src=\"./getgif.php?nomgif=plus\" name=\"imEx\" id=\"el_notes_" . $this->notice_id . "Img\" title=\"" . $msg["expandable_notice"] . "\" border=\"0\" onClick=\"expandBase('el_notes_" . $this->notice_id . "', true); return false;\" hspace=\"3\">\n\t    \t\t<b>notes</b>\t\t\n\t\t\t\t<div id=\"el_notes_" . $this->notice_id . "Child\" class=\"child\" style=\"margin-bottom:6px;display:none;\">    \n\t    \t\t<table>";
         $this->notice_isbd .= $this->aff_suite();
         $this->notice_isbd .= "</table></div>";
     } else {
         $this->notice_isbd .= $this->genere_in_perio();
     }
     //Notices liees
     // ajoutees en dehors de l'onglet PUBLIC ailleurs
     if ($ex) {
         $this->affichage_resa_expl = $this->aff_resa_expl();
     }
 }
Пример #20
0
 $f_coll && $t_notice['ed1_id'] ? $t_notice['coll_id'] = $f_coll_id : ($t_notice['coll_id'] = 0);
 $f_subcoll && $t_notice['coll_id'] ? $t_notice['subcoll_id'] = $f_subcoll_id : ($t_notice['subcoll_id'] = 0);
 $t_notice['year'] = trim($f_year);
 $f_nocoll && $t_notice['coll_id'] ? $t_notice['nocoll'] = trim($f_nocoll) : ($t_notice['nocoll'] = '');
 $t_notice['mention_edition'] = trim($f_mention_edition);
 if ($f_cb) {
     // ce controle redondant est la pour le cas ou l'utilisateur aurait change le code
     if (isEAN($f_cb)) {
         // la saisie est un EAN -> on tente de le formater en ISBN
         $code = EANtoISBN($f_cb);
         // si echec, on prend l'EAN comme il vient
         if (!$code) {
             $code = $f_cb;
         }
     } else {
         if (isISBN($f_cb)) {
             // si la saisie est un ISBN
             $code = formatISBN($f_cb, 13);
             // si echec, ISBN errone on le prend sous cette forme
             if (!$code) {
                 $code = $f_cb;
             }
         } else {
             // ce n'est rien de tout ca, on prend la saisie telle quelle
             $code = $f_cb;
         }
     }
     $t_notice['code'] = $code;
 }
 $t_notice['npages'] = $f_npages;
 $t_notice['ill'] = $f_ill;
Пример #21
0
 static function listSuggestions($id_bibli = 0, $statut = '-1', $num_categ = '-1', $mask, $debut = 0, $nb_per_page = 0, $aq = 0, $order = '', $location = 0, $user_input = '', $source = 0, $user_id = 0, $user_statut = '-1')
 {
     if ($source) {
         $filtre_src = " sugg_source = '" . $source . "' ";
     } else {
         $filtre_src = " 1 ";
     }
     if (!$statut) {
         $statut = '-1';
     }
     if ($statut == '-1') {
         $filtre1 = '1';
     } elseif ($statut == $mask) {
         $filtre1 = "(statut & '" . $mask . "') = '" . $mask . "' ";
     } else {
         $filtre1 = "(statut & '" . $mask . "') = 0 and (statut & " . $statut . ") = '" . $statut . "' ";
     }
     if ($num_categ == '-1') {
         $filtre2 = '1';
     } else {
         $filtre2 = "num_categ = '" . $num_categ . "' ";
     }
     if (!$id_bibli) {
         $filtre3 = '1';
     } else {
         $filtre3 .= "num_entite = '" . $id_bibli . "' ";
     }
     if ($location == 0) {
         $filtre4 = '1';
     } else {
         $filtre4 = "sugg_location = '" . $location . "' ";
     }
     $filtre_empr = '';
     $tab_empr = array();
     $filtre_user = '';
     $tab_user = array();
     if (is_array($user_id) && count($user_id) && is_array($user_statut) && count($user_statut)) {
         foreach ($user_id as $k => $id) {
             if ($user_statut[$k] == "0") {
                 $tab_user[] = $id;
             }
             if ($user_statut[$k] == "1") {
                 $tab_empr[] = $id;
             }
         }
     }
     if (is_array($tab_empr) && count($tab_empr)) {
         $filtre_empr = "suggestions_origine.origine in ('" . implode("','", $tab_empr) . "') and type_origine='1' ";
     }
     if (is_array($tab_user) && count($tab_user)) {
         $filtre_user = "******" . implode("','", $tab_user) . "') and type_origine='0' ";
     }
     if ($filtre_empr != "" || $filtre_user != "") {
         $table_origine = ", suggestions_origine ";
         $join_origine = "  id_suggestion=num_suggestion  ";
         if ($filtre_empr && $filtre_user) {
             $clause_origine = " and ( (" . $filtre_empr . ") or (" . $filtre_user . ") ) and ";
         } elseif ($filtre_empr) {
             $clause_origine = " and (" . $filtre_empr . ") and ";
         } elseif ($filtre_user) {
             $clause_origine = " and (" . $filtre_user . ") and ";
         }
     }
     if (!$aq) {
         $q = "select * from suggestions {$table_origine}";
         $q .= "where {$join_origine} {$clause_origine} " . $filtre1 . " and " . $filtre2 . " and " . $filtre3 . " and " . $filtre4 . " and " . $filtre_src;
         if (!$order) {
             $q .= "order by statut, date_creation desc ";
         } else {
             $q .= "order by" . $order . " ";
         }
     } else {
         $isbn = '';
         $t_codes = array();
         if ($user_input !== '') {
             if (isEAN($user_input)) {
                 // la saisie est un EAN -> on tente de le formater en ISBN
                 $isbn = EANtoISBN($user_input);
                 if ($isbn) {
                     $t_codes[] = $isbn;
                     $t_codes[] = formatISBN($isbn, 10);
                 }
             } elseif (isISBN($user_input)) {
                 // si la saisie est un ISBN
                 $isbn = formatISBN($user_input);
                 if ($isbn) {
                     $t_codes[] = $isbn;
                     $t_codes[] = formatISBN($isbn, 13);
                 }
             }
         }
         if (count($t_codes)) {
             $q = "select * from suggestions {$table_origine}";
             $q .= "where {$join_origine} {$clause_origine} (" . $filtre1 . " and " . $filtre2 . " and " . $filtre3 . " and " . $filtre4 . " and " . $filtre_src;
             $q .= ") ";
             $q .= "and ('0' ";
             foreach ($t_codes as $v) {
                 $q .= "or code like '%" . $v . "%' ";
             }
             $q .= ") ";
             if (!$order) {
                 $q .= "order by statut, date_creation desc ";
             } else {
                 $q .= "order by" . $order . " ";
             }
         } else {
             $members = $aq->get_query_members("suggestions", "concat(titre,' ',editeur,' ',auteur,' ',commentaires)", "index_suggestion", "id_suggestion");
             $q = $q = "select *, " . $members["select"] . " as pert from suggestions {$table_origine} ";
             $q .= "where {$join_origine} {$clause_origine} (" . $filtre1 . " and " . $filtre2 . " and " . $filtre3 . " and " . $filtre4 . " and " . $filtre_src;
             $q .= ") ";
             $q .= "and (" . $members["where"] . " ";
             foreach ($t_codes as $v) {
                 $q .= "or index_suggestion like ('%" . $v . "%') ";
             }
             $q .= ") ";
             if (!$order) {
                 $q .= "order by pert desc ";
             } else {
                 $q .= "order by " . $order . ", pert desc ";
             }
         }
     }
     if (!$debut && $nb_per_page) {
         $q .= "limit " . $nb_per_page;
     }
     if ($debut && $nb_per_page) {
         $q .= "limit " . $debut . "," . $nb_per_page;
     }
     return $q;
 }
Пример #22
0
 function noticeInfos($notice_id, $sparql_end_point)
 {
     global $lang, $charset;
     //On va rechercher l'isbn si il existe....
     $requete = "select code from notices where notice_id={$notice_id}";
     $resultat = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($resultat)) {
         $isbn = pmb_mysql_result($resultat, 0, 0);
     } else {
         $isbn = "";
     }
     if ($isbn) {
         //On y va !
         $config = array('remote_store_endpoint' => $sparql_end_point, 'remote_store_timeout' => 15);
         $store = ARC2::getRemoteStore($config);
         if (isISBN($isbn)) {
             $isbn = formatISBN($isbn, 10);
             $isbn13 = formatISBN($isbn, 13);
         }
         $sparql = "prefix bnf-onto: <http://data.bnf.fr/ontology/>\n\t\t\t\tprefix rdarelationships: <http://rdvocab.info/RDARelationshipsWEMI/>\n\t\t\t\tSELECT ?oeuvre WHERE {\n\t\t\t\t  ?manifestation bnf-onto:ISBN '{$isbn}' .\n\t\t\t\t  ?manifestation rdarelationships:workManifested ?oeuvre \n\t\t\t\t}";
         try {
             $rows = $store->query($sparql, 'rows');
             if (!$rows[0]["oeuvre"] && $isbn13) {
                 $sparql = "prefix bnf-onto: <http://data.bnf.fr/ontology/>\n\t\t\t\t\tprefix rdarelationships: <http://rdvocab.info/RDARelationshipsWEMI/>\n\t\t\t\t\tSELECT ?oeuvre WHERE {\n\t\t\t\t\t?manifestation bnf-onto:ISBN '{$isbn13}' .\n\t\t\t\t\t?manifestation rdarelationships:workManifested ?oeuvre\n\t\t\t\t\t}";
                 try {
                     $rows = $store->query($sparql, 'rows');
                 } catch (Exception $e) {
                     $rows = array();
                 }
             }
         } catch (Exception $e) {
             $rows = array();
         }
         if ($rows[0]["oeuvre"]) {
             $oeuvre = $rows[0]["oeuvre"];
             $sparql = "prefix skos: <http://www.w3.org/2004/02/skos/core#>\n\t\t\t\t\tprefix foaf: <http://xmlns.com/foaf/0.1/>\n\t\t\t\t\tprefix dc: <http://purl.org/dc/terms/>\n\t\t\t\t\tprefix bnf-onto: <http://data.bnf.fr/ontology/>\n\t\t\t\t\tprefix rdarelationships: <http://rdvocab.info/RDARelationshipsWEMI/>\n\t\t\t\t\tprefix rdagroup1Elements: <http://RDVocab.info/Elements/>\n\t\t\t\t\tSELECT * WHERE {\n\t\t\t\t\t  <{$oeuvre}> rdfs:label ?titre .\n\t\t\t\t\t  OPTIONAL { <{$oeuvre}> dc:date ?date } .\n\t\t\t\t\t  OPTIONAL { <{$oeuvre}> foaf:depiction ?vignette } .\n\t\t\t\t\t  OPTIONAL { <{$oeuvre}> dc:description ?description } .\n\t\t\t\t\t  OPTIONAL { <{$oeuvre}> bnf-onto:subject ?sujet } .\n\t\t\t\t\t  OPTIONAL { <{$oeuvre}> dc:creator ?auteur .\n\t\t\t\t\t     ?auteur_concept foaf:focus ?auteur .\n\t\t\t\t\t     ?auteur_concept skos:prefLabel ?auteur_isbd .\n\t\t\t\t\t  } .\n\t\t\t\t\t  OPTIONAL { <{$oeuvre}> rdagroup1Elements:placeOfOriginOfTheWork ?lieu }\n\t\t\t\t\t}";
             try {
                 $rows = $store->query($sparql, 'rows');
             } catch (Exception $e) {
                 $rows = array();
             }
             $rows = array_uft8_decode($rows);
             $template = "\n\t\t\t\t\t\t<h3>{{result.0.titre}}<div style='float:right'><a href='{$oeuvre}' target='_blank'><img src='http://data.bnf.fr/data/a9782ddcfea7752a2c5224f971cd991d/logo-data.gif' style='max-height:20px'/></a></div></h3>\n\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t<h3>Détail de l'oeuvre (BNF)</h3>\n\t\t\t\t\t\t{% if result.0.vignette %}\n\t\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td><img src='{{result.0.vignette}}' height='150px'/></td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t{% endif %}\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr><td style='background:#EEEEEE'>Date</td><td>{{result.0.date}}</td></tr>\n\t\t\t\t\t\t\t<tr><td style='background:#EEEEEE'>Sujet</td><td>{{result.0.sujet}}</td></tr>\n\t\t\t\t\t\t\t<tr><td style='background:#EEEEEE'>Auteur</td><td><a href='index.php?uri={{result.0.auteur_concept}}&lvl=cmspage&pageid=12'>{{result.0.auteur_isbd}}</a></td></tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t{% if result.0.vignette %}\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t  </table>\n\t\t\t\t\t\t{% endif %}\n\t\t\t\t\t\t<br/>\t\n\t\t\t\t\t\t<h4>{{result.0.description}}</h4>\t\t\t\n\t\t\t\t";
             $html_to_return .= H2o::parseString($template)->render(array("result" => $rows));
             //Récupération des exemplaires de Gallica
             $sparql = "prefix skos: <http://www.w3.org/2004/02/skos/core#>\n\t\t\t\t\tprefix foaf: <http://xmlns.com/foaf/0.1/>\n\t\t\t\t\tprefix dc: <http://purl.org/dc/terms/>\n\t\t\t\t\tprefix bnf-onto: <http://data.bnf.fr/ontology/>\n\t\t\t\t\tprefix rdarelationships: <http://rdvocab.info/RDARelationshipsWEMI/>\n\t\t\t\t\tprefix rdagroup1Elements: <http://RDVocab.info/Elements/>\n\t\t\t\t\tSELECT * WHERE {\n\t\t\t\t\t\t?manifestation rdarelationships:workManifested <{$oeuvre}> .\n\t\t\t\t\t\tOPTIONAL { ?manifestation rdarelationships:electronicReproduction ?gallica } .\n\t\t\t\t\t\tOPTIONAL { ?manifestation bnf-onto:ISBN ?isbn } .\n\t\t\t\t\t\tOPTIONAL { <{$oeuvre}> foaf:depiction ?vignette } .\n\t\t\t\t\t\tOPTIONAL { ?manifestation dc:date ?date } .\n\t\t\t\t\t\tOPTIONAL { ?manifestation rdagroup1Elements:publishersName ?publisher } .\n\t\t\t\t\t\tOPTIONAL { ?manifestation rdagroup1Elements:note ?note } .\n\t\t\t\t\t\tOPTIONAL { ?manifestation rdagroup1Elements:placeOfPublication ?place } .\n\t\t\t\t\t\tOPTIONAL { ?manifestation rdagroup1Elements:dateOfCapture ?numerisele } .\n\t\t\t\t\t} group by ?manifestation order by ?date\n\t\t\t\t";
             try {
                 $rows = $store->query($sparql, 'rows');
             } catch (Exception $e) {
                 $rows = array();
             }
             $rows = array_uft8_decode($rows);
             $template = "\n\t\t\t\t\t\t<h3>Editions numérisées dans Gallica</h3><br/>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t{% for record in result %}\n\t\t\t\t\t\t\t{% if record.gallica %}\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td><a href='{{record.gallica}}' target='_blank'><img height='40px' src='http://gallica.bnf.fr/images/dynamic/perso/logo_gallica.png' /></a></td>\n\t\t\t\t\t\t\t\t<td><a href='{{record.gallica}}' target='_blank'>Edition : {{record.date}} par {{record.publisher}} à {{record.place}}</a></td>\n\t\t\t\t\t\t\t\t<td>{{record.note}}</td>\n\t\t\t\t\t\t\t\t<td>{{record.numerisele}}</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t{% endif %}\n\t\t\t\t\t\t{% endfor %}\n\t\t\t\t\t\t</table>\n\t\t\t\t";
             $html_to_return .= H2o::parseString($template)->render(array("result" => $rows));
             $template = "\n\t\t\t\t\t\t<h3>Editions dans la bibliothèque</h3><br/>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t{% for record in result %}\n\t\t\t\t\t\t\t{% if record.isbn %}\n\t\t\t\t\t\t\t\t{% sqlvalue i_catalog %}\n\t\t\t\t\t\t\t\t\tselect count(expl_id) as nb,notice_id from exemplaires join notices on expl_notice=notice_id where code='{{record.isbn}}' group by notice_id\n\t\t\t\t\t\t\t\t{% endsqlvalue %}\n\t\t\t\t\t\t\t\t{% if i_catalog.0.nb %}\n\t\t\t\t\t\t\t\t\t<tr style='height:70px'>\n\t\t\t\t\t\t\t\t\t\t<td><a href='index.php?lvl=notice_display&id={{i_catalog.0.notice_id}}' target='_blank'>{% if record.vignette %}<img src='{{record.vignette}}' height='70px'/>{% else %}&nbsp;{% endif %}</a></td>\n\t\t\t\t\t\t\t\t\t\t<td><a href='index.php?lvl=notice_display&id={{i_catalog.0.notice_id}}' target='_blank'>Edition : {{record.date}} par {{record.publisher}} à {{record.place}}</a></td>\n\t\t\t\t\t\t\t\t\t\t<td>{{record.note}}</td>\n\t\t\t\t\t\t\t\t\t\t<td><a href='index.php?lvl=notice_display&id={{i_catalog.0.notice_id}}' target='_blank'>{{i_catalog.0.nb}} exemplaires disponible(s)</a></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t{% endif %}\n\t\t\t\t\t\t\t{% endif %}\n\t\t\t\t\t\t{% endfor %}\n\t\t\t\t\t\t</table>\n\t\t\t\t";
             try {
                 $html_to_return .= H2o::parseString($template)->render(array("result" => $rows));
             } catch (Exception $e) {
                 $html_to_return .= highlight_string(print_r($e, true), true);
             }
         }
     }
     return $html_to_return;
 }
Пример #23
0
 function getNoticeInfos($notice_id, $source_id)
 {
     global $search_index, $url;
     $error = false;
     $info = "";
     $asin = 0;
     $params = $this->get_source_params($source_id);
     $this->fetch_global_properties();
     $parameters = unserialize($this->parameters);
     if ($params["PARAMETERS"]) {
         //Affichage du formulaire avec $params["PARAMETERS"]
         $vars = unserialize($params["PARAMETERS"]);
         foreach ($vars as $key => $val) {
             global ${$key};
             ${$key} = $val;
         }
     }
     $client = $this->initAWS($source_id);
     $client->__setSoapHeaders($this->make_soap_headers('ItemSearch'));
     $rqt = "select code from notices where notice_id = '" . $notice_id . "'";
     $res = pmb_mysql_query($rqt);
     if (pmb_mysql_num_rows($res)) {
         $code = pmb_mysql_result($res, 0, 0);
         if ($code != "") {
             $code = preg_replace('/-|\\.| /', '', $code);
             $paws["Request"] = array("SearchIndex" => $search_index[$url][0], "ResponseGroup" => "ItemIds", "Keywords" => "{$code}");
             $paws["AssociateTag"] = $parameters['associatetag'];
             try {
                 $this->sleep_needed();
                 $result = $client->ItemSearch($paws);
             } catch (Exception $e) {
                 $error = true;
             }
             if (!$error) {
                 if (is_object($result)) {
                     $result = amazon::objectToArrayAndCharset($result);
                 }
                 $items = $this->soap2array($result["Items"], "Item");
                 $asin = $items[0][ASIN];
                 if ($asin) {
                     $client->__setSoapHeaders(NULL);
                     $client->__setSoapHeaders($this->make_soap_headers('ItemLookup'));
                     $paws["Request"] = array("ResponseGroup" => "Large", "IdType" => "ASIN", "ItemId" => $asin);
                     try {
                         $this->sleep_needed();
                         $result = $client->ItemLookup($paws);
                     } catch (Exception $e) {
                         $error = true;
                     }
                     if (!$error) {
                         if (is_object($result)) {
                             $result = amazon::objectToArrayAndCharset($result);
                         }
                         $items = $this->soap2array($result["Items"], "Item");
                         //récupération des résumés...
                         $resumes = $this->soap2array($items[0]["EditorialReviews"], "EditorialReview");
                         if (count($resumes)) {
                             for ($i = 0; $i < count($resumes); $i++) {
                                 $infos['resume'] .= $resumes[$i]["Content"] . ($resumes[$i]["Source"] ? " (" . $resumes[$i]["Source"] . ")" : "");
                             }
                         }
                         //récupération des avis ...
                         $links = $this->soap2array($items[0]["ItemLinks"], "ItemLink");
                         if (count($links)) {
                             for ($i = 0; $i < count($links); $i++) {
                                 if ($links[$i]['Description'] == "All Customer Reviews") {
                                     $infos['review'] .= "<iframe src='" . $links[$i]['URL'] . "' style='width:" . $review_width . ";height:" . $review_height . ";'></iframe>";
                                 }
                             }
                         }
                         //récupération des extrait sonore si dispo ...
                         $discs = $this->soap2array($items[0]["Tracks"], "Disc");
                         if (count($discs)) {
                             $infos['extract_audio'] = "\n\t\t\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t\t\t<tr>";
                             for ($i = 0; $i < count($discs); $i++) {
                                 $infos['extract_audio'] .= "\n\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t<h4>Disque " . $discs[$i]['Number'] . "</h4>\n\t\t\t\t\t\t\t\t\t\t\t<ul>";
                                 for ($j = 0; $j < count($discs[$i]['Track']); $j++) {
                                     $infos['extract_audio'] .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<li><a href='http://www.amazon.fr/gp/recsradio/radio/" . $asin . "/ref=pd_krex_dp_a&disc=" . $discs[$i]['Number'] . "&track=" . $discs[$i]['Track'][$j]['Number'] . "' target='_blank' alt='" . sprintf($this->msg['amazon_enrichment_listen_extract'], $discs[$i]['Track'][$j]['_']) . "' title='" . sprintf($this->msg['amazon_enrichment_listen_extract'], $discs[$i]['Track'][$j]['_']) . "'>" . $discs[$i]['Track'][$j]['Number'] . " - " . $discs[$i]['Track'][$j]['_'] . "</a></li>";
                                 }
                                 $infos['extract_audio'] .= "\n\t\t\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t\t</td>";
                             }
                             $infos['extract_audio'] .= "\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>";
                         }
                         //pour les similarités
                         foreach ($items[0][SimilarProducts][SimilarProduct] as $similar) {
                             if (isISBN($similar[ASIN])) {
                                 $rqt = "select notice_id from notices where code = '" . formatISBN($similar[ASIN], 10) . "' or code = '" . formatISBN($similar[ASIN], 13) . "' limit 1";
                                 $res = mysql_query($rqt);
                                 if (mysql_num_rows($res)) {
                                     $notice = mysql_result($res, 0, 0);
                                     if ($notice) {
                                         $infos['similarities'] .= aff_notice($notice, 1, 1, 0, AFF_ETA_NOTICES_REDUIT, "no", 0, 1);
                                     }
                                 }
                             } else {
                                 //si c'est pas un ISBN on cherche ce que ca peut être...
                                 $paws["Request"] = array("ResponseGroup" => "ItemAttributes", "IdType" => "ASIN", "ItemId" => $similar[ASIN]);
                                 try {
                                     $result = $client->ItemLookup($paws);
                                     if (is_object($result)) {
                                         $result = amazon::objectToArrayAndCharset($result);
                                     }
                                 } catch (Exception $e) {
                                     $error = true;
                                 }
                                 if (!$error) {
                                     $items = $this->soap2array($result["Items"], "Item");
                                     $code = $items[0][ItemAttributes][UPC];
                                     if ($code) {
                                         $rqt = "select notice_id from notices where code = '" . $code . "' or code = '" . $code . "' limit 1";
                                         $res = mysql_query($rqt);
                                         if (mysql_num_rows($res)) {
                                             $notice = mysql_result($res, 0, 0);
                                             if ($notice) {
                                                 $infos['similarities'] .= aff_notice($notice, 1, 1, 0, AFF_ETA_NOTICES_REDUIT, "no", 0, 1);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $infos;
 }
Пример #24
0
function test_cb()
{
    global $cb;
    global $barcode;
    $isbn = '';
    $barcode = '';
    // on commence par voir ce que la saisie utilisateur est ($cb)
    $cb = clean_string($cb);
    if (isEAN($cb)) {
        // la saisie est un EAN -> on tente de le formater en ISBN
        $isbn = EANtoISBN($cb);
        // si échec, on prend l'EAN comme il vient
        if (!$isbn) {
            $barcode = $cb;
        } else {
            $barcode = $isbn;
        }
    } else {
        if (isISBN($cb)) {
            // si la saisie est un ISBN
            $isbn = formatISBN($cb);
            // si échec, ISBN erroné on le prend sous cette forme
            if (!$isbn) {
                $barcode = $cb;
            } else {
                $barcode = $isbn;
            }
        } else {
            // ce n'est rien de tout ça, on prend la saisie telle quelle
            $barcode = $cb;
        }
    }
}
Пример #25
0
             print pmb_bidi($affichage);
         } else {
             // prolongation d'un prêt. exemplaire ou emprunteur inconnu
             error_message($msg[391], $msg[392], 1, './circ.php');
         }
     } else {
         include "./circ/pret.inc.php";
     }
     break;
 case 'pret_express':
     $pe_isbn = traite_code_isbn(stripslashes($pe_isbn));
     $suite_rqt = "";
     $requete_idexpl = "select expl_id from exemplaires where expl_cb='" . addslashes($pe_excb) . "'";
     $result = pmb_mysql_query($requete_idexpl, $dbh);
     if (pmb_mysql_num_rows($result) == 0) {
         if (isISBN($pe_isbn)) {
             if (strlen($pe_isbn) == 13) {
                 $suite_rqt = " or code='" . formatISBN($pe_isbn, 13) . "' ";
             } else {
                 $suite_rqt = "or code='" . formatISBN($pe_isbn, 10) . "' ";
             }
         }
         $acreer = 1;
         if ($pe_isbn) {
             $requete = "select notice_id from notices where code='" . addslashes($pe_isbn) . "' " . $suite_rqt . " and niveau_biblio='m' and niveau_hierar='0' ";
             $result = pmb_mysql_query($requete, $dbh);
             if ($tmp_not = pmb_mysql_fetch_object($result)) {
                 $id_notice = $tmp_not->notice_id;
                 $acreer = 0;
             }
         }
Пример #26
0
function convert_endnote($notice, $s, $islast, $isfirst, $param_path)
{
    global $cols;
    global $ty;
    global $intitules;
    global $base_path, $origine;
    global $tab_functions;
    global $lot;
    //global $charset;
    if (!$tab_functions) {
        $tab_functions = new marc_list('function');
    }
    $fields = explode("\n", $notice);
    $error = "";
    if ($fields) {
        $data = "<notice>\n";
    }
    $lignes = organize_line($fields);
    foreach ($lignes as $champ => $value) {
        switch ($champ) {
            case '%T':
                //Titre principal
                $titre = $value;
                break;
            case '%B':
                //Autre info sur titre
                $titre_other = $value;
                break;
            case '%Q':
                //Autre info sur titre
                $titre_parallel = $value;
                break;
            case '%C':
                //Editeur
                $editeur_ville = $value;
                break;
            case '%Y':
            case '%A':
                //Autres auteurs
                $autres_auteurs = $value;
                break;
            case '%E':
                //Auteur secondaire
                $auteur_secondaire = $value;
                break;
            case '%@':
                //ISBN/ISSN
                $code = $value;
                if (isISBN($code)) {
                    $infos_isbn = $code;
                } elseif (isISSN($code)) {
                    $infos_issn = $code;
                } else {
                    $error = "wrong ISBN/ISSN \n";
                }
                break;
            case '%U':
                //URL
                $url = $value;
                break;
            case '%D':
                //Date de publication (YYYY/MM/DD)
                $dates = explode("/", $value);
                if ($dates[0]) {
                    $year = $dates[0];
                }
                if ($dates[1]) {
                    $month = $dates[1];
                }
                if ($dates[2]) {
                    $day = $dates[2];
                }
                $publication_date = $year;
                if ($year && $month && $day) {
                    $date_sql = str_replace("/", "-", $value);
                    $mention_date = $value;
                } else {
                    if ($year && $month && !$day) {
                        $date_sql = $year . "-" . $month . "-01";
                        $mention_date = $year . "/" . $month;
                    } else {
                        if ($year && !$month && !$day) {
                            $date_sql = $year . "-01-01";
                            $mention_date = $year;
                        }
                    }
                }
                break;
            case '%0':
                /*switch($value){
                			case 'Book':
                			case 'Edited Book':
                			case 'Electronic Book':
                				$subtype='Book';
                			break;
                			case 'Computer Program':
                				$subtype='Computing Program';
                			break;
                			case 'Conference Proceedings':
                			case 'Conference Paper':	
                				$subtype='Conference Proceedings';
                			break;
                			case 'Unpublished Work':
                				$subtype='Preprint';
                			break;
                			case 'Online Multimedia':
                				$subtype='Interactive Multimedia';
                			break;
                			case 'Journal Article':
                			case 'Magazine Article':	
                			case 'Electronic Article':
                			case 'Newspaper Article':
                				$subtype='Article';
                			break;
                			case 'Map':
                				$subtype='Map';
                			break;
                			case 'Report':
                				$subtype='Report';
                			break;
                			case 'Online Database':
                				$subtype='Database';
                			break;
                			case 'Thesis':
                				$subtype='Thesis';
                			break;
                			default :
                				$subtype='Article';
                			break;
                		}	*/
                //Document type
                $subtype = $value;
                break;
            case '%Z':
                //Notes
                $notes = $value;
                break;
            case '%P':
                //End page
                $page = $value;
                break;
            case '%K':
                //Mots cles
                $keywords = $value;
                break;
            case '%+':
                //Collectivite
                $collectivite = $value;
                break;
            case '%N':
                //Numéro de bulletin
                $bull_num = $value;
                break;
            case '%V':
                //Volume
                $bull_vol = $value;
                break;
            case '%X':
                //Résumé
                $resume = $value;
                break;
            case '%J':
                //Titre du pério
                $perio_title = $value;
                break;
            case '%G':
                $langue = $value;
                break;
            case '%M':
                $id_endnote = $value;
                break;
            case '%I':
                $publisher = $value;
                break;
            default:
                $data .= '';
                break;
        }
    }
    //Construction du fichier
    $data .= "<rs>n</rs>\n\t\t  <dt>a</dt>\n\t\t  <bl>a</bl>\n\t\t  <hl>2</hl>\n\t\t  <el>1</el>\n\t\t  <ru>i</ru>\n";
    $data .= "<f c='001' ind='  '>\n";
    $data .= htmlspecialchars($id_endnote, ENT_QUOTES, $charset);
    $data .= "</f>\n";
    if ($infos_isbn) {
        $data .= "<f c='010' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($infos_isbn, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($infos_issn) {
        $data .= "<f c='011' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($infos_issn, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($langue) {
        $data .= "<f c='101' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($langue, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($titre) {
        $data .= "<f c='200' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($titre, ENT_QUOTES, $charset) . "</s>";
        if ($titre_other) {
            $data .= "\t<s c='e'>" . htmlspecialchars($titre_other, ENT_QUOTES, $charset) . "</s>";
        }
        if ($titre_parallel) {
            $data .= "\t<s c='d'>" . htmlspecialchars($titre_parallel, ENT_QUOTES, $charset) . "</s>";
        }
        $data .= "</f>\n";
    }
    if ($publisher) {
        $data .= "<f c='210' ind='  '>\n";
        $data .= "\t<s c='c'>" . htmlspecialchars($publisher, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($page) {
        $data .= "<f c='215' ind='  '>\n";
        if ($page) {
            $data .= "\t<s c='a'>" . htmlspecialchars($page, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "</f>\n";
    }
    if ($notes) {
        $note = explode('###', $notes);
        $doi = "";
        $pubmedid = "";
        for ($i = 0; $i < count($note); $i++) {
            if (strpos($note[$i], "doi:") !== false) {
                $doi = $note[$i];
            } else {
                if (strpos($note[$i], "PubMed ID:") !== false) {
                    $pubmedid = $note[$i];
                } else {
                    if (strlen($note[$i]) > 9000) {
                        $word = wordwrap($note[$i], 9000, "####");
                        $words = explode("####", $word);
                        for ($j = 0; $j < count($words); $j++) {
                            $data .= "<f c='300' ind='  '>\n";
                            $data .= "\t<s c='a'>" . htmlspecialchars($words[$j], ENT_QUOTES, $charset) . "</s>\n";
                            $data .= "</f>\n";
                        }
                    } else {
                        $data .= "<f c='300' ind='  '>\n";
                        $data .= "\t<s c='a'>" . htmlspecialchars($note[$i], ENT_QUOTES, $charset) . "</s>\n";
                        $data .= "</f>\n";
                    }
                }
            }
        }
    }
    if ($resume) {
        $data .= "<f c='330' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($resume, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "</f>\n";
    }
    if ($perio_title) {
        $data .= "<f c='461' ind='  '>\n";
        $data .= "\t<s c='t'>" . htmlspecialchars($perio_title, ENT_QUOTES, $charset) . "</s>\n";
        if ($infos_issn) {
            $data .= "\t<s c='x'>" . htmlspecialchars($infos_issn, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "\t<s c='9'>lnk:perio</s>\n";
        $data .= "</f>\n";
    }
    if ($bull_num || $bull_vol) {
        $data .= "<f c='463' ind='  '>\n";
        if ($bull_num && $bull_vol) {
            $data .= "\t<s c='v'>" . "vol. " . htmlspecialchars($bull_vol, ENT_QUOTES, $charset) . ", no. " . htmlspecialchars($bull_num, ENT_QUOTES, $charset) . "</s>\n";
        } else {
            if ($bull_num && !$bull_vol) {
                $data .= "\t<s c='v'>no. " . htmlspecialchars($bull_num, ENT_QUOTES, $charset) . "</s>\n";
            } else {
                if (!$bull_num && $bull_vol) {
                    $data .= "\t<s c='v'>vol. " . htmlspecialchars($bull_vol, ENT_QUOTES, $charset) . "</s>\n";
                }
            }
        }
        if ($date_sql) {
            $data .= "\t<s c='d'>" . htmlspecialchars($date_sql, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($mention_date) {
            $data .= "\t<s c='e'>" . htmlspecialchars($mention_date, ENT_QUOTES, $charset) . "</s>\n";
        }
        $data .= "\t<s c='9'>lnk:bull</s>\n";
        $data .= "</f>\n";
    }
    if ($keywords) {
        $mots = explode('###', $keywords);
        for ($i = 0; $i < count($mots); $i++) {
            $data .= "<f c='610' ind='0 '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($mots[$i], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "</f>\n";
        }
    }
    if ($collectivite) {
        $collectivites = explode("###", $collectivite);
        if (count($collectivites) == 1) {
            $coll_elt = explode(", ", $collectivites[0], 3);
            $coll_infos = explode(", ", $coll_elt[2], 2);
            $coll_nom = $coll_infos[0];
            $coll_pays = trim(substr($coll_infos[1], strrpos($coll_infos[1], ", ") + 1));
            $coll_lieu = trim(substr($coll_infos[1], 0, -(strlen($coll_pays) + 2)));
            $data .= "<f c='710' ind='0 '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($coll_nom, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='e'>" . htmlspecialchars($coll_lieu, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='m'>" . htmlspecialchars($coll_pays, ENT_QUOTES, $charset) . "</s>\n";
            $data .= "</f>\n";
        } else {
            for ($i = 0; $i < count($collectivites); $i++) {
                $coll_elt = explode(", ", $collectivites[$i], 3);
                $coll_infos = explode(", ", $coll_elt[2], 2);
                $coll_nom = $coll_infos[0];
                $coll_pays = trim(substr($coll_infos[1], strrpos($coll_infos[1], ", ") + 1));
                $coll_lieu = trim(substr($coll_infos[1], 0, -(strlen($coll_pays) + 2)));
                $data .= "<f c='710' ind='0 '>\n";
                $data .= "\t<s c='a'>" . htmlspecialchars($coll_nom, ENT_QUOTES, $charset) . "</s>\n";
                $data .= "\t<s c='e'>" . htmlspecialchars($coll_lieu, ENT_QUOTES, $charset) . "</s>\n";
                $data .= "\t<s c='m'>" . htmlspecialchars($coll_pays, ENT_QUOTES, $charset) . "</s>\n";
                $data .= "</f>\n";
            }
        }
    }
    if ($autres_auteurs) {
        $others = explode("###", $autres_auteurs);
        for ($i = 0; $i < count($others); $i++) {
            $aut = explode(", ", $others[$i]);
            $data .= "<f c='701' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($aut[0], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='b'>" . htmlspecialchars($aut[1], ENT_QUOTES, $charset) . "</s>\n";
            if ($aut[2]) {
                $data .= "\t<s c='c'>" . htmlspecialchars($aut[2], ENT_QUOTES, $charset) . "</s>\n";
            }
            $data .= "</f>\n";
        }
    }
    if ($auteur_secondaire) {
        $secs = explode("###", $auteur_secondaire);
        for ($i = 0; $i < count($secs); $i++) {
            $aut = explode(", ", $secs);
            $data .= "<f c='702' ind='  '>\n";
            $data .= "\t<s c='a'>" . htmlspecialchars($aut[0], ENT_QUOTES, $charset) . "</s>\n";
            $data .= "\t<s c='b'>" . htmlspecialchars($aut[1], ENT_QUOTES, $charset) . "</s>\n";
            if ($aut[2]) {
                $data .= "\t<s c='c'>" . htmlspecialchars($aut[2], ENT_QUOTES, $charset) . "</s>\n";
            }
            $data .= "</f>\n";
        }
    }
    if ($url) {
        $data .= "<f c='856' ind='  '>\n";
        $data .= "\t<s c='u'>" . htmlspecialchars($url, ENT_QUOTES, $charset) . "</s>";
        $data .= "</f>\n";
    }
    if ($subtype) {
        $data .= "<f c='900' ind='  '>\n";
        $data .= "\t<s c='a'>" . htmlspecialchars($subtype, ENT_QUOTES, $charset) . "</s>\n";
        $data .= "\t<s c='l'>Sub-Type</s>\n";
        $data .= "\t<s c='n'>subtype</s>\n";
        $data .= "</f>\n";
    }
    $data .= "</notice>\n";
    if (!$error) {
        $r['VALID'] = true;
    } else {
        $r['VALID'] = false;
    }
    $r['ERROR'] = $error;
    $r['DATA'] = $data;
    return $r;
}
Пример #27
0
function traite_code_isbn($saisieISBN = "")
{
    if ($saisieISBN) {
        if (isEAN($saisieISBN)) {
            // la saisie est un EAN -> on tente de le formater en ISBN
            $code = EANtoISBN($saisieISBN);
            // si échec, on prend l'EAN comme il vient
            if (!$code) {
                $code = $saisieISBN;
            }
        } else {
            if (isISBN($saisieISBN)) {
                // si la saisie est un ISBN
                $code = formatISBN($saisieISBN);
                // si échec, ISBN erroné on le prend sous cette forme
                if (!$code) {
                    $code = $saisieISBN;
                }
            } else {
                // ce n'est rien de tout ça, on prend la saisie telle quelle
                $code = $saisieISBN;
            }
        }
        return $code;
    }
    return "";
}
Пример #28
0
if ($notice_id && $pmb_notice_img_folder_id) {
    $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
    $res = mysql_query($req, $dbh);
    if (mysql_num_rows($res)) {
        $rep = mysql_fetch_object($res);
        $img = $rep->repertoire_path . "img_" . $notice_id;
        header('Content-Type: image/png');
        $fp = @fopen($img, "rb");
        fpassthru($fp);
        fclose($fp);
        exit;
    }
}
if ($noticecode) {
    if (isEAN($noticecode)) {
        if (isISBN($noticecode)) {
            if (isISBN10($noticecode)) {
                $url_image10 = str_replace("!!isbn!!", str_replace("-", "", $noticecode), $_GET['url_image']);
                $url_image13 = str_replace("!!isbn!!", str_replace("-", "", formatISBN($noticecode, "13")), $_GET['url_image']);
            } else {
                $url_image10 = str_replace("!!isbn!!", str_replace("-", "", EANtoISBN10($noticecode)), $_GET['url_image']);
                $url_image13 = str_replace("!!isbn!!", str_replace("-", "", $noticecode), $_GET['url_image']);
            }
        } else {
            $url_imageEAN = str_replace("!!isbn!!", str_replace("-", "", $noticecode), $_GET['url_image']);
        }
    }
    $url_image = str_replace("!!isbn!!", $noticecode, $_GET['url_image']);
} else {
    $url_image = rawurldecode(stripslashes($_GET['url_image']));
}
Пример #29
0
 function do_isbd()
 {
     global $dbh, $base_path;
     global $langue_doc;
     global $msg;
     global $tdoc;
     global $fonction_auteur;
     global $charset;
     global $thesaurus_mode_pmb, $thesaurus_categories_categ_in_line, $pmb_keyword_sep, $thesaurus_categories_affichage_ordre;
     global $load_tablist_js;
     global $lang;
     global $categories_memo, $libelle_thesaurus_memo;
     global $categories_top, $use_opac_url_base, $opac_url_base, $thesaurus_categories_show_only_last;
     global $categ;
     global $id_empr;
     global $pmb_show_notice_id, $pmb_opac_url, $pmb_show_permalink;
     global $sort_children;
     global $pmb_resa_planning;
     global $thesaurus_concepts_active;
     global $pmb_map_activate;
     global $pmb_nomenclature_activate;
     // constitution de la mention de titre
     if ($this->tit_serie) {
         if ($this->print_mode) {
             $this->isbd = $this->tit_serie;
         } else {
             $this->isbd = $this->tit_serie_lien_gestion;
         }
         if ($this->notice->tnvol) {
             $this->isbd .= ',&nbsp;' . $this->notice->tnvol;
         }
     }
     $this->isbd ? $this->isbd .= '.&nbsp;' . $this->notice->tit1 : ($this->isbd = $this->notice->tit1);
     $tit2 = $this->notice->tit2;
     $tit3 = $this->notice->tit3;
     $tit4 = $this->notice->tit4;
     if ($tit3) {
         $this->isbd .= "&nbsp;= {$tit3}";
     }
     if ($tit4) {
         $this->isbd .= "&nbsp;: {$tit4}";
     }
     if ($tit2) {
         $this->isbd .= "&nbsp;; {$tit2}";
     }
     $this->isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']';
     $mention_resp = array();
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
         if ($this->print_mode) {
             $mention_resp_lib = $auteur->isbd_entry;
         } else {
             $mention_resp_lib = $auteur->isbd_entry_lien_gestion;
         }
         if (!$this->print_mode) {
             $mention_resp_lib .= $auteur->author_web_link;
         }
         if ($auteur_0["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_0["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($this->print_mode) {
             $mention_resp_lib = $auteur->isbd_entry;
         } else {
             $mention_resp_lib = $auteur->isbd_entry_lien_gestion;
         }
         if (!$this->print_mode) {
             $mention_resp_lib .= $auteur->author_web_link;
         }
         if ($auteur_1["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_1["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($this->print_mode) {
             $mention_resp_lib = $auteur->isbd_entry;
         } else {
             $mention_resp_lib = $auteur->isbd_entry_lien_gestion;
         }
         if (!$this->print_mode) {
             $mention_resp_lib .= $auteur->author_web_link;
         }
         if ($auteur_2["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_2["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $libelle_mention_resp = implode("; ", $mention_resp);
     if ($libelle_mention_resp) {
         $this->isbd .= "&nbsp;/ {$libelle_mention_resp}";
     }
     // mention d'édition
     if ($this->notice->mention_edition) {
         $this->isbd .= ".&nbsp;-&nbsp;" . $this->notice->mention_edition;
     }
     if ($pmb_map_activate) {
         if ($mapisbd = $this->map_info->get_isbd()) {
             $this->isbd .= $mapisbd;
         }
     }
     // zone de l'adresse
     // on récupère la collection au passage, si besoin est
     if ($this->notice->subcoll_id) {
         $collection = new subcollection($this->notice->subcoll_id);
         $ed_obj = new editeur($collection->editeur);
         if ($this->print_mode) {
             $editeurs .= $ed_obj->isbd_entry;
             $collections = $collection->isbd_entry;
         } else {
             $editeurs .= $ed_obj->isbd_entry_lien_gestion;
             $collections = $collection->isbd_entry_lien_gestion;
         }
     } elseif ($this->notice->coll_id) {
         $collection = new collection($this->notice->coll_id);
         $ed_obj = new editeur($collection->parent);
         if ($this->print_mode) {
             $editeurs .= $ed_obj->isbd_entry;
             $collections = $collection->isbd_entry;
         } else {
             $editeurs .= $ed_obj->isbd_entry_lien_gestion;
             $collections = $collection->isbd_entry_lien_gestion;
         }
     } elseif ($this->notice->ed1_id) {
         $editeur = new editeur($this->notice->ed1_id);
         if ($this->print_mode) {
             $editeurs .= $editeur->isbd_entry;
         } else {
             $editeurs .= $editeur->isbd_entry_lien_gestion;
         }
     }
     if ($this->notice->ed2_id) {
         $editeur = new editeur($this->notice->ed2_id);
         if ($this->print_mode) {
             $ed_isbd = $editeur->isbd_entry;
         } else {
             $ed_isbd = $editeur->isbd_entry_lien_gestion;
         }
         $editeurs ? $editeurs .= '&nbsp;; ' . $ed_isbd : ($editeurs = $ed_isbd);
     }
     if ($this->notice->year) {
         $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year);
     } elseif ($this->notice->niveau_biblio != 'b') {
         $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]");
     }
     if ($editeurs) {
         $this->isbd .= ".&nbsp;-&nbsp;{$editeurs}";
     }
     // zone de la collation (ne concerne que a2)
     if ($this->notice->npages) {
         $collation = $this->notice->npages;
     }
     if ($this->notice->ill) {
         $collation .= ': ' . $this->notice->ill;
     }
     if ($this->notice->size) {
         $collation .= '; ' . $this->notice->size;
     }
     if ($this->notice->accomp) {
         $collation .= '+ ' . $this->notice->accomp;
     }
     if ($collation) {
         $this->isbd .= ".&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         if ($this->notice->nocoll) {
             $collections .= '; ' . $this->notice->nocoll;
         }
         $this->isbd .= ".&nbsp;-&nbsp;({$collections})" . ' ';
     }
     if (substr(trim($this->isbd), -1) != ".") {
         $this->isbd .= '.';
     }
     // note générale
     if ($this->notice->n_gen) {
         $zoneNote = nl2br(htmlentities($this->notice->n_gen, ENT_QUOTES, $charset)) . ' ';
     }
     // ISBN ou NO. commercial
     if ($this->notice->code) {
         if (isISBN($this->notice->code)) {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;ISBN ';
             } else {
                 $zoneNote = 'ISBN ';
             }
         } else {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;';
             }
         }
         $zoneNote .= $this->notice->code;
     }
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneNote .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneNote) {
                 $zoneNote .= '&nbsp; ' . $this->notice->prix;
             } else {
                 $zoneNote = $this->notice->prix;
             }
         }
     }
     if ($zoneNote) {
         $this->isbd .= "<br /><br />{$zoneNote}.";
     }
     //In
     //Recherche des notices parentes
     if (!$this->no_link) {
         $requete = "select linked_notice, relation_type, rank, l.niveau_biblio as lnb, l.niveau_hierar as lnh from notices_relations, notices as l where num_notice=" . $this->notice_id . " and linked_notice=l.notice_id order by relation_type,rank";
         $result_linked = pmb_mysql_query($requete) or die(pmb_mysql_error());
         //Si il y en a, on prépare l'affichage
         if (pmb_mysql_num_rows($result_linked)) {
             global $relation_listup;
             if (!$relation_listup) {
                 $relation_listup = new marc_list("relationtypeup");
             }
         }
         $r_type = array();
         $ul_opened = false;
         $r_type_local = "";
         //Pour toutes les notices liées
         while ($r_rel = pmb_mysql_fetch_object($result_linked)) {
             //Pour avoir le lien par défaut
             if (!$this->print_mode && SESSrights & CATALOGAGE_AUTH) {
                 $link_parent = $base_path . '/catalog.php?categ=isbd&id=!!id!!';
             } else {
                 $link_parent = "";
             }
             if ($r_rel->lnb == 's' && $r_rel->lnh == '1') {
                 // c'est une notice chapeau
                 global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial;
                 $link_serial_sub = $base_path . "/catalog.php?categ=serials&sub=view&serial_id=" . $r_rel->linked_notice;
                 // function serial_display ($id, $level='1', $action_serial='', $action_analysis='', $action_bulletin='', $lien_suppr_cart="", $lien_explnum="", $bouton_explnum=1,$print=0,$show_explnum=1, $show_statut=0, $show_opac_hidden_fields=true, $draggable=0 ) {
                 $serial = new serial_display($r_rel->linked_notice, 0, $link_serial_sub, $link_analysis, $link_bulletin, "", "", 0, $this->print_mode, $this->show_explnum, $this->show_statut, $this->show_opac_hidden_fields, 1, true);
                 $aff = $serial->header;
             } else {
                 if ($r_rel->lnb == 'a' && $r_rel->lnh == '2') {
                     // c'est un dépouillement de bulletin
                     global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial;
                     if (!$link_analysis) {
                         $link_analysis = $base_path . "/catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=!!bul_id!!&art_to_show=!!id!!";
                     }
                     $serial = new serial_display($r_rel->linked_notice, 0, $link_serial, $link_analysis, $link_bulletin, "", "", 0, $this->print_mode, $this->show_explnum, $this->show_statut, $this->show_opac_hidden_fields, 1, true);
                     $aff = $serial->result;
                 } else {
                     if ($link_parent && $r_rel->lnb == 'b' && $r_rel->lnh == '2') {
                         $requete = "SELECT bulletin_id FROM bulletins WHERE num_notice='" . $r_rel->linked_notice . "'";
                         $res = pmb_mysql_query($requete);
                         if (pmb_mysql_num_rows($res)) {
                             $link_parent = $base_path . "/catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . pmb_mysql_result($res, 0, 0);
                         }
                     }
                     // dans les autres cas
                     $parent_notice = new mono_display($r_rel->linked_notice, 0, $link_parent, 1, '', "", '', 0, $this->print_mode, $this->show_explnum, $this->show_statut, '', 1, true, $this->show_opac_hidden_fields, 0);
                     $aff = $parent_notice->header;
                     $this->nb_expl += $parent_notice->nb_expl;
                 }
             }
             //$parent_notice=new mono_display($r_rel->linked_notice,0,$link_parent);
             //Présentation différente si il y en a un ou plusieurs
             if (pmb_mysql_num_rows($result_linked) == 1) {
                 $this->isbd .= "<br /><b>" . $relation_listup->table[$r_rel->relation_type] . "</b> " . $aff . "<br />";
             } else {
                 if ($r_rel->relation_type != $r_type_local) {
                     $r_type_local = $r_rel->relation_type;
                     if ($ul_opened) {
                         $this->isbd .= "</ul>";
                         $this->isbd .= "\n<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>";
                         $this->isbd .= "\n<ul class='notice_rel'>\n";
                         $ul_opened = true;
                     } else {
                         $this->isbd .= "\n<br />";
                         $this->isbd .= "\n<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>";
                         $this->isbd .= "\n<ul class='notice_rel'>\n";
                         $ul_opened = true;
                     }
                 }
                 $this->isbd .= "\n<li>" . $aff . "</li>\n";
             }
         }
         if ($ul_opened) {
             $this->isbd .= "\n</ul>\n";
         }
     }
     if ($pmb_show_notice_id || $pmb_show_permalink) {
         $this->isbd .= "<br />";
     }
     if ($pmb_show_notice_id) {
         $prefixe = explode(",", $pmb_show_notice_id);
         $this->isbd .= "<b>" . $msg['notice_id_libelle'] . "&nbsp;</b>" . ($prefixe[1] ? $prefixe[1] : '') . $this->notice_id . "<br />";
     }
     // Permalink OPAC
     if ($pmb_show_permalink) {
         $this->isbd .= "<b>" . $msg["notice_permalink_opac"] . "&nbsp;</b><a href='" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "' target=\"__LINK__\">" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "</a><br />";
     }
     // niveau 1
     if ($this->level == 1) {
         if (!$this->print_mode) {
             $this->isbd .= "<!-- !!bouton_modif!! -->";
         }
         if ($this->expl) {
             $this->isbd .= "<br /><b>{$msg[285]}</b> (" . $this->nb_expl . ")";
             $this->isbd .= $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl);
         }
         if ($this->show_explnum) {
             $explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum);
             if ($explnum_assoc) {
                 $this->isbd .= "<b>{$msg['explnum_docs_associes']}</b>" . $explnum_assoc;
             }
         }
         if ($this->show_resa) {
             $aff_resa = resa_list($this->notice_id, 0, 0);
             if ($aff_resa) {
                 $this->isbd .= "<b>{$msg['resas']}</b>" . $aff_resa;
             }
         }
         if ($this->show_planning && $pmb_resa_planning) {
             $aff_resa_planning = planning_list($this->notice_id, 0, 0);
             if ($aff_resa_planning) {
                 $this->isbd .= "<b>{$msg['resas_planning']}</b>" . $aff_resa_planning;
             }
         }
         $this->simple_isbd = $this->isbd;
         $this->do_image($this->isbd);
         return;
     }
     // map
     if ($pmb_map_activate && $this->show_map) {
         $this->isbd .= $this->map->get_map();
     }
     if ($pmb_nomenclature_activate) {
         $nomenclature = new nomenclature_record_ui($this->notice_id);
         $this->isbd .= $nomenclature->get_isbd();
     }
     // résumé
     if ($this->notice->n_resume) {
         // $this->isbd .= "<br /><b>${msg[267]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_resume,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[267]}</b>&nbsp;: " . nl2br($this->notice->n_resume);
     }
     // note de contenu
     if ($this->notice->n_contenu) {
         // $this->isbd .= "<br /><b>${msg[266]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_contenu,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[266]}</b>&nbsp;: " . nl2br($this->notice->n_contenu);
     }
     // catégories
     $categ_repetables = array();
     if (!count($categories_top)) {
         $q = "select num_thesaurus,id_noeud from noeuds where num_parent in(select id_noeud from noeuds where autorite='TOP') ";
         $r = pmb_mysql_query($q, $dbh);
         while ($res = pmb_mysql_fetch_object($r)) {
             $categories_top[] = $res->id_noeud;
         }
     }
     $requete = "select * from (\n\t\tselect libelle_thesaurus, if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, noeuds.id_noeud , noeuds.num_parent, langue_defaut,id_thesaurus, if(catdef.langue = '" . $lang . "',2, if(catdef.langue= thesaurus.langue_defaut ,1,0)) as p, ordre_vedette, ordre_categorie\n\t\tFROM ((noeuds\n\t\tjoin thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus\n\t\tleft join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = thesaurus.langue_defaut\n\t\tleft join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "'))\n\t\t,notices_categories\n\t\twhere notices_categories.num_noeud=noeuds.id_noeud and\n\t\tnotices_categories.notcateg_notice=" . $this->notice_id . "\torder by id_thesaurus, noeuds.id_noeud, p desc\n\t\t) as list_categ group by id_noeud";
     if ($thesaurus_categories_affichage_ordre == 1) {
         $requete .= " order by ordre_vedette, ordre_categorie";
     }
     $result_categ = @pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($result_categ)) {
         while ($res_categ = pmb_mysql_fetch_object($result_categ)) {
             $libelle_thesaurus = $res_categ->libelle_thesaurus;
             $categ_id = $res_categ->id_noeud;
             $libelle_categ = $res_categ->categ_libelle;
             $num_parent = $res_categ->num_parent;
             $langue_defaut = $res_categ->langue_defaut;
             $categ_head = 0;
             if (in_array($categ_id, $categories_top)) {
                 $categ_head = 1;
             }
             if ($thesaurus_categories_show_only_last || $categ_head) {
                 if ($use_opac_url_base) {
                     $url_base_lien_aut = $opac_url_base . "index.php?&lvl=categ_see&id=";
                 } else {
                     $url_base_lien_aut = $base_path . "/autorites.php?categ=categories&sub=categ_form&id=";
                 }
                 if ((SESSrights & AUTORITES_AUTH || $use_opac_url_base) && !$this->print_mode) {
                     $libelle_aff_complet = "<a href='" . $url_base_lien_aut . $categ_id . "' class='lien_gestion'>" . $libelle_categ . "</a>";
                 } else {
                     $libelle_aff_complet = $libelle_categ;
                 }
                 if ($thesaurus_mode_pmb) {
                     $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                 } else {
                     $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                 }
             } else {
                 if (!$categories_memo[$categ_id]) {
                     $anti_recurse[$categ_id] = 1;
                     $path_table = '';
                     $requete = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle, num_renvoi_voir as categ_see, note_application as categ_comment, if(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $num_parent . "'\n\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud\n\t\t\t\t\t\torder by p desc limit 1";
                     $result = @pmb_mysql_query($requete);
                     if (pmb_mysql_num_rows($result)) {
                         $parent = pmb_mysql_fetch_object($result);
                         $anti_recurse[$parent->categ_id] = 1;
                         $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                         // on remonte les ascendants
                         while ($parent->categ_parent && !$anti_recurse[$parent->categ_parent]) {
                             $requete = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle,\tnum_renvoi_voir as categ_see, note_application as categ_comment, if(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $parent->categ_parent . "'\n\t\t\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud\n\t\t\t\t\t\t\t\torder by p desc limit 1";
                             $result = @pmb_mysql_query($requete);
                             if (pmb_mysql_num_rows($result)) {
                                 $parent = pmb_mysql_fetch_object($result);
                                 $anti_recurse[$parent->categ_id] = 1;
                                 $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                             } else {
                                 break;
                             }
                         }
                         $anti_recurse = array();
                     } else {
                         $path_table = array();
                     }
                     // ceci remet le tableau dans l'ordre général->particulier
                     $path_table = array_reverse($path_table);
                     if (sizeof($path_table)) {
                         $temp_table = '';
                         while (list($xi, $l) = each($path_table)) {
                             $temp_table[] = $l['libelle'];
                         }
                         $parent_libelle = join(':', $temp_table);
                         $catalog_form = $parent_libelle . ':' . $libelle_categ;
                     } else {
                         $catalog_form = $libelle_categ;
                     }
                     if ($use_opac_url_base) {
                         $url_base_lien_aut = $opac_url_base . "index.php?&lvl=categ_see&id=";
                     } else {
                         $url_base_lien_aut = $base_path . "/autorites.php?categ=categories&sub=categ_form&id=";
                     }
                     if ((SESSrights & AUTORITES_AUTH || $use_opac_url_base) && !$this->print_mode) {
                         $libelle_aff_complet = "<a href='" . $url_base_lien_aut . $categ_id . "' class='lien_gestion'>" . $catalog_form . "</a>";
                     } else {
                         $libelle_aff_complet = $catalog_form;
                     }
                     if ($thesaurus_mode_pmb) {
                         $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                     }
                     $categories_memo[$categ_id] = $libelle_aff_complet;
                     $libelle_thesaurus_memo[$categ_id] = $libelle_thesaurus;
                 } else {
                     if ($thesaurus_mode_pmb) {
                         $categ_repetables[$libelle_thesaurus_memo[$categ_id]][] = $categories_memo[$categ_id];
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $categories_memo[$categ_id];
                     }
                 }
             }
         }
     }
     while (list($nom_tesaurus, $val_lib) = each($categ_repetables)) {
         //c'est un tri par libellé qui est demandé
         if ($thesaurus_categories_affichage_ordre == 0) {
             $tmp = array();
             foreach ($val_lib as $key => $value) {
                 $tmp[$key] = strip_tags($value);
             }
             $tmp = array_map("convert_diacrit", $tmp);
             //On enlève les accents
             $tmp = array_map("strtoupper", $tmp);
             //On met en majuscule
             asort($tmp);
             //Tri sur les valeurs en majuscule sans accent
             foreach ($tmp as $key => $value) {
                 $tmp[$key] = $val_lib[$key];
                 //On reprend les bons couples clé / libellé
             }
             $val_lib = $tmp;
         }
         if ($thesaurus_mode_pmb) {
             if (!$thesaurus_categories_categ_in_line) {
                 $categ_repetables_aff = "[" . $nom_tesaurus . "]" . implode("<br />[" . $nom_tesaurus . "]", $val_lib);
             } else {
                 $categ_repetables_aff = "<b>" . $nom_tesaurus . "</b><br />" . implode(" {$pmb_keyword_sep} ", $val_lib);
             }
         } else {
             if (!$thesaurus_categories_categ_in_line) {
                 $categ_repetables_aff = implode("<br />", $val_lib);
             } else {
                 $categ_repetables_aff = implode(" {$pmb_keyword_sep} ", $val_lib);
             }
         }
         if ($categ_repetables_aff) {
             $tmpcateg_aff .= "<br />{$categ_repetables_aff}";
         }
     }
     if ($tmpcateg_aff) {
         $this->isbd .= "<br />{$tmpcateg_aff}";
     }
     // Concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->notice_id, TYPE_NOTICE);
         $this->isbd .= $index_concept->get_isbd_display();
     }
     // langues
     if (count($this->langues)) {
         $langues = "<b>{$msg[537]}</b>&nbsp;: " . construit_liste_langues($this->langues);
     }
     if (count($this->languesorg)) {
         $langues .= " <b>{$msg[711]}</b>&nbsp;: " . construit_liste_langues($this->languesorg);
     }
     if ($langues) {
         $this->isbd .= "<br />{$langues}";
     }
     // indexation libre
     if ($this->notice->index_l) {
         $this->isbd .= "<br /><b>{$msg[324]}</b>&nbsp;: " . nl2br($this->notice->index_l);
     }
     // indexation interne
     if ($this->notice->indexint) {
         $indexint = new indexint($this->notice->indexint);
         if ($this->print_mode) {
             $indexint_isbd = $indexint->display;
         } else {
             $indexint_isbd = $indexint->isbd_entry_lien_gestion;
         }
         $this->isbd .= "<br /><b>{$msg[indexint_catal_title]}</b>&nbsp;: " . $indexint_isbd;
     }
     $tu = new tu_notice($this->notice_id);
     if ($tu_liste = $tu->get_print_type(1)) {
         $this->isbd .= "<br />" . $tu_liste;
     }
     $authperso = new authperso_notice($this->notice_id);
     $this->isbd .= $authperso->get_notice_display();
     //Champs personalisés
     $perso_aff = "";
     if (!$this->p_perso->no_special_fields) {
         $perso_ = $this->p_perso->show_fields($this->notice_id);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             // ajout de && ($p['OPAC_SHOW']||$this->show_opac_hidden_fields) afin de masquer les champs masqués de l'OPAC en diff de bannette.
             if ($p["AFF"] && ($p['OPAC_SHOW'] || $this->show_opac_hidden_fields)) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $this->isbd .= $perso_aff;
     }
     //Notices liées
     if (count($this->childs) && !$this->print_mode && !$this->no_link) {
         $link = $base_path . '/catalog.php?categ=isbd&id=!!id!!';
         $link_expl = $base_path . '/catalog.php?categ=edit_expl&id=!!notice_id!!&cb=!!expl_cb!!&expl_id=!!expl_id!!';
         $link_explnum = $base_path . '/catalog.php?categ=edit_explnum&id=!!notice_id!!&explnum_id=!!explnum_id!!';
         global $relation_typedown;
         if (!$relation_typedown) {
             $relation_typedown = new marc_list("relationtypedown");
         }
         reset($this->childs);
         if (!$load_tablist_js) {
             $aff_childs = "<script type='text/javascript' src='" . $base_path . "/javascript/tablist.js'></script>\n";
         }
         $aff_childs .= "<br />";
         $load_tablist_js = 1;
         $anti_loop = $this->anti_loop;
         $anti_loop[] = $this->notice_id;
         $n_childs = 0;
         while ((list($rel_type, $child_notices) = each($this->childs)) && $n_childs < 100) {
             $aff_childs .= "<b>" . $relation_typedown->table[$rel_type] . "</b>";
             $aff_childs .= "<blockquote>";
             if ($pmb_notice_fille_format) {
                 $aff_childs .= "<ul class='notice_rel'>";
             }
             for ($i = 0; $i < count($child_notices); $i++) {
                 $as = array_search($child_notices[$i], $anti_loop);
                 if ($as === false) {
                     global $pmb_notice_fille_format;
                     if ($pmb_notice_fille_format) {
                         $level_fille = 0;
                     } else {
                         $level_fille = 6;
                     }
                     // il faut aller chercher le niveau biblio et niveau hierar de la notice liée
                     $requete_nbnh = "select l.niveau_biblio as lnb, l.niveau_hierar as lnh, rank from notices as l join notices_relations on num_notice=notice_id where notice_id='" . $child_notices[$i] . "' ";
                     $r_rel = pmb_mysql_fetch_object(pmb_mysql_query($requete_nbnh));
                     if ($r_rel->rank != $i) {
                         $req = "update notices_relations set rank='{$i}' where num_notice='" . $child_notices[$i] . "' and relation_type='" . $rel_type . "' and linked_notice='" . $anti_loop[count($serial->anti_loop) - 1] . "'";
                         pmb_mysql_query($req, $dbh);
                     }
                     if ($r_rel->lnb == 's' && $r_rel->lnh == '1') {
                         // c'est une notice de pério
                         global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial;
                         $link_serial_sub = $base_path . "/catalog.php?categ=serials&sub=view&serial_id=" . $child_notices[$i];
                         $serial = new serial_display($child_notices[$i], $level_fille, $link_serial_sub, $link_analysis, $link_bulletin, "", $link_explnum_serial, 0, $this->print_mode, 1, 1, 1, 0, 0, $anti_loop);
                         if (count($serial->anti_loop) == 1 && $sort_children) {
                             //Drag pour tri des notices filles
                             $id_elt = $serial->notice_id . ($serial->anti_loop ? "_p" . implode("_", $serial->anti_loop) : "");
                             $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($serial->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($serial->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\" >";
                             $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>";
                             $affichage_result = $serial->result;
                         } else {
                             $drag_fille = "";
                             $affichage_result = $pmb_notice_fille_format ? "<li>" . $serial->result . "</li>" : $serial->result;
                         }
                         $aff = $drag_fille . $affichage_result;
                         if ($drag_fille) {
                             $aff .= "</div>";
                         }
                     } else {
                         if ($r_rel->lnb == 'a' && $r_rel->lnh == '2') {
                             // c'est un dépouillement de bulletin
                             global $link_serial, $link_analysis, $link_bulletin, $link_explnum_analysis;
                             $serial = new serial_display($child_notices[$i], $level_fille, $link_serial, $link_analysis, $link_bulletin, "", $link_explnum_analysis, 0, 0, 1, 1, 1, 0, 0, $anti_loop);
                             if (count($serial->anti_loop) == 1 && $sort_children) {
                                 //Drag pour tri des notices filles
                                 $id_elt = $serial->notice_id . ($serial->anti_loop ? "_p" . implode("_", $serial->anti_loop) : "");
                                 $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($serial->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($serial->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\">";
                                 $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>";
                                 $affichage_result = $serial->result;
                             } else {
                                 $drag_fille = "";
                                 $affichage_result = $pmb_notice_fille_format ? "<li>" . $serial->result . "</li>" : $serial->result;
                             }
                             $aff = $drag_fille . $affichage_result;
                             if ($drag_fille) {
                                 $aff .= "</div>";
                             }
                         } else {
                             $display = new mono_display($child_notices[$i], $level_fille, $link, 1, $link_expl, '', $link_explnum, 1, 0, 1, 1, $anti_loop, $this->drag, false, true, 0, 1, 0);
                             if (count($display->anti_loop) == 1 && $sort_children) {
                                 //Drag pour tri des notices filles
                                 $id_elt = $display->notice_id . ($display->anti_loop ? "_p" . implode("_", $display->anti_loop) : "");
                                 $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($display->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($display->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\">";
                                 $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>";
                                 $affichage_result = $display->result;
                             } else {
                                 $drag_fille = "";
                                 $affichage_result = $pmb_notice_fille_format ? "<li>" . $display->result . "</li>" : $display->result;
                             }
                             $display->result = str_replace("<!-- !!bouton_modif!! -->", " ", $display->result);
                             $aff = $drag_fille . $affichage_result;
                             $this->nb_expl += $display->nb_expl;
                             if ($drag_fille) {
                                 $aff .= "</div>";
                             }
                         }
                     }
                     $aff_childs .= $aff;
                 }
                 $n_childs++;
             }
             $aff_childs .= ($pmb_notice_fille_format ? "</ul>" : "") . "</blockquote>";
         }
         $this->isbd .= $aff_childs;
     }
     if (!$this->print_mode && !$this->anti_loop) {
         $this->isbd .= "<!-- !!bouton_modif!! -->";
     }
     $this->do_image($this->isbd);
     if (!$this->anti_loop) {
         $this->isbd .= "<!-- !!avis_notice!! -->";
     }
     if ($this->expl) {
         if ($this->notice->niveau_biblio == 'b' && $this->notice->niveau_hierar == 2) {
             // on est face à une notice de bulletin
             $requete = "select bulletin_id from bulletins where num_notice=" . $this->notice->notice_id;
             $result = @pmb_mysql_query($requete);
             if (pmb_mysql_num_rows($result)) {
                 $bull = pmb_mysql_fetch_object($result);
                 $expl_aff = $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl, $bull->bulletin_id);
             }
         } else {
             $expl_aff = $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl);
         }
         if ($expl_aff) {
             $this->isbd .= "<br /><b>{$msg[285]} </b>(" . $this->nb_expl . ")";
             $this->isbd .= $expl_aff;
         }
     }
     if ($this->show_explnum) {
         $explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum);
         if ($explnum_assoc) {
             $this->isbd .= "<b>{$msg['explnum_docs_associes']}</b> (" . show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum, array(), true) . ")" . $explnum_assoc;
         }
     }
     //documents numériques en relation...
     $explnum_in_relation = show_explnum_in_relation($this->notice->notice_id, $this->link_explnum);
     if ($explnum_in_relation) {
         $this->isbd .= "<b>" . $msg["explnum_docs_in_relation"] . "</b>" . $explnum_in_relation;
     }
     //reservations et previsions
     if ($this->show_resa || $this->show_planning && $pmb_resa_planning) {
         $rqt_nt = "select count(*) from exemplaires, notices, docs_statut where exemplaires.expl_statut=docs_statut.idstatut and notices.notice_id=exemplaires.expl_notice and statut_allow_resa=1 and notices.notice_id=" . $this->notice_id;
         $result = pmb_mysql_query($rqt_nt, $dbh) or die($rqt_nt . " " . pmb_mysql_error());
         $nb_expl_reservables = pmb_mysql_result($result, 0, 0);
         if ($this->show_resa) {
             $aff_resa = resa_list($this->notice_id, 0, 0);
             $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_from_catal&id_notice=" . $this->notice_id . "'; return(false) \"";
             if ($aff_resa) {
                 $this->isbd .= "<b>" . $msg['resas'] . "</b><br />";
                 if ($nb_expl_reservables && !($categ == "resa") && !$id_empr) {
                     $this->isbd .= "<input type='button' class='bouton' value='" . $msg['351'] . "' {$ouvrir_reserv}><br /><br />";
                 }
                 $this->isbd .= $aff_resa . "<br />";
             } else {
                 if ($nb_expl_reservables && !($categ == "resa") && !$id_empr) {
                     $this->isbd .= "<b>" . $msg['resas'] . "</b><br /><input type='button' class='bouton' value='" . $msg['351'] . "' {$ouvrir_reserv}><br /><br />";
                 }
             }
         }
         if ($this->show_planning && $pmb_resa_planning) {
             $aff_resa_planning = planning_list($this->notice_id, 0, 0);
             $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_planning_from_catal&id_notice=" . $this->notice_id . "'; return(false) \"";
             if ($aff_resa_planning) {
                 $this->isbd .= "<b>" . $msg['resas_planning'] . "</b><br />";
                 if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr) {
                     $this->isbd .= "<input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />";
                 }
                 $this->isbd .= $aff_resa_planning . "<br />";
             } else {
                 if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr) {
                     $this->isbd .= "<b>" . $msg['resas_planning'] . "</b><br /><input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />";
                 }
             }
         }
     }
     return;
 }
Пример #30
0
function creer_notice_monographie($ancien_id = 0, $titre = "", $code = "")
{
    global $notices_crees, $dbh, $statutnot;
    global $isbn_dedoublonnage, $isbn_only;
    if ($isbn_dedoublonnage && !$isbn_only || $isbn_dedoublonnage && $isbn_only && isISBN($code)) {
        // Si dédoublonnage sur ISBN activé
        $requete = "SELECT notice_id FROM notices WHERE niveau_biblio='m' and niveau_hierar='0' AND code='" . addslashes($code) . "' ";
        $res = mysql_query($requete, $dbh);
        if ($res && mysql_num_rows($res) == 1) {
            //J'ai déjà une notice dans la base avec ce code barre
            $id = mysql_result($res, 0, 0);
            $notices_crees[$ancien_id] = $id;
            return $id;
        }
    }
    $requete = "insert into notices (tit1, code, niveau_biblio, niveau_hierar,statut) values ('" . addslashes($titre) . "','" . addslashes($code) . "', 'm', '0','" . $statutnot . "')";
    mysql_query($requete, $dbh);
    $id = mysql_insert_id();
    audit::insert_creation(AUDIT_NOTICE, $id);
    // Mise à jour des index de la notice
    notice::majNotices($id);
    // Mise à jour de la table "notices_global_index"
    notice::majNoticesGlobalIndex($id);
    // Mise à jour de la table "notices_mots_global_index"
    notice::majNoticesMotsGlobalIndex($id);
    $notices_crees[$ancien_id] = $id;
    return $id;
}