Beispiel #1
0
 function make_serialized_human_query($serialized)
 {
     //global $search;
     global $msg;
     global $charset;
     global $include_path;
     $to_unserialize = unserialize($serialized);
     $search = $to_unserialize["SEARCH"];
     for ($i = 0; $i < count($search); $i++) {
         $op = "op_" . $i . "_" . $search[$i];
         $field_ = "field_" . $i . "_" . $search[$i];
         $inter = "inter_" . $i . "_" . $search[$i];
         $fieldvar = "fieldvar_" . $i . "_" . $search[$i];
         if (!isset($GLOBALS[${$op}])) {
             global ${$op};
         }
         if (!isset($GLOBALS[${$field_}])) {
             global ${$field_};
         }
         if (!isset($GLOBALS[${$inter}])) {
             global ${$inter};
         }
         if (!isset($GLOBALS[${$fieldvar}])) {
             global ${$fieldvar};
         }
         ${$op} = $to_unserialize[$i]["OP"];
         ${$field_} = $to_unserialize[$i]["FIELD"];
         ${$inter} = $to_unserialize[$i]["INTER"];
         ${$fieldvar} = $to_unserialize[$i]["FIELDVAR"];
     }
     $r = "";
     for ($i = 0; $i < count($search); $i++) {
         $s = explode("_", $search[$i]);
         if ($s[0] == "f") {
             $title = $this->fixedfields[$s[1]]["TITLE"];
         } elseif (array_key_exists($s[0], $this->pp)) {
             $title = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"];
         } elseif ($s[0] == "s") {
             $title = $this->specialfields[$s[1]]["TITLE"];
         }
         $op = "op_" . $i . "_" . $search[$i];
         $operator = $this->operators[${$op}];
         $field_ = "field_" . $i . "_" . $search[$i];
         $field = ${$field_};
         //Recuperation des variables auxiliaires
         $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i];
         $fieldvar = ${$fieldvar_};
         if (!is_array($fieldvar)) {
             $fieldvar = array();
         }
         $field_aff = array();
         if (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}]];
             if ($q["DEFAULT_OPERATOR"]) {
                 $operator_multi = $q["DEFAULT_OPERATOR"];
             }
             for ($j = 0; $j < count($field); $j++) {
                 $field_aff[$j] = $this->pp[$s[0]]->get_formatted_output(array(0 => $field[$j]), $s[1]);
             }
         } elseif ($s[0] == "f") {
             $ff = $this->fixedfields[$s[1]];
             $q_index = $ff["QUERIES_INDEX"];
             $q = $ff["QUERIES"][$q_index[${$op}]];
             if ($fieldvar["operator_between_multiple_authorities"]) {
                 $operator_multi = $fieldvar["operator_between_multiple_authorities"][0];
             } else {
                 if ($q["DEFAULT_OPERATOR"]) {
                     $operator_multi = $q["DEFAULT_OPERATOR"];
                 }
             }
             switch ($this->fixedfields[$s[1]]["INPUT_TYPE"]) {
                 case "list":
                     $options = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["OPTIONS"][0];
                     $opt = array();
                     for ($j = 0; $j < count($options["OPTION"]); $j++) {
                         if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") {
                             $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)];
                         } else {
                             $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"];
                         }
                     }
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt[$field[$j]];
                     }
                     break;
                 case "query_list":
                     $requete = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"];
                     if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["FILTERING"] == "yes") {
                         $requete = str_replace("!!acces_j!!", "", $requete);
                         $requete = str_replace("!!statut_j!!", "", $requete);
                         $requete = str_replace("!!statut_r!!", "", $requete);
                     }
                     if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) {
                         $use_global = explode(",", $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]);
                         for ($j = 0; $j < count($use_global); $j++) {
                             $var_global = $use_global[$j];
                             global ${$var_global};
                             $requete = str_replace("!!" . $var_global . "!!", ${$var_global}, $requete);
                         }
                     }
                     $resultat = pmb_mysql_query($requete);
                     $opt = array();
                     while ($r_ = @pmb_mysql_fetch_row($resultat)) {
                         $opt[$r_[0]] = $r_[1];
                     }
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt[$field[$j]];
                     }
                     break;
                 case "marc_list":
                     $opt = new marc_list($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]);
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt->table[$field[$j]];
                     }
                     break;
                 case "date":
                     $field_aff[0] = format_date($field[0]);
                     break;
                 case "authoritie":
                     for ($j = 0; $j < sizeof($field); $j++) {
                         if (is_numeric($field[$j]) && ${$op} == "AUTHORITY") {
                             switch ($ff['INPUT_OPTIONS']['SELECTOR']) {
                                 case "categorie":
                                     $field[$j] = categories::getlibelle($field[$j], $lang);
                                     break;
                                 case "auteur":
                                     $aut = new auteur($field[$j]);
                                     if ($aut->rejete) {
                                         $field[$j] = $aut->name . ', ' . $aut->rejete;
                                     } else {
                                         $field[$j] = $aut->name;
                                     }
                                     if ($aut->date) {
                                         $field[$j] .= " ({$aut->date})";
                                     }
                                     break;
                                 case "editeur":
                                     $ed = new editeur($field[$j]);
                                     $field[$j] = $ed->name;
                                     if ($ed->ville) {
                                         if ($ed->pays) {
                                             $field[$j] .= " ({$ed->ville} - {$ed->pays})";
                                         } else {
                                             $field[$j] .= " ({$ed->ville})";
                                         }
                                     }
                                     break;
                                 case "collection":
                                     $coll = new collection($field[$j]);
                                     $field[$j] = $coll->name;
                                     break;
                                 case "subcollection":
                                     $coll = new subcollection($field[$j]);
                                     $field[$j] = $coll->name;
                                     break;
                                 case "serie":
                                     $serie = new serie($field[$j]);
                                     $field[$j] = $serie->name;
                                     break;
                                 case "indexint":
                                     $indexint = new indexint($field[$j]);
                                     if ($indexint->comment) {
                                         $field[$j] = $indexint->name . " - " . $indexint->comment;
                                     } else {
                                         $field[$j] = $indexint->name;
                                     }
                                     if ($thesaurus_classement_mode_pmb != 0) {
                                         $field[$j] = "[" . $indexint->name_pclass . "] " . $field[$j];
                                     }
                                     break;
                                 case "titre_uniforme":
                                     $tu = new titre_uniforme($field[$j]);
                                     $field[$j] = $tu->name;
                                     break;
                                 case "notice":
                                     $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' ";
                                     $res = pmb_mysql_query($requete);
                                     if ($res && pmb_mysql_num_rows($res)) {
                                         $field[$j] = pmb_mysql_result($res, 0, 0);
                                     }
                                     break;
                             }
                         }
                     }
                     $field_aff = $field;
                     break;
                 default:
                     $field_aff = $field;
                     break;
             }
         } elseif ($s[0] == "s") {
             //appel de la fonction make_human_query de la classe du champ special
             //Recherche du type
             $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);
                     $field_aff = $specialclass->make_human_query();
                     $field_aff[0] = html_entity_decode(strip_tags($field_aff[0]), ENT_QUOTES, $charset);
                     break;
                 }
             }
         }
         //Ajout des variables si necessaire
         reset($fieldvar);
         $fieldvar_aff = array();
         while (list($var_name, $var_value) = each($fieldvar)) {
             //Recherche de la variable par son nom
             $vvar = $this->fixedfields[$s[1]]["VAR"];
             for ($j = 0; $j < count($vvar); $j++) {
                 if ($vvar[$j]["TYPE"] == "input" && $vvar[$j]["NAME"] == $var_name) {
                     //Calcul de la visibilite
                     $varname = $vvar[$j]["NAME"];
                     $visibility = 1;
                     $vis = $vvar[$j]["OPTIONS"]["VAR"][0];
                     if ($vis["NAME"]) {
                         $vis_name = $vis["NAME"];
                         global ${$vis_name};
                         if ($vis["VISIBILITY"] == "no") {
                             $visibility = 0;
                         }
                         for ($k = 0; $k < count($vis["VALUE"]); $k++) {
                             if ($vis["VALUE"][$k]["value"] == ${$vis_name}) {
                                 if ($vis["VALUE"][$k]["VISIBILITY"] == "no") {
                                     $sub_vis = 0;
                                 } else {
                                     $sub_vis = 1;
                                 }
                                 if ($vis["VISIBILITY"] == "no") {
                                     $visibility |= $sub_vis;
                                 } else {
                                     $visibility &= $sub_vis;
                                 }
                                 break;
                             }
                         }
                     }
                     $var_list_aff = array();
                     $flag_aff = false;
                     if ($visibility) {
                         switch ($vvar[$j]["OPTIONS"]["INPUT"][0]["TYPE"]) {
                             case "query_list":
                                 $query_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["value"];
                                 $r_list = pmb_mysql_query($query_list);
                                 while ($line = pmb_mysql_fetch_array($r_list)) {
                                     $as = array_search($line[0], $var_value);
                                     if ($as !== false && $as !== NULL) {
                                         $var_list_aff[] = $line[1];
                                     }
                                 }
                                 if ($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["ALLCHOICE"] == "yes" && count($var_list_aff) == 0) {
                                     $var_list_aff[] = $msg[substr($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"], 4, strlen($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"]) - 4)];
                                 }
                                 $fieldvar_aff[] = implode(" " . $msg["search_or"] . " ", $var_list_aff);
                                 $flag_aff = true;
                                 break;
                             case "checkbox":
                                 $value = $var_value[0];
                                 $label_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["COMMENTS"][0]["LABEL"];
                                 for ($indice = 0; $indice < count($label_list); $indice++) {
                                     if ($value == $label_list[$indice]["VALUE"]) {
                                         $libelle = $label_list[$indice]["value"];
                                         break;
                                     }
                                 }
                                 $fieldvar_aff[] = $libelle;
                                 $flag_aff = true;
                                 break;
                         }
                         if ($flag_aff) {
                             $fieldvar_aff[count($fieldvar_aff) - 1] = $vvar[$j]["COMMENT"] . " : " . $fieldvar_aff[count($fieldvar_aff) - 1];
                         }
                     }
                 }
             }
         }
         switch ($operator_multi) {
             case "and":
                 $op_list = $msg["search_and"];
                 break;
             case "or":
                 $op_list = $msg["search_or"];
                 break;
             default:
                 $op_list = $msg["search_or"];
                 break;
         }
         $texte = implode(" " . $op_list . " ", $field_aff);
         //$texte=implode(" ".$msg["search_or"]." ",$field_aff);
         if (count($fieldvar_aff)) {
             $texte .= " [" . implode(" ; ", $fieldvar_aff) . "]";
         }
         $inter = "inter_" . $i . "_" . $search[$i];
         switch (${$inter}) {
             case "and":
                 $inter_op = $msg["search_and"];
                 break;
             case "or":
                 $inter_op = $msg["search_or"];
                 break;
             case "ex":
                 $inter_op = $msg["search_exept"];
                 break;
             default:
                 $inter_op = "";
                 break;
         }
         if ($inter_op) {
             $inter_op = "<strong>" . htmlentities($inter_op, ENT_QUOTES, $charset) . "</strong>";
         }
         $r .= $inter_op . " <i><strong>" . htmlentities($title, ENT_QUOTES, $charset) . "</strong> " . htmlentities($operator, ENT_QUOTES, $charset) . " (" . htmlentities($texte, ENT_QUOTES, $charset) . ")</i> ";
     }
     return $r;
 }
 function getAuthorityLabel($id, $type)
 {
     global $lang;
     switch ($type) {
         case "author":
             $aut = new auteur($id);
             if ($aut->rejete) {
                 $libelle = $aut->name . ', ' . $aut->rejete;
             } else {
                 $libelle = $aut->name;
             }
             if ($aut->date) {
                 $libelle .= " ({$aut->author_date})";
             }
             break;
         case "category":
             $libelle = categories::getlibelle($id, $lang);
             break;
         case "publisher":
             $ed = new publisher($id);
             $libelle = $ed->name;
             if ($ed->ville) {
                 if ($ed->pays) {
                     $libelle .= " ({$ed->ville} - {$ed->pays})";
                 } else {
                     $libelle .= " ({$ed->ville})";
                 }
             }
             break;
         case "collection":
             $coll = new collection($id);
             $libelle = $coll->name;
             break;
         case "subcollection":
             $coll = new subcollection($id);
             $libelle = $coll->name;
             break;
         case "serie":
             $serie = new serie($id);
             $libelle = $serie->name;
             break;
         case "indexint":
             $indexint = new indexint($id);
             $libelle = $indexint->display;
             break;
         case "titre_uniforme":
             $tu = new titre_uniforme($id);
             $libelle = $tu->name;
             break;
         default:
             $libelle = "";
             break;
     }
     return $libelle;
 }
 protected function get_human_field($field, $values)
 {
     global $msg, $charset;
     switch ($field["INPUT_TYPE"]) {
         case "list":
             $options = $field["INPUT_OPTIONS"]["OPTIONS"][0];
             $opt = array();
             for ($j = 0; $j < count($options["OPTION"]); $j++) {
                 if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") {
                     $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)];
                 } else {
                     $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"];
                 }
             }
             for ($j = 0; $j < count($values); $j++) {
                 $field_aff[$j] = $opt[$values[$j]];
             }
             break;
         case "query_list":
             $requete = $field["INPUT_OPTIONS"]["QUERY"][0]["value"];
             if ($field["FILTERING"] == "yes") {
                 $requete = str_replace("!!acces_j!!", "", $requete);
                 $requete = str_replace("!!statut_j!!", "", $requete);
                 $requete = str_replace("!!statut_r!!", "", $requete);
             }
             if ($field["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) {
                 $use_global = explode(",", $field["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]);
                 for ($j = 0; $j < count($use_global); $j++) {
                     $var_global = $use_global[$j];
                     global ${$var_global};
                     $requete = str_replace("!!" . $var_global . "!!", ${$var_global}, $requete);
                 }
             }
             $resultat = pmb_mysql_query($requete);
             $opt = array();
             while ($r_ = @pmb_mysql_fetch_row($resultat)) {
                 $opt[$r_[0]] = $r_[1];
             }
             for ($j = 0; $j < count($values); $j++) {
                 $field_aff[$j] = $opt[$values[$j]];
             }
             break;
         case "marc_list":
             $opt = new marc_list($field["INPUT_OPTIONS"]["NAME"][0]["value"]);
             for ($j = 0; $j < count($values); $j++) {
                 $field_aff[$j] = $opt->table[$values[$j]];
             }
             break;
         case "date":
             $field_aff[0] = format_date($values[0]);
             break;
         case "authoritie":
             for ($j = 0; $j < sizeof($values); $j++) {
                 if (is_numeric($values[$j]) && ${$op} == "AUTHORITY") {
                     switch ($field['INPUT_OPTIONS']['SELECTOR']) {
                         case "categorie":
                             $thes = thesaurus::getByEltId($values[$j]);
                             $values[$j] = categories::getlibelle($values[$j], $lang) . " [" . $thes->libelle_thesaurus . "]";
                             if (isset($fieldvar["id_thesaurus"])) {
                                 unset($fieldvar["id_thesaurus"]);
                             }
                             break;
                         case "auteur":
                             $aut = new auteur($values[$j]);
                             if ($aut->rejete) {
                                 $values[$j] = $aut->name . ', ' . $aut->rejete;
                             } else {
                                 $values[$j] = $aut->name;
                             }
                             if ($aut->date) {
                                 $values[$j] .= " ({$aut->date})";
                             }
                             break;
                         case "editeur":
                             $ed = new editeur($values[$j]);
                             $values[$j] = $ed->name;
                             if ($ed->ville) {
                                 if ($ed->pays) {
                                     $values[$j] .= " ({$ed->ville} - {$ed->pays})";
                                 } else {
                                     $values[$j] .= " ({$ed->ville})";
                                 }
                             }
                             break;
                         case "collection":
                             $coll = new collection($values[$j]);
                             $values[$j] = $coll->name;
                             break;
                         case "subcollection":
                             $coll = new subcollection($values[$j]);
                             $values[$j] = $coll->name;
                             break;
                         case "serie":
                             $serie = new serie($values[$j]);
                             $values[$j] = $serie->name;
                             break;
                         case "indexint":
                             $indexint = new indexint($values[$j]);
                             if ($indexint->comment) {
                                 $values[$j] = $indexint->name . " - " . $indexint->comment;
                             } else {
                                 $values[$j] = $indexint->name;
                             }
                             if ($thesaurus_classement_mode_pmb != 0) {
                                 $values[$j] = "[" . $indexint->name_pclass . "] " . $values[$j];
                             }
                             break;
                         case "titre_uniforme":
                             $tu = new titre_uniforme($values[$j]);
                             $values[$j] = $tu->name;
                             break;
                         case "notice":
                             $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' ";
                             $res = pmb_mysql_query($requete);
                             if ($res && pmb_mysql_num_rows($res)) {
                                 $values[$j] = pmb_mysql_result($res, 0, 0);
                             }
                             break;
                     }
                 }
             }
             $field_aff = $values;
             break;
         default:
             $field_aff[0] = $values[0];
             break;
     }
     return '<b>' . get_msg_to_display($field['TITLE']) . '</b> ' . implode(' ', $field_aff);
 }
Beispiel #4
0
 function make_serialized_human_query($serialized)
 {
     //global $search;
     global $msg;
     global $charset;
     $to_unserialize = unserialize($serialized);
     $search = $to_unserialize["SEARCH"];
     for ($i = 0; $i < count($search); $i++) {
         $op = "op_" . $i . "_" . $search[$i];
         $field_ = "field_" . $i . "_" . $search[$i];
         $inter = "inter_" . $i . "_" . $search[$i];
         $fieldvar = "fieldvar_" . $i . "_" . $search[$i];
         ${$op} = $to_unserialize[$i]["OP"];
         ${$field_} = $to_unserialize[$i]["FIELD"];
         ${$inter} = $to_unserialize[$i]["INTER"];
         ${$fieldvar} = $to_unserialize[$i]["FIELDVAR"];
     }
     $r = "";
     for ($i = 0; $i < count($search); $i++) {
         $s = explode("_", $search[$i]);
         if ($s[0] == "f") {
             $title = $this->fixedfields[$s[1]]["TITLE"];
         } elseif (array_key_exists($s[0], $this->pp)) {
             $title = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"];
         } elseif ($s[0] == "s") {
             $title = $this->specialfields[$s[1]]["TITLE"];
         }
         $op = "op_" . $i . "_" . $search[$i];
         $operator = $this->operators[${$op}];
         $field_ = "field_" . $i . "_" . $search[$i];
         $field = ${$field_};
         //Recuperation des variables auxiliaires
         $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i];
         $fieldvar = ${$fieldvar_};
         if (!is_array($fieldvar)) {
             $fieldvar = array();
         }
         $field_aff = array();
         if (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}]];
             if ($q["DEFAULT_OPERATOR"]) {
                 $operator_multi = $q["DEFAULT_OPERATOR"];
             }
             for ($j = 0; $j < count($field); $j++) {
                 $field_aff[$j] = $this->pp[$s[0]]->get_formatted_output(array(0 => $field[$j]), $s[1]);
             }
         } elseif ($s[0] == "f") {
             $ff = $this->fixedfields[$s[1]];
             $q_index = $ff["QUERIES_INDEX"];
             $q = $ff["QUERIES"][$q_index[${$op}]];
             if ($q["DEFAULT_OPERATOR"]) {
                 $operator_multi = $q["DEFAULT_OPERATOR"];
             }
             switch ($this->fixedfields[$s[1]]["INPUT_TYPE"]) {
                 case "list":
                     $options = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["OPTIONS"][0];
                     $opt = array();
                     for ($j = 0; $j < count($options["OPTION"]); $j++) {
                         if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") {
                             $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)];
                         } else {
                             $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"];
                         }
                     }
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt[$field[$j]];
                     }
                     break;
                 case "query_list":
                     $requete = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"];
                     if ($ff["INPUT_FILTERING"] == "yes") {
                         $this->access_rights();
                         $requete = str_replace("!!acces_j!!", $this->tableau_access_rights["acces_j"], $requete);
                         $requete = str_replace("!!statut_j!!", $this->tableau_access_rights["statut_j"], $requete);
                         $requete = str_replace("!!statut_r!!", $this->tableau_access_rights["statut_r"], $requete);
                     }
                     $resultat = mysql_query($requete);
                     $opt = array();
                     while ($r_ = @mysql_fetch_row($resultat)) {
                         $opt[$r_[0]] = $r_[1];
                     }
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt[$field[$j]];
                     }
                     break;
                 case "marc_list":
                     $opt = new marc_list($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]);
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt->table[$field[$j]];
                     }
                     break;
                 case "date":
                     $field_aff[0] = format_date($field[0]);
                     break;
                 case "authoritie":
                     for ($j = 0; $j < sizeof($field); $j++) {
                         if (is_numeric($field[$j]) && ${$op} == "AUTHORITY") {
                             switch ($ff['INPUT_OPTIONS']['SELECTOR']) {
                                 case "categorie":
                                     $field[$j] = categories::getlibelle($field[$j], $lang);
                                     break;
                                 case "auteur":
                                     $aut = new auteur($field[$j]);
                                     if ($aut->rejete) {
                                         $field[$j] = $aut->name . ', ' . $aut->rejete;
                                     } else {
                                         $field[$j] = $aut->name;
                                     }
                                     if ($aut->date) {
                                         $field[$j] .= " ({$aut->date})";
                                     }
                                     break;
                                 case "editeur":
                                     $ed = new publisher($field[$j]);
                                     $field[$j] = $ed->name;
                                     if ($ed->ville) {
                                         if ($ed->pays) {
                                             $field[$j] .= " ({$ed->ville} - {$ed->pays})";
                                         } else {
                                             $field[$j] .= " ({$ed->ville})";
                                         }
                                     }
                                     break;
                                 case "collection":
                                     $coll = new collection($field[$j]);
                                     $field[$j] = $coll->name;
                                     break;
                                 case "subcollection":
                                     $coll = new subcollection($field[$j]);
                                     $field[$j] = $coll->name;
                                     break;
                                 case "serie":
                                     $serie = new serie($field[$j]);
                                     $field[$j] = $serie->name;
                                     break;
                                 case "indexint":
                                     $indexint = new indexint($field[$j]);
                                     $field[$j] = $indexint->display;
                                     break;
                                 case "titres_uniformes":
                                     $tu = new titre_uniforme($field[$j]);
                                     $field[$j] = $tu->name;
                                     break;
                                 case "notice":
                                     $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' ";
                                     $res = mysql_query($requete);
                                     if ($res && mysql_num_rows($res)) {
                                         $field[$j] = mysql_result($res, 0, 0);
                                     }
                                     break;
                             }
                         }
                     }
                     $field_aff = $field;
                     break;
                 default:
                     $field_aff = $field;
                     break;
             }
         }
         //Ajout des variables si necessaire
         reset($fieldvar);
         $fieldvar_aff = array();
         while (list($var_name, $var_value) = each($fieldvar)) {
             //Recherche de la variable par son nom
             $vvar = $this->fixedfields[$s[1]]["VAR"];
             for ($j = 0; $j < count($vvar); $j++) {
                 if ($vvar[$j]["TYPE"] == "input" && $vvar[$j]["NAME"] == $var_name) {
                     //Calcul de la visibilite
                     $varname = $vvar[$j]["NAME"];
                     $visibility = 1;
                     $vis = $vvar[$j]["OPTIONS"]["VAR"][0];
                     if ($vis["NAME"]) {
                         $vis_name = $vis["NAME"];
                         global ${$vis_name};
                         if ($vis["VISIBILITY"] == "no") {
                             $visibility = 0;
                         }
                         for ($k = 0; $k < count($vis["VALUE"]); $k++) {
                             if ($vis["VALUE"][$k]["value"] == ${$vis_name}) {
                                 if ($vis["VALUE"][$k]["VISIBILITY"] == "no") {
                                     $sub_vis = 0;
                                 } else {
                                     $sub_vis = 1;
                                 }
                                 if ($vis["VISIBILITY"] == "no") {
                                     $visibility |= $sub_vis;
                                 } else {
                                     $visibility &= $sub_vis;
                                 }
                                 break;
                             }
                         }
                     }
                     $var_list_aff = array();
                     if ($visibility) {
                         switch ($vvar[$j]["OPTIONS"]["INPUT"][0]["TYPE"]) {
                             case "query_list":
                                 $query_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["value"];
                                 $r_list = mysql_query($query_list);
                                 while ($line = mysql_fetch_array($r_list)) {
                                     $as = array_search($line[0], $var_value);
                                     if ($as !== false && $as !== NULL) {
                                         $var_list_aff[] = $line[1];
                                     }
                                 }
                                 $fieldvar_aff[] = implode(" " . $msg["search_or"] . " ", $var_list_aff);
                                 break;
                         }
                         $fieldvar_aff[count($fieldvar_aff) - 1] = $vvar[$j]["COMMENT"] . " : " . $fieldvar_aff[count($fieldvar_aff) - 1];
                     }
                 }
             }
         }
         $texte = implode(" " . $msg["search_or"] . " ", $field_aff);
         if (count($fieldvar_aff)) {
             $texte .= " [" . implode(" ; ", $fieldvar_aff) . "]";
         }
         $inter = "inter_" . $i . "_" . $search[$i];
         switch (${$inter}) {
             case "and":
                 $inter_op = $msg["search_and"];
                 break;
             case "or":
                 $inter_op = $msg["search_or"];
                 break;
             case "ex":
                 $inter_op = $msg["search_exept"];
                 break;
             default:
                 $inter_op = "";
                 break;
         }
         if ($inter_op) {
             $inter_op = "<strong>" . htmlentities($inter_op, ENT_QUOTES, $charset) . "</strong>";
         }
         $r .= $inter_op . " <i><strong>" . htmlentities($title, ENT_QUOTES, $charset) . "</strong> " . htmlentities($operator, ENT_QUOTES, $charset) . " (" . htmlentities($texte, ENT_QUOTES, $charset) . ")</i> ";
     }
     return $r;
 }