function search_authperso($user_query) { global $opac_search_other_function, $typdoc, $charset, $dbh; global $opac_stemming_active; $total_results = 0; foreach ($this->info as $authperso) { if (!$authperso['opac_search']) { continue; } $look_name = "look_AUTHPERSO_" . $authperso['id'] . "#"; global ${$look_name}; $look = ${$look_name}; if (!$look) { continue; } $clause = ''; $add_notice = ''; $aq = new analyse_query(stripslashes($user_query), 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 authperso_authority_authperso_num=" . $authperso['id']; if ($opac_search_other_function) { $add_notice = search_other_function_clause(); } if ($typdoc || $add_notice) { $clause = ', notices, notices_authperso ' . $clause; } if ($typdoc) { $clause .= " and notice_authperso_notice_num=notice_id and typdoc='" . $typdoc . "' "; } if ($add_notice) { $clause .= ' and notice_id in (' . $add_notice . ')'; } $tri = 'order by pert desc, authperso_index_infos_global'; $pert = $members["select"] . " as pert"; $auth_res = pmb_mysql_query("SELECT COUNT(distinct id_authperso_authority) FROM authperso_authorities {$clause}", $dbh); $nb_result = pmb_mysql_result($auth_res, 0, 0); if ($nb_result) { $total_results += $nb_result; //définition du formulaire $form = "<div style=search_result><form name=\"search_authperso_" . $authperso['id'] . "\" action=\"./index.php?lvl=more_results\" method=\"post\">"; $form .= "<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "\">\n"; if (function_exists("search_other_function_post_values")) { $form .= search_other_function_post_values(); } $form .= "<input type=\"hidden\" name=\"mode\" value=\"authperso_" . $authperso['id'] . "\">\n"; $form .= "<input type=\"hidden\" name=\"search_type_asked\" value=\"simple_search\">\n"; $form .= "<input type=\"hidden\" name=\"count\" value=\"" . $nb_result . "\">\n"; $form .= "<input type=\"hidden\" name=\"name\" value=\"" . $authperso["name"] . "\">\n"; $form .= "<input type=\"hidden\" name=\"clause\" value=\"" . htmlentities($clause, ENT_QUOTES, $charset) . "\">"; $form .= "<input type=\"hidden\" name=\"pert\" value=\"" . htmlentities($pert, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"tri\" value=\"" . htmlentities($tri, ENT_QUOTES, $charset) . "\"></form>\n"; $form .= "</div>"; $_SESSION["level1"]["authperso_" . $authperso['id']]["form"] = $form; $_SESSION["level1"]["authperso_" . $authperso['id']]["count"] = $nb_result; $_SESSION["level1"]["authperso_" . $authperso['id']]["name"] = $authperso["name"]; } } return $total_results; }
$navig.="<td><a href=\"index.php?lvl=etageres_see\" class='etageres_see'><span>".$msg["etageres_see"]."</span></a></td>\n"; */ //Création de la recherche équivalente à tous les champs si on est en autolevel //Si le niveau 1 est shunté if ($opac_autolevel2 && $autolevel1 && !$get_last_query && $user_query) { //On fait la recherche tous les champs $search_all_fields = new searcher_all_fields(stripslashes($user_query), $map_emprises_query); $nb_result = $search_all_fields->get_nb_results(); if ($nb_result) { $count = $nb_result; $l_typdoc = implode(",", $search_all_fields->get_typdocs()); $mode = "tous"; //définition du formulaire $form_lvl1 = "\n\t\t\t<form name=\"search_tous\" action=\"./index.php?lvl=more_results\" method=\"post\">"; if (function_exists("search_other_function_post_values")) { $form_lvl1 .= search_other_function_post_values(); } if (count($map_emprise_query)) { foreach ($map_emprises_query as $map_emprise_query) { $form_lvl1 .= "\r\n\t\t\t\t<input type=\"hidden\" name=\"map_emprises_query[]\" value=\"{$map_emprise_query}\">"; } } $form_lvl1 .= "\n\t\t \t\t<input type=\"hidden\" name=\"mode\" value=\"tous\">\n\t\t \t\t<input type=\"hidden\" name=\"typdoc\" value=\"" . $typdoc . "\">\n\t\t \t\t<input type=\"hidden\" name=\"count\" value=\"" . $nb_result . "\">\n\t\t \t\t<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "\">\n\t\t \t\t<input type=\"hidden\" name=\"l_typdoc\" value=\"" . htmlentities($l_typdoc, ENT_QUOTES, $charset) . "\">"; if ($opac_indexation_docnum_allfields) { $form_lvl1 .= "<input type=\"hidden\" name=\"join\" value=\"" . htmlentities($join, ENT_QUOTES, $charset) . "\">"; } $form_lvl1 .= "\n\t\t\t</form>"; unset($_SESSION["level1"]); $_SESSION["level1"]["tous"]["form"] = $form_lvl1; $_SESSION["level1"]["tous"]["count"] = $nb_result; $_SESSION["search_type"] = "simple_search";
function search_concepts() { global $opac_search_other_function, $typdoc, $charset, $dbh; global $opac_stemming_active; // on regarde comment la saisie utilisateur se présente $clause = ''; $add_notice = ''; $aq = new analyse_query(stripslashes($this->user_query), 0, 0, 1, 0, $opac_stemming_active); $clause .= "where (value like '%" . stripslashes($user_query) . "%') and code_champ = 1"; if ($opac_search_other_function) { $add_notice = search_other_function_clause(); } if ($typdoc || $add_notice) { $clause = ',notices, index_concept ' . $clause . ' and num_concept=id_item and notice_id=num_object and type_object=1'; } if ($typdoc) { $clause .= " and typdoc='" . $typdoc . "' "; } if ($add_notice) { $clause .= ' and notice_id in (' . $add_notice . ')'; } $tri = 'order by pert desc, value'; $pert = "(value like '%" . stripslashes($user_query) . "%') as pert"; $nb_result_concepts = pmb_mysql_result(pmb_mysql_query("SELECT COUNT(distinct id_item) FROM skos_fields_global_index " . $clause, $dbh), 0, 0); if ($nb_result_concepts) { //définition du formulaire $form = "<div style=search_result><form name=\"search_publishers\" action=\"./index.php?lvl=more_results\" method=\"post\">"; $form .= "<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($this->user_query), ENT_QUOTES, $charset) . "\">\n"; if (function_exists("search_other_function_post_values")) { $form .= search_other_function_post_values(); } $form .= "<input type=\"hidden\" name=\"mode\" value=\"concept\">\n"; $form .= "<input type=\"hidden\" name=\"search_type_asked\" value=\"simple_search\">\n"; $form .= "<input type=\"hidden\" name=\"count\" value=\"" . $nb_result_concepts . "\">\n"; $form .= "<input type=\"hidden\" name=\"clause\" value=\"" . htmlentities($clause, ENT_QUOTES, $charset) . "\">"; $form .= "<input type=\"hidden\" name=\"pert\" value=\"" . htmlentities($pert, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"tri\" value=\"" . htmlentities($tri, ENT_QUOTES, $charset) . "\"></form>\n"; $form .= "</div>"; $_SESSION["level1"]["concept"]["form"] = $form; $_SESSION["level1"]["concept"]["count"] = $nb_result_concepts; } return $nb_result_concepts; }
$str .= facettes::make_facette_suggest($user_query); } $form = ""; switch ($search_type) { case 'simple_search': // Gestion des alertes à partir de la recherche simple include_once $include_path . "/alert_see.inc.php"; $form .= $alert_see_mc_values; case 'tags_search': // constitution du form pour la suite $f_values = "<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"mode\" value=\"{$mode}\">\n"; $f_values .= "<input type=\"hidden\" name=\"count\" value=\"{$count}\">\n"; $f_values .= "<input type=\"hidden\" name=\"typdoc\" value=\"" . $typdoc . "\">"; if (function_exists("search_other_function_post_values")) { $f_values .= search_other_function_post_values(); } $f_values .= "<input type=\"hidden\" name=\"clause\" value=\"" . htmlentities($clause, ENT_QUOTES, $charset) . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"clause_bull\" value=\"" . htmlentities($clause_bull, ENT_QUOTES, $charset) . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"clause_bull_num_notice\" value=\"" . htmlentities($clause_bull_num_notice, ENT_QUOTES, $charset) . "\">\n"; if ($opac_indexation_docnum_allfields) { $f_values .= "<input type=\"hidden\" name=\"join\" value=\"" . htmlentities($join, ENT_QUOTES, $charset) . "\">\n"; } $f_values .= "<input type=\"hidden\" name=\"tri\" value=\"" . htmlentities($tri, ENT_QUOTES, $charset) . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"pert\" value=\"" . htmlentities($pert, ENT_QUOTES, $charset) . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"l_typdoc\" value=\"" . htmlentities($l_typdoc, ENT_QUOTES, $charset) . "\">\n"; $f_values .= "<input type=\"hidden\" id=author_type name=\"author_type\" value=\"{$author_type}\">\n"; $f_values .= "<input type=\"hidden\" id=\"id_thes\" name=\"id_thes\" value=\"" . $id_thes . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"surligne\" value=\"" . $surligne . "\">\n"; $f_values .= "<input type=\"hidden\" name=\"tags\" value=\"" . $tags . "\">\n"; $form .= "<form name=\"form_values\" action=\"./index.php?lvl=more_results\" method=\"post\">\n";
function search_docnums() { global $typdoc, $dbh, $charset, $gestion_acces_active, $gestion_acces_empr_notice, $opac_search_other_function, $class_path; global $opac_stemming_active; if ($_SESSION["opac_view"] && $_SESSION["opac_view_query"]) { $opac_view_restrict = " notice_id in (select opac_view_num_notice from opac_view_notices_" . $_SESSION["opac_view"] . ") "; } if ($typdoc) { $restrict = "typdoc='" . $typdoc . "'"; } else { $restrict = ""; } //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'], 16, 'notice_id'); } // on regarde comment la saisie utilisateur se presente $clause = ''; $clause_bull = ''; $clause_bull_num_notice = ''; $add_notice = ''; $aq = new analyse_query(stripslashes($this->user_query), 0, 0, 1, 0, $opac_stemming_active); if ($acces_j) { $members = $aq->get_query_members("explnum", "explnum_index_wew", "explnum_index_sew", "explnum_notice", " explnum_notice=notice_id and explnum_bulletin=0", 0, 0, true); $clause = "where " . $members["where"] . " and (" . $members["restrict"] . ")"; $members_bull = $aq->get_query_members("explnum", "explnum_index_wew", "explnum_index_sew", "explnum_bulletin", " explnum_bulletin=bulletin_id and explnum_notice=0 and num_notice=0 and bulletin_notice=notice_id", 0, 0, true); $clause_bull = "where " . $members_bull["where"] . " and (" . $members_bull["restrict"] . ")"; $members_bull_num_notice = $aq->get_query_members("explnum", "explnum_index_wew", "explnum_index_sew", "explnum_bulletin", " explnum_bulletin=bulletin_id and num_notice=notice_id", 0, 0, true); $clause_bull_num_notice = "where " . $members_bull_num_notice["where"] . " and (" . $members_bull_num_notice["restrict"] . ")"; $statut_j = ''; } else { $members = $aq->get_query_members("explnum", "explnum_index_wew", "explnum_index_sew", "explnum_notice", " explnum_notice=notice_id and statut=id_notice_statut and (((notice_visible_opac=1 and notice_visible_opac_abon=0) and (explnum_visible_opac=1 and explnum_visible_opac_abon=0)) " . ($_SESSION["user_code"] ? " or ((notice_visible_opac_abon=1 and notice_visible_opac=1) and (explnum_visible_opac=1 and explnum_visible_opac_abon=1)) or ((notice_visible_opac_abon=0 and notice_visible_opac=1) and (explnum_visible_opac=1 and explnum_visible_opac_abon=1))" : "") . ")", 0, 0, true); $clause = "where " . $members["where"] . " and (" . $members["restrict"] . ")"; $members_bull = $aq->get_query_members("explnum", "explnum_index_wew", "explnum_index_sew", "explnum_bulletin", " explnum_bulletin=bulletin_id and bulletin_notice=notice_id and num_notice=0 and statut=id_notice_statut and (((notice_visible_opac=1 and notice_visible_opac_abon=0) and (explnum_visible_opac=1 and explnum_visible_opac_abon=0)) " . ($_SESSION["user_code"] ? " or ((notice_visible_opac_abon=1 and notice_visible_opac=1) and (explnum_visible_opac=1 and explnum_visible_opac_abon=1)) or ((notice_visible_opac_abon=0 and notice_visible_opac=1) and (explnum_visible_opac=1 and explnum_visible_opac_abon=1))" : "") . ")", 0, 0, true); $clause_bull = "where " . $members_bull["where"] . " and (" . $members_bull["restrict"] . ")"; $members_bull_num_notice = $aq->get_query_members("explnum", "explnum_index_wew", "explnum_index_sew", "explnum_bulletin", " explnum_bulletin=bulletin_id and num_notice=notice_id and statut=id_notice_statut and (((notice_visible_opac=1 and notice_visible_opac_abon=0) and (explnum_visible_opac=1 and explnum_visible_opac_abon=0)) " . ($_SESSION["user_code"] ? " or ((notice_visible_opac_abon=1 and notice_visible_opac=1) and (explnum_visible_opac=1 and explnum_visible_opac_abon=1)) or ((notice_visible_opac_abon=0 and notice_visible_opac=1) and (explnum_visible_opac=1 and explnum_visible_opac_abon=1))" : "") . ")", 0, 0, true); $clause_bull_num_notice = "where " . $members_bull_num_notice["where"] . " and (" . $members_bull_num_notice["restrict"] . ")"; $statut_j = ',notice_statut'; } if ($opac_search_other_function) { $add_notice = search_other_function_clause(); if ($add_notice) { $clause .= ' and notice_id in (' . $add_notice . ')'; $clause_bull .= ' and notice_id in (' . $add_notice . ')'; $clause_bull_num_notice .= ' and notice_id in (' . $add_notice . ')'; } } $search_terms = $aq->get_positive_terms($aq->tree); //On enlève le dernier terme car il s'agit de la recherche booléenne complète unset($search_terms[count($search_terms) - 1]); $pert = $members["select"] . " as pert"; $tri = "order by pert desc, index_serie, tnvol, index_sew"; if ($restrict) { $clause .= " and " . $restrict; $clause_bull .= " and " . $restrict; $clause_bull_num_notice .= " and " . $restrict; } if ($opac_view_restrict) { $clause .= " and " . $opac_view_restrict; } if ($clause) { // instanciation de la nouvelle requête $q_docnum_noti = "select explnum_id from explnum, notices {$statut_j} {$acces_j} {$clause}"; $q_docnum_bull = "select explnum_id from bulletins, explnum, notices {$statut_j} {$acces_j} {$clause_bull}"; $q_docnum_bull_notice = "select explnum_id from bulletins, explnum, notices {$statut_j} {$acces_j} {$clause_bull_num_notice}"; $q_docnum = "select count(explnum_id) from ( {$q_docnum_noti} UNION {$q_docnum_bull} UNION {$q_docnum_bull_notice}) as uni\t"; $docnum = mysql_query($q_docnum, $dbh); $nb_result_docnum = 0; if ($docnum && mysql_num_rows($docnum)) { $nb_result_docnum = mysql_result($docnum, 0, 0); } $req_typdoc_noti = "select distinct typdoc from explnum,notices {$statut_j} {$acces_j} {$clause} group by typdoc"; $req_typdoc_bull = "select distinct typdoc from bulletins, explnum,notices {$statut_j} {$acces_j} {$clause_bull} group by typdoc"; $req_typdoc_bull_num_notice = "select distinct typdoc from bulletins, explnum,notices {$statut_j} {$acces_j} {$clause_bull_num_notice} group by typdoc"; $req_typdoc = "({$req_typdoc_noti}) UNION ({$req_typdoc_bull}) UNION ({$req_typdoc_bull_num_notice})"; $res_typdoc = mysql_query($req_typdoc, $dbh); $t_typdoc = array(); if ($res_typdoc && mysql_num_rows($res_typdoc)) { while ($tpd = mysql_fetch_object($res_typdoc)) { $t_typdoc[] = $tpd->typdoc; } } $l_typdoc = implode(",", $t_typdoc); if ($nb_result_docnum) { $form = "<form name=\"search_docnum\" action=\"./index.php?lvl=more_results\" method=\"post\">"; $form .= "<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($this->user_query), ENT_QUOTES, $charset) . "\">\n"; if (function_exists("search_other_function_post_values")) { $form .= search_other_function_post_values(); } $form .= "<input type=\"hidden\" name=\"mode\" value=\"docnum\">\n"; $form .= "<input type=\"hidden\" name=\"search_type_asked\" value=\"simple_search\">\n"; $form .= "<input type=\"hidden\" name=\"count\" value=\"" . $nb_result_docnum . "\">\n"; $form .= "<input type=\"hidden\" name=\"clause\" value=\"" . htmlentities($clause, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"clause_bull\" value=\"" . htmlentities($clause_bull, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"clause_bull_num_notice\" value=\"" . htmlentities($clause_bull_num_notice, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"pert\" value=\"" . htmlentities($pert, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"l_typdoc\" value=\"" . htmlentities($l_typdoc, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"tri\" value=\"" . htmlentities($tri, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" name=\"search_terms\" value=\"" . htmlentities(serialize($search_terms), ENT_QUOTES, $charset) . "\"></form>\n"; $_SESSION["level1"]["docnum"]["form"] = $form; $_SESSION["level1"]["docnum"]["count"] = $nb_result_docnum; } } }