<?php // +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: keyword.inc.php,v 1.43 2013-10-30 15:00:54 dgoron Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // premier niveau de recherche OPAC sur mot-clé require_once $class_path . "/searcher.class.php"; if ($opac_search_other_function) { require_once $include_path . "/" . $opac_search_other_function; } $search_keywords = new searcher_keywords(stripslashes($user_query)); $notices = $search_keywords->get_result(); $nb_result_keywords = $search_keywords->get_nb_results(); $l_typdoc = implode(",", $search_keywords->get_typdocs()); $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]); $form = "<form name=\"search_keywords\" action=\"./index.php?lvl=more_results\" method=\"post\">"; if (function_exists("search_other_function_post_values")) { $form .= search_other_function_post_values(); } $form .= "<input type=\"hidden\" name=\"mode\" value=\"keyword\">\n\t<input type=\"hidden\" name=\"typdoc\" value=\"" . $typdoc . "\">\n \t<input type=\"hidden\" name=\"count\" value=\"" . $nb_result_keywords . "\">\n \t<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "\">\n \t<input type=\"hidden\" name=\"l_typdoc\" value=\"" . htmlentities($l_typdoc, ENT_QUOTES, $charset) . "\">\n </form>"; if ($opac_allow_affiliate_search) { if ($auto_submit) { if ($nb_result_keywords) { print "<div style='search_result'>" . $form . "</div><script type=\"text/javascript\" >\n\t\t\t\tdocument.search_keywords.action = './index.php?lvl=more_results&tab=catalog';\n\t\t\t\tdocument.search_keywords.submit();\n\t\t\t</script>"; }
case "title": case "titre": $searcher = new searcher_title(stripslashes($user_query)); if (!empty($_SESSION["last_sortnotices"])) { $cart_sort = $_SESSION["last_sortnotices"]; } 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 "keyword": $searcher = new searcher_keywords(stripslashes($user_query)); if (!empty($_SESSION["last_sortnotices"])) { $cart_sort = $_SESSION["last_sortnotices"]; } 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 "abstract": $searcher = new searcher_abstract(stripslashes($user_query)); if (!empty($_SESSION["last_sortnotices"])) { $cart_sort = $_SESSION["last_sortnotices"];
print $search_result_affiliate_lvl2_head; } else { print "\t<div id=\"resultatrech\"><h3>{$msg['resultat_recherche']}</h3>\n\n\t\t<div id=\"resultatrech_container\">\n\t\t<div id=\"resultatrech_see\">"; } //le contenu du catalogue est calculé dans 2 cas : // 1- la recherche affiliée n'est pas activée, c'est donc le seul résultat affichable // 2- la recherche affiliée est active et on demande l'onglet catalog... if (!$opac_allow_affiliate_search || $opac_allow_affiliate_search && $tab == "catalog") { // gestion du tri if (isset($_GET["sort"])) { $_SESSION["last_sortnotices"] = $_GET["sort"]; } if ($count > $opac_nb_max_tri) { $_SESSION["last_sortnotices"] = ""; } $searcher = new searcher_keywords(stripslashes($user_query)); if (!isset($count)) { //accès direct sans calcul préalable, on a besoin de recalculer les éléments du paginateur $count = $searcher->get_nb_results(); $nbepages = ceil($count / $opac_search_results_per_page); $catal_navbar = "<div class='row'> </div>"; $catal_navbar .= "<div id='navbar'><hr />\n<center>" . printnavbar($page, $nbepages, $url_page, $action) . "</center></div>"; } if ($opac_allow_tags_search == 1) { print pmb_bidi("<h3><span><b>{$count} " . $msg["results"] . " " . $msg['tags_found'] . " '" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "'"); } else { print pmb_bidi("<h3><span><b>{$count} " . $msg["results"] . " " . $msg['keywords_found'] . " '" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "'"); } if ($opac_search_other_function) { require_once $include_path . "/" . $opac_search_other_function; print pmb_bidi(" " . search_other_function_human_query($_SESSION["last_query"]));
function search_keywords() { global $typdoc, $dbh, $charset; $search_keywords = new searcher_keywords(stripslashes($this->user_query)); $notices = $search_keywords->get_result(); $nb_result_keywords = $search_keywords->get_nb_results(); $l_typdoc = implode(",", $search_keywords->get_typdocs()); /*$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]);*/ if ($nb_result_keywords) { $form = "<form name=\"search_keywords\" action=\"./index.php?lvl=more_results\" method=\"post\">"; if (function_exists("search_other_function_post_values")) { $form .= search_other_function_post_values(); } $form .= "<input type=\"hidden\" name=\"mode\" value=\"keyword\">\n\t\t\t\t<input type=\"hidden\" name=\"search_type_asked\" value=\"simple_search\">\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_keywords . "\">\n\t\t\t \t<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($this->user_query), ENT_QUOTES, $charset) . "\">\n\t\t\t \t<input type=\"hidden\" name=\"l_typdoc\" value=\"" . htmlentities($l_typdoc, ENT_QUOTES, $charset) . "\">\n\t\t\t </form>"; $_SESSION["level1"]["keywords"]["form"] = $form; $_SESSION["level1"]["keywords"]["count"] = $nb_result_keywords; } return $nb_result_keywords; }
case "more_results": //changement de plan ! switch ($mode) { case "tous": $searcher = new searcher_all_fields(stripslashes($user_query)); $notices = $searcher->get_result(); add_notices_to_cart($notices); break; case "title": case "titre": $searcher = new searcher_title(stripslashes($user_query)); $notices = $searcher->get_result(); add_notices_to_cart($notices); break; case "keyword": $searcher = new searcher_keywords(stripslashes($user_query)); $notices = $searcher->get_result(); add_notices_to_cart($notices); break; case "abstract": $searcher = new searcher_abstract(stripslashes($user_query)); $notices = $searcher->get_result(); add_notices_to_cart($notices); break; case "extended": $es = new search(); $table = $es->make_search(); $notices = ''; $q = "select distinct notice_id from {$table} "; $res = mysql_query($q, $dbh); if (mysql_num_rows($res)) {