public function generate_rss($context, $hash) { global $opac_url_base, $dbh; $this->notices_list = array(); $mc = unserialize($context); $search = new search($mc["search_type"]); $search->unserialize_search(serialize($mc["serialized_search"])); $table = $search->make_search(); $q = "select distinct notice_id from {$table} "; $res = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($res)) { while ($row = pmb_mysql_fetch_object($res)) { $this->notices_list[] = $row->notice_id; } } $flux = new newrecords_flux(0); $flux->setRecords($this->notices_list); $flux->setLink($opac_url_base . "s.php?h={$hash}"); $flux->setDescription(strip_tags($mc["human_query"])); $flux->xmlfile(); if (!$flux->envoi) { return; } @header('Content-type: text/xml'); echo $flux->envoi; }
public function get_value() { global $dbh; if (!count($this->value)) { if ($this->parameters['equation']) { $equ = new equation($this->parameters['equation']); $search = new search(); $search->unserialize_search($equ->requete); $table = $search->make_search(); $result = pmb_mysql_query("select * from " . $table, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $this->value[] = $row->notice_id; } } } } return $this->value; }
public function get_datas() { //on commence par récupérer l'identifiant retourné par le sélecteur... if ($this->parameters['selector'] != "") { for ($i = 0; $i < count($this->selectors); $i++) { if ($this->selectors[$i]['name'] == $this->parameters['selector']) { $selector = new $this->parameters['selector']($this->selectors[$i]['id']); break; } } $values = $selector->get_value(); $searcher = new search(false); $current_search = $searcher->serialize_search(); $searcher->destroy_global_env(); global $search; $search = array(); $search[] = "d_" . $values['cp']; $op = "op_0_d_" . $values['cp']; $field = "field_0_d_" . $values['cp']; global ${$op}, ${$field}; ${$op} = "EQ"; ${$field} = $values['cp_val']; $table = $searcher->make_search(); $query = "select notice_id from " . $table; $result = pmb_mysql_query($query); $records = array(); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $records[] = $row->notice_id; } } $searcher->unserialize_search($current_search); $records = $this->filter_datas("notices", $records); if ($this->parameters['nb_max_elements'] > 0) { $records = array_slice($records, 0, $this->parameters['nb_max_elements']); } $return = array('title' => 'Liste de Notices', 'records' => $records); return $return; } return false; }
function make_search() { global $opac_search_other_function; //TODO Vérifier avec $opac_search_other_function // if ($opac_search_other_function) search_other_function_get_history($valeur[0]); //Récupération de la valeur de saisie $valeur_ = "field_" . $this->n_ligne . "_s_" . $this->id; global ${$valeur_}; $valeur = ${$valeur_}; //enregistrement de l'environnement courant $this->search->push(); $mc = unserialize($valeur[0]); //et on se met dans le contexte de la recherche simple $es = new search(false, $mc["search_type"]); $es->unserialize_search($mc["serialized_search"]); //on cherche... $table_tempo = $es->make_search("tempo_" . $this->n_ligne); //restauration de l'environnement courant $this->search->pull(); return $table_tempo; }
$field = "field_1_" . $search[1]; $field_ = array(); $field_[0] = stripslashes($user_query); global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_1_" . $search[1]; global ${$inter}; ${$inter} = "and"; //variables auxiliaires $fieldvar_ = "fieldvar_1_" . $search[1]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; $es = new search("search_simple_fields_unimarc"); $table = $es->make_search("f_" . $look_id[$k]); $requete = "select count(1) from {$table}"; $resultat = pmb_mysql_query($requete); $nb_result_partial = @pmb_mysql_result($resultat, 0, 0); if ($nb_result_partial) { $nb_result_external += $nb_result_partial; print "<form name='form_" . $look_id[$k] . "' action='./index.php?lvl=more_results&mode=external' method='post'>\n"; print "<input type='hidden' name='external_env' value='" . htmlentities($external_env, ENT_QUOTES, $charset) . "'/>\n\t\t\t\t\t<input type='hidden' name='search[0]' value='" . htmlentities("s_2", ENT_QUOTES, $charset) . "'/>\n\t\t\t\t\t<input type='hidden' name='op_0_s_2' value='" . htmlentities("EQ", ENT_QUOTES, $charset) . "'/>\n"; for ($j = 0; $j < count($source); $j++) { print "<input type='hidden' name='field_0_s_2[" . $j . "]' value='" . htmlentities($source[$j], ENT_QUOTES, $charset) . "'/>\n"; } print "\n\t\t\t\t\t<input type='hidden' name='search[1]' value='" . htmlentities($search[1], ENT_QUOTES, $charset) . "'/>\n\t\t\t\t\t<input type='hidden' name='" . $op . "' value='" . htmlentities($op_, ENT_QUOTES, $charset) . "'/>\n\t\t\t\t\t<input type='hidden' name='" . $field . "[0]' value='" . htmlentities($field_[0], ENT_QUOTES, $charset) . "'/>\n\t\t\t\t\t<input type='hidden' name='" . $inter . "' value='" . htmlentities("and", ENT_QUOTES, $charset) . "'/>\n\t\t\t\t\t<input type='hidden' name='count' value='" . $nb_result_external . "'>"; print pmb_bidi("<strong>" . $msg[$look_msg[$k]] . "</strong> " . $nb_result_partial . " {$msg['results']} "); print "<a href=\"javascript:document.form_" . $look_id[$k] . ".submit()\">{$msg['suite']} <img src='./images/search.gif' border='0' align='absmiddle'/></a><br />"; print "</form>\n"; }
function remplir() { global $dbh; global $msg; if (!$this->id_bannette) { return $msg['dsi_ban_no_access']; } // impossible d'accéder à cette bannette // récupérer les équations associées à la bannette $equations = $this->get_equations(); $res_affichage = "<ul>"; if ($this->update_type == "C") { $colonne_update_create = "create_date"; } else { $colonne_update_create = "update_date"; } for ($i = 0; $i < sizeof($equations); $i++) { // pour chaque équation ajouter les notices trouvées au contenu de la bannette $equ = new equation($equations[$i]); $search = new search(); $search->unserialize_search($equ->requete); $table = $search->make_search(); if ($this->statut_not_account) { $temp_requete = "insert ignore into bannette_contenu (num_bannette, num_notice) (select " . $this->id_bannette . " , notices.notice_id from {$table} , notices where notices.{$colonne_update_create}>='" . $this->date_last_envoi . "' and {$table}.notice_id=notices.notice_id )"; } else { $temp_requete = "insert ignore into bannette_contenu (num_bannette, num_notice) (select " . $this->id_bannette . " , notices.notice_id from {$table} , notices, notice_statut where notices.{$colonne_update_create}>='" . $this->date_last_envoi . "' and {$table}.notice_id=notices.notice_id and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0) or (notice_visible_opac_abon=1 and notice_visible_opac=1))) "; } @pmb_mysql_query($temp_requete, $dbh); $res_affichage .= "<li>" . $equ->human_query . "</li>"; $temp_requete = "drop table {$table} "; @pmb_mysql_query($temp_requete, $dbh); } // remplissage du panier avec le contenu de la bannette if ($this->num_panier) { $temp_requete = "delete from caddie_content where caddie_id='" . $this->num_panier . "'"; pmb_mysql_query($temp_requete, $dbh); $temp_requete = "insert into caddie_content (caddie_id, object_id) (select " . $this->num_panier . ", num_notice from bannette_contenu where num_bannette=" . $this->id_bannette . ")"; pmb_mysql_query($temp_requete, $dbh) or die(pmb_mysql_error() . $temp_requete); } $res_affichage .= "</ul>"; $this->compte_elements(); $temp_requete = "update bannettes set date_last_remplissage=sysdate() where id_bannette='" . $this->id_bannette . "' "; pmb_mysql_query($temp_requete, $dbh); $this->purger(); return $res_affichage; }
$p = stripos($requete, "limit"); if ($p) { $requete = substr($requete, 0, $p); } } } else { $requete .= ",notices where notices.notice_id=caddie_content.object_id and caddie_id=" . $idcaddie; $orderby = " order by index_sew"; if ($environement["pager"]) { $requete .= $orderby . " limit " . $nb_per_page_search * ($page - 1) . ",{$nb_per_page_search}"; } } break; case "expl": $sh = new search(true, "search_fields_expl"); $table = $sh->make_search(); if ($environement["pager"]) { $limit = "limit " . $nb_per_page_search * $page . ",{$nb_per_page_search}"; } $requete = "select expl_id as notice_id from {$table} " . $limit; $object_type = "EXPL"; break; } } if ($environement["caddie"]) { foreach ($environement["caddie"] as $environement_caddie) { $c = new caddie($environement_caddie); $nb_items_before = $c->nb_item; $resultat = @mysql_query($requete); print mysql_error(); while ($r = mysql_fetch_object($resultat)) {
function make_search() { global $search; //Récupération de la valeur de saisie $valeur_ = "field_" . $this->n_ligne . "_s_" . $this->id; global ${$valeur_}; $valeur = ${$valeur_}; if (!$this->is_empty($valeur)) { //enregistrement de l'environnement courant $this->search->push(); //Récupération et mise en variables globales des valeurs de l'historique if ($_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"]["search"][0]) { $search = $_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"]["search"]; //Pour chaque champ for ($i = 0; $i < count($search); $i++) { //Récupération de l'opérateur $op = "op_" . $i . "_" . $search[$i]; global ${$op}; ${$op} = $_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"][$op]; //Récupération du contenu de la recherche $field_ = "field_" . $i . "_" . $search[$i]; global ${$field_}; ${$field_} = $_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"][$field_]; $field = ${$field_}; //Récupération de l'opérateur inter-champ $inter = "inter_" . $i . "_" . $search[$i]; global ${$inter}; ${$inter} = $_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"][$inter]; //Récupération des variables auxiliaires $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i]; global ${$fieldvar_}; ${$fieldvar_} = $_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"][$fieldvar_]; $fieldvar = ${$fieldvar_}; } } else { if (!$_SESSION["session_history"][$valeur[0]]["NOTI"]["GET"]["idcaddie"]) { switch ($_SESSION["session_history"][$valeur[0]]["NOTI"]["GET"]["mode"]) { case 0: searcher_title::convert_simple_multi($valeur[0]); break; case 1: searcher_subject::convert_simple_multi($valeur[0]); break; case 2: searcher_publisher::convert_simple_multi($valeur[0]); break; } } else { $op_ = "EQ"; $valeur_champ = $_SESSION["session_history"][$valeur[0]]["NOTI"]["GET"]["idcaddie"]; $search[0] = "f_11"; //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; } } //on instancie la classe search avec le nom de la nouvelle table temporaire if ($_SESSION["session_history"][$valeur[0]]["QUERY"]["POST"]["search"][0]) { $sc = new search(false, "search_fields_expl"); } else { $sc = new search(false, "search_simple_fields"); } $table_tempo = $sc->make_search("tempo_" . $valeur[0]); //restauration de l'environnement courant $this->search->pull(); return $table_tempo; } }
function havest_notice($isbn = "", $notice_id = 0) { global $charset, $class_path, $include_path, $base_path; global $dbh, $msg; global $search; $search[] = "s_2"; global $op_0_s_2; $op_0_s_2 = "EQ"; global $field_0_s_2; foreach ($this->info['source_fields'] as $source_id => $harvest_fields) { $field_0_s_2[] = $source_id; } $search[] = "f_22"; global $inter_1_f_22; $inter_1_f_22 = "or"; global $op_1_f_22; $op_1_f_22 = "STARTWITH"; global $field_1_f_22; $field_1_f_22[] = $isbn; /* foreach( $this->info['source_fields'] as $source_id => $harvest_fields){ if($notice_id){ $code=$this->get_code($source_id,$notice_id); $field_1_f_22[]=$code; print $code.", "; }else $field_1_f_22[]=$isbn; } */ global $explicit_search; $explicit_search = "1"; $s = new search('', "search_fields_unimarc"); $res = $s->make_search(); $req = "select * from " . $res; $resultat = mysql_query($req); while ($r = mysql_fetch_object($resultat)) { // printr( $r); $recid = $r->notice_id; $requete = "SELECT source_id FROM external_count WHERE rid=" . $r->notice_id . ";"; $myQuery = mysql_query($requete, $dbh); $source_id = mysql_result($myQuery, 0, 0); $req = "select * from entrepot_source_" . $source_id . " where recid='" . $recid . "' order by ufield,field_order,usubfield,subfield_order,value"; $res_entrepot = mysql_query($req); while ($r_ent = mysql_fetch_object($res_entrepot)) { $this->info['notice'][$source_id][$r_ent->ufield][] = $r_ent; } // on fait le ménage ou pas vu les requetes /*$req="DELETE FROM entrepot_source_".$source_id." where where recid='".$recid."' "; mysql_query($req); $req="DELETE FROM FROM external_count WHERE rid=".$r->notice_id.""; mysql_query($req);*/ } // printr( $this->info['notice']); $notice_composite = array(); $cpt = 0; // $this->info['fields'][$r->harvest_field_xml_id]['xml'] foreach ($this->info['fields'] as $xml_id => $src_list) { //printr( $src_list); $first_flag = $src_list['first_flag']; foreach ($src_list['src'] as $src) { $prec_flag = $src['prec_flag']; $unimacsubfield = $src['unimacsubfield']; // source sub_field $pmb_unimacfield = $src['pmb_unimacfield']; // destination $this->fields_id[$this->fields[$key]["ID"]] $this->info['fields'][$r->harvest_field_xml_id]['src'][$cpt]['pmb_unimacfield'] = $r_src->harvest_src_pmb_unimacfield; $this->info['fields'][$r->harvest_field_xml_id]['src'][$cpt]['pmb_unimacsubfield'] = $r_src->harvest_src_pmb_unimacsubfield; $found = 0; if ($this->info['notice'][$src['num_source']][$src['unimacfield']]) { foreach ($this->info['notice'][$src['num_source']][$src['unimacfield']] as $notice_field) { $no_memo_subfield_flag = 0; if ($unimacsubfield && $notice_field->usubfield != $unimacsubfield) { $no_memo_subfield_flag = 1; } //printr( $notice_ufield); if ($notice_field->value && !$no_memo_subfield_flag) { $notice_composite[$cpt]['xml_id'] = $xml_id; $notice_composite[$cpt]['num_source'] = $src['num_source']; $notice_composite[$cpt]['ufield'] = $pmb_unimacfield; $notice_composite[$cpt]['field_ind'] = $notice_field->field_ind; $notice_composite[$cpt]['usubfield'] = $notice_field->usubfield; $notice_composite[$cpt]['field_order'] = $notice_field->field_order; $notice_composite[$cpt]['subfield_order'] = $notice_field->subfield_order; $notice_composite[$cpt]['value'] = $notice_field->value; $notice_composite[$cpt]['pmb_unimacfield'] = $this->fields_id[$xml_id]['UNIMARCFIELD']; $notice_composite[$cpt]['pmb_unimacsubfield'] = $this->fields_id[$xml_id]['UNIMARCSUBFIELD']; $cpt++; $found = 1; } } } // une valeur est trouvée , on ne s'occupe pas des sources suivantes si demandé if ($first_flag && $found) { break; } } } // printr( $this->info['notice']); return $notice_composite; }
function make_search() { global $opac_indexation_docnum_allfields; global $opac_search_other_function; //Récupération de la valeur de saisie $valeur_ = "field_" . $this->n_ligne . "_s_" . $this->id; global ${$valeur_}; $valeur = ${$valeur_}; if (!$this->is_empty($valeur)) { $table_tempo = ""; //enregistrement de l'environnement courant $this->search->push(); //on instancie la classe search avec le nom de la nouvelle table temporaire switch ($_SESSION["search_type" . $valeur[0]]) { case 'simple_search': global $search; if ($opac_search_other_function) { search_other_function_get_history($valeur[0]); } switch ($_SESSION["notice_view" . $valeur[0]]["search_mod"]) { case 'title': $search[0] = "f_6"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'all': $search[0] = "f_7"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; $t["is_num"][0] = $opac_indexation_docnum_allfields; $t["ck_affiche"][0] = $opac_indexation_docnum_allfields; break; case 'abstract': $search[0] = "f_13"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'keyword': $search[0] = "f_12"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'author_see': $search[0] = "f_8"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'categ_see': $search[0] = "f_1"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'indexint_see': $search[0] = "f_2"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'coll_see': $search[0] = "f_4"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'publisher_see': $search[0] = "f_3"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'subcoll_see': $search[0] = "f_5"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'titre_uniforme_see': $search[0] = "f_6"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; break; case 'docnum': $search[0] = "f_16"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]["search_id"]; break; } //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; if ($t) { ${$fieldvar_} = $t; } else { ${$fieldvar_} = ""; } $fieldvar = ${$fieldvar_}; if ($_SESSION["typdoc" . $valeur[0]]) { $search[1] = "f_9"; $op_ = "EQ"; $valeur_champ = $_SESSION["typdoc" . $valeur[0]]; //opérateur $op = "op_1_" . $search[1]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_1_" . $search[1]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_1_" . $search[1]; global ${$inter}; ${$inter} = "and"; } $es = new search("search_simple_fields"); break; case 'extended_search': get_history($valeur[0]); $searcher = new searcher_extended(); $searcher->get_result(); $table_tempo = $searcher->table; break; case 'term_search': global $search; $search[0] = "f_1"; $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; $es = new search("search_simple_fields"); break; case 'module': global $search; switch ($_SESSION["notice_view" . $valeur[0]]["search_mod"]) { case 'categ_see': $search[0] = "f_1"; break; case 'indexint_see': $search[0] = "f_2"; break; case 'etagere_see': $search[0] = "f_14"; break; case 'section_see': $search[0] = "f_15"; global $search_localisation; $search_localisation = $_SESSION["notice_view" . $valeur[0]]["search_location"]; break; } $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; //fieldvar attention pour la section ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; $es = new search("search_simple_fields"); break; } if (!$table_tempo) { $table_tempo = $es->make_search("tempo_" . $valeur[0]); } //restauration de l'environnement courant $this->search->pull(); } return $table_tempo; }
function remplir() { global $dbh; global $msg; global $gestion_acces_active, $gestion_acces_empr_notice; if (!$this->id_bannette) { return $msg[dsi_ban_no_access]; } // impossible d'accéder à cette bannette // récupérer les équations associées à la bannette $equations = $this->get_equations(); $res_affichage = "<ul>"; if ($this->update_type == "C") { $colonne_update_create = "create_date"; } else { $colonne_update_create = "update_date"; } for ($i = 0; $i < sizeof($equations); $i++) { // pour chaque équation ajouter les notices trouvées au contenu de la bannette $equ = new equation($equations[$i]); $search = new search(); $search->unserialize_search($equ->requete); $table = $search->make_search(); $temp_requete = "insert into bannette_contenu (num_bannette, num_notice) (select " . $this->id_bannette . " , notices.notice_id from {$table} , notices, notice_statut where notices.{$colonne_update_create}>='" . $this->date_last_envoi . "' and {$table}.notice_id=notices.notice_id and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0) or (notice_visible_opac_abon=1 and notice_visible_opac=1)) limit 300) "; $res = @pmb_mysql_query($temp_requete, $dbh); $res_affichage .= "<li>" . $equ->human_query . "</li>"; $temp_requete = "drop table {$table} "; $res = @pmb_mysql_query($temp_requete, $dbh); } $res_affichage .= "</ul>"; $this->compte_elements(); $temp_requete = "update bannettes set date_last_remplissage=sysdate() where id_bannette='" . $this->id_bannette . "' "; $res = @pmb_mysql_query($temp_requete, $dbh); //purge pour les bannettes privees des notices ne devant pas etre diffusees if ($this->proprio_bannette && $gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($this->proprio_bannette, '4=0', 'num_notice'); $q = "delete from bannette_contenu using bannette_contenu {$acces_j} WHERE num_bannette='{$this->id_bannette}' "; pmb_mysql_query($q, $dbh); } return $res_affichage; }
} else { $cart_sort = "default"; } $notices = $searcher->get_sorted_cart_result($cart_sort, 0, $opac_max_cart_items); if (count($notices)) { $notices = implode(",", $notices); } add_notices_to_cart($notices); break; case "external": if ($_SESSION["external_type"] == "multi") { $es = new search("search_fields_unimarc"); } else { $es = new search("search_simple_fields_unimarc"); } $table = $es->make_search(); $requete = "select concat('es', notice_id) as notice_id from {$table} where 1;"; $message = add_query($requete); break; case 'docnum': $notices = ''; //droits d'acces emprunteur/notice $acces_j = ''; if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id'); } if ($acces_j) { $statut_j = '';
/** * * * @return void * @access public */ public function get_objects() { global $dbh; global $search; $objects = array(); $current_search = $this->get_mode(); if ($_SESSION["session_history"][$current_search]["NOTI"]["GET"]["mode"] != "") { $mode_search = $_SESSION["session_history"][$current_search]["NOTI"]["GET"]["mode"]; switch ($mode_search) { case 1: case 2: case 9: $requete = substr($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"], 0, strpos($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"], "limit")); $result = pmb_mysql_query($requete, $dbh); $notices_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $notices_ids[] = $row->notice_id; } $objects[] = array('layer' => "record", 'ids' => $notices_ids); if (count($notices_ids)) { $requete = "select distinct map_emprise_obj_num from map_emprises join notices_categories on map_emprises.map_emprise_obj_num = notices_categories.num_noeud where map_emprises.map_emprise_type=2 and notices_categories.notcateg_notice in (" . implode(",", $notices_ids) . ")"; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $categ_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $categ_ids[] = $row->map_emprise_obj_num; } $objects[] = array('layer' => "authority", 'type' => 2, 'ids' => $categ_ids); } } break; case 0: case 11: if ($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"]) { $requete = substr($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"], 0, strpos($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"], "limit")); $result = pmb_mysql_query($requete, $dbh); $notices_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $notices_ids[] = $row->notice_id; } $objects[] = array('layer' => "record", 'ids' => $notices_ids); if (count($notices_ids)) { $requete = "select distinct map_emprise_obj_num from map_emprises join notices_categories on map_emprises.map_emprise_obj_num = notices_categories.num_noeud where map_emprises.map_emprise_type=2 and notices_categories.notcateg_notice in (" . implode(",", $notices_ids) . ")"; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $categ_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $categ_ids[] = $row->map_emprise_obj_num; } $objects[] = array('layer' => "authority", 'type' => 2, 'ids' => $categ_ids); } } } break; case 3: $requete = "SELECT object_id FROM caddie_content where caddie_id='" . $_SESSION["session_history"][$current_search]["NOTI"]["GET"]["idcaddie"] . "' "; $res = pmb_mysql_query($requete, $dbh); $result = pmb_mysql_query($requete, $dbh); $notices_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $notices_ids[] = $row->object_id; } $objects[] = array('layer' => "record", 'ids' => $notices_ids); if (count($notices_ids)) { $requete = "select distinct map_emprise_obj_num from map_emprises join notices_categories on map_emprises.map_emprise_obj_num = notices_categories.num_noeud where map_emprises.map_emprise_type=2 and notices_categories.notcateg_notice in (" . implode(",", $notices_ids) . ")"; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $categ_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $categ_ids[] = $row->map_emprise_obj_num; } $objects[] = array('layer' => "authority", 'type' => 2, 'ids' => $categ_ids); } } break; case 6: //Récupération et mise en variables globales des valeurs de l'historique if ($_SESSION["session_history"][$current_search]["QUERY"]["POST"]["search"][0]) { $search = $_SESSION["session_history"][$current_search]["QUERY"]["POST"]["search"]; //Pour chaque champ for ($i = 0; $i < count($search); $i++) { //Récupération de l'opérateur $op = "op_" . $i . "_" . $search[$i]; global ${$op}; ${$op} = $_SESSION["session_history"][$current_search]["QUERY"]["POST"][$op]; //Récupération du contenu de la recherche $field_ = "field_" . $i . "_" . $search[$i]; global ${$field_}; ${$field_} = $_SESSION["session_history"][$current_search]["QUERY"]["POST"][$field_]; $field = ${$field_}; //Récupération de l'opérateur inter-champ $inter = "inter_" . $i . "_" . $search[$i]; global ${$inter}; ${$inter} = $_SESSION["session_history"][$current_search]["QUERY"]["POST"][$inter]; //Récupération des variables auxiliaires $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i]; global ${$fieldvar_}; ${$fieldvar_} = $_SESSION["session_history"][$current_search]["QUERY"]["POST"][$fieldvar_]; $fieldvar = ${$fieldvar_}; } } //on instancie la classe search avec le nom de la nouvelle table temporaire if ($_SESSION["session_history"][$current_search]["QUERY"]["POST"]["search"][0]) { $sc = new search(false); } else { $sc = new search(false, "search_simple_fields"); } $table_tempo = $sc->make_search("tempo_" . $current_search); $requete = "select * from " . $table_tempo; $result = pmb_mysql_query($requete, $dbh); $notices_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $notices_ids[] = $row->notice_id; } $objects[] = array('layer' => "record", 'ids' => $notices_ids); if (count($notices_ids)) { $requete = "select distinct map_emprise_obj_num from map_emprises join notices_categories on map_emprises.map_emprise_obj_num = notices_categories.num_noeud where map_emprises.map_emprise_type=2 and notices_categories.notcateg_notice in (" . implode(",", $notices_ids) . ")"; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $categ_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $categ_ids[] = $row->map_emprise_obj_num; } $objects[] = array('layer' => "authority", 'type' => 2, 'ids' => $categ_ids); } } break; default: // authpersos if ($mode_search > 1000) { if ($_SESSION["session_history"][$current_search]["NOTI"]["POST"]) { $requete = substr($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"], 0, strpos($_SESSION["session_history"][$current_search]["NOTI"]["TEXT_QUERY"], "limit")); $result = pmb_mysql_query($requete, $dbh); $notices_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $notices_ids[] = $row->notice_id; } $objects[] = array('layer' => "record", 'ids' => $notices_ids); if (count($notices_ids)) { $requete = "select distinct map_emprise_obj_num from map_emprises join notices_categories on map_emprises.map_emprise_obj_num = notices_categories.num_noeud where map_emprises.map_emprise_type=2 and notices_categories.notcateg_notice in (" . implode(",", $notices_ids) . ")"; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $categ_ids = array(); while ($row = pmb_mysql_fetch_object($result)) { $categ_ids[] = $row->map_emprise_obj_num; } $objects[] = array('layer' => "authority", 'type' => 2, 'ids' => $categ_ids); } } } } break; } } elseif ($_SESSION["session_history"][$current_search]["AUT"]["GET"]["mode"] != "") { $mode_search = $_SESSION["session_history"][$current_search]["AUT"]["GET"]["mode"]; switch ($mode_search) { case 0: if ($_SESSION["session_history"][$current_search]["AUT"]["POST"]) { foreach ($_SESSION["session_history"][$current_search]["AUT"]["POST"] as $key => $valeur) { global ${$key}; ${$key} = $valeur; } // Recherche sur l'auteur uniquement : $aq = new analyse_query(stripslashes($author_query), 0, 0, 1, 1); $restrict = ''; if ($typdoc_query) { $restrict = "and typdoc='" . $typdoc_query . "' "; } if ($statut_query) { $restrict .= "and statut='" . $statut_query . "' "; } if ($typdoc_query || $statut_query || $acces_j) { $restrict = "and responsability_author=author_id and responsability_notice=notice_id " . $restrict . " "; $members = $aq->get_query_members("authors", "concat(author_name,', ',author_rejete)", "index_author", "author_id"); $requete_count = "select count(distinct author_id) from authors, responsability, notices "; $requete_count .= $acces_j; $requete_count .= "where " . $members["where"] . " "; $requete_count .= $restrict; $requete = "select author_id," . $members["select"] . " as pert from authors, responsability, notices "; $requete .= $acces_j; $requete .= "where " . $members["where"] . " "; $requete .= $restrict . " group by author_id order by pert desc,author_name, author_rejete,author_numero , author_subdivision "; } else { $requete_count = $aq->get_query_count("authors", "concat(author_name,', ',author_rejete)", "index_author", "author_id"); $t_query = $aq->get_query_members("authors", "concat(author_name,', ',author_rejete)", "index_author", "author_id"); $requete = "select author_id," . $t_query["select"] . " as pert from authors where " . $t_query["where"] . " group by author_id order by pert desc,author_name, author_rejete, author_numero , author_subdivision "; } $t_query = @pmb_mysql_query($requete, $dbh); while ($row = pmb_mysql_fetch_object($t_query)) { $aut_ids[] = $row->author_id; } $objects[] = array('layer' => "authority", 'ids' => $aut_ids); } break; } } return $objects; }
function make_search() { //Récupération de la valeur de saisie $valeur_ = "field_" . $this->n_ligne . "_s_" . $this->id; global ${$valeur_}; $valeur = ${$valeur_}; if (!$this->is_empty($valeur)) { //enregistrement de l'environnement courant $this->search->push(); //on instancie la classe search avec le nom de la nouvelle table temporaire switch ($_SESSION["search_type" . $valeur[0]]) { case 'simple_search': global $search; switch ($_SESSION["notice_view" . $valeur[0]]["search_mod"]) { case 'title': $search[0] = "f_6"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'all': $search[0] = "f_7"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'abstract': $search[0] = "f_13"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'keyword': $search[0] = "f_12"; $op_ = "BOOLEAN"; $valeur_champ = $_SESSION["user_query" . $valeur[0]]; break; case 'author_see': $search[0] = "f_8"; $op_ = "BOOLEAN"; //Recherche de l'auteur $author_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select concat(author_name,', ',author_rejete) from authors where author_id=" . $author_id; $r_author = mysql_query($requete); if (@mysql_num_rows($r_author)) { $valeur_champ = mysql_result($r_author, 0, 0); } break; case 'categ_see': $search[0] = "f_1"; $op_ = "BOOLEAN"; //Recherche de la catégorie $categ_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select libelle_categorie from categories where num_noeud=" . $categ_id; $r_cat = mysql_query($requete); if (@mysql_num_rows($r_cat)) { $valeur_champ = mysql_result($r_cat, 0, 0); } break; case 'indexint_see': $search[0] = "f_2"; $op_ = "BOOLEAN"; //Recherche de l'indexation $indexint_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select indexint_name from indexint where indexint_id=" . $indexint_id; $r_indexint = mysql_query($requete); if (@mysql_num_rows($r_indexint)) { $valeur_champ = mysql_result($r_indexint, 0, 0); } break; case 'coll_see': $search[0] = "f_4"; $op_ = "BOOLEAN"; //Recherche de l'indexation $coll_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select collection_name from collections where collection_id=" . $coll_id; $r_coll = mysql_query($requete); if (@mysql_num_rows($r_coll)) { $valeur_champ = mysql_result($r_coll, 0, 0); } break; case 'publisher_see': $search[0] = "f_3"; $op_ = "BOOLEAN"; //Recherche de l'éditeur $publisher_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select ed_name from publishers where ed_id=" . $publisher_id; $r_pub = mysql_query($requete); if (@mysql_num_rows($r_pub)) { $valeur_champ = mysql_result($r_pub, 0, 0); } break; case 'subcoll_see': $search[0] = "f_5"; $op_ = "BOOLEAN"; //Recherche de l'éditeur $subcoll_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select sub_coll_name from sub_collections where sub_coll_id=" . $subcoll_id; $r_subcoll = mysql_query($requete); if (@mysql_num_rows($r_subcoll)) { $valeur_champ = mysql_result($r_subcoll, 0, 0); } break; case 'titre_uniforme_see': $search[0] = "f_6"; $op_ = "BOOLEAN"; //Recherche de l'éditeur $tu_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select tu_name from titre_uniformes where tu_id=" . $tu_id; $r_tu = mysql_query($requete); if (@mysql_num_rows($r_tu)) { $valeur_champ = mysql_result($r_tu, 0, 0); } break; } //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; $es = new search("search_simple_fields_unimarc"); break; case 'extended_search': get_history($valeur[0]); $es = new search("search_fields_unimarc"); break; case 'term_search': global $search; $search[0] = "f_1"; $op_ = "BOOLEAN"; //Recherche de la catégorie $categ_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select libelle_categorie from categories where num_noeud=" . $categ_id; $r_cat = mysql_query($requete); if (@mysql_num_rows($r_cat)) { $valeur_champ = mysql_result($r_cat, 0, 0); } //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; $es = new search("search_simple_fields_unimarc"); break; case 'module': global $search; switch ($_SESSION["notice_view" . $valeur[0]]["search_mod"]) { case 'categ_see': $search[0] = "f_1"; $op_ = "BOOLEAN"; //Recherche de la catégorie $categ_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select libelle_categorie from categories where num_noeud=" . $categ_id; $r_cat = mysql_query($requete); if (@mysql_num_rows($r_cat)) { $valeur_champ = mysql_result($r_cat, 0, 0); } break; case 'indexint_see': $search[0] = "f_2"; $op_ = "BOOLEAN"; //Recherche de l'indexation $indexint_id = $_SESSION["notice_view" . $valeur[0]]["search_id"]; $requete = "select indexint_name from indexint where indexint_id=" . $indexint_id; $r_indexint = mysql_query($requete); if (@mysql_num_rows($r_indexint)) { $valeur_champ = mysql_result($r_indexint, 0, 0); } break; case 'etagere_see': $search[0] = "f_14"; break; case 'section_see': $search[0] = "f_15"; global $search_localisation; $search_localisation = $_SESSION["notice_view" . $valeur[0]]["search_location"]; break; } if (!$op_) { $op_ = "EQ"; $valeur_champ = $_SESSION["notice_view" . $valeur[0]]["search_id"]; } //opérateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $valeur_champ; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; //fieldvar attention pour la section ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; $es = new search("search_simple_fields_unimarc"); break; } $table_tempo = $es->make_search("tempo_" . $valeur[0]); //restauration de l'environnement courant $this->search->pull(); } return $table_tempo; }
protected function _get_search_query() { global $es, $msg; if (!is_object($es)) { $es = new search(); } if ($this->serialized_query) { $es->unserialize_search($this->serialized_query); } else { global $search; //Vérification des champs vides for ($i = 0; $i < count($search); $i++) { if ($i == 0) { //On supprime le premier opérateur inter (il est renseigné pour les recherches prédéfinies avec plusieurs champs et une recherche avec le premier champ vide $inter = "inter_" . $i . "_" . $search[$i]; global ${$inter}; ${$inter} = ""; } $op = "op_" . $i . "_" . $search[$i]; global ${$op}; $field_ = "field_" . $i . "_" . $search[$i]; global ${$field_}; $field = ${$field_}; $s = explode("_", $search[$i]); if ($s[0] == "f") { $champ = $es->fixedfields[$s[1]]["TITLE"]; } elseif ($s[0] == "s") { $champ = $es->specialfields[$s[1]]["TITLE"]; } else { $champ = $es->pp->t_fields[$s[1]]["TITRE"]; } if ((string) $field[0] == "" && !$es->op_empty[${$op}]) { $search_error_message = sprintf($msg["extended_empty_field"], $champ); $flag = true; break; } } } //$es->remove_forbidden_fields(); $this->table = $es->make_search(); return "select notice_id as id_notice from " . $this->table; }