setDomain(1); if(!isset($aut_type)) $aut_type = ''; switch ($aut_type) { case "concept" : $acces_j = $dom_1->getJoin($PMBuserid,4,'num_object'); break; default : $acces_j = $dom_1->getJoin($PMBuserid,4,'notice_id'); break; } } //Classe générique de recherche define("AUT_LIST",1); define("NOTICE_LIST",2); define("AUT_SEARCH",3); class searcher { public $type; //Type de recherche public $etat; //Etat de la recherche public $page; //Page courante de la recherche public $nbresults; //Nombre de résultats de la dernière recherche public $nbepage; public $nb_per_page; public $id; //Numéro d'autorité pour la recherche public $store_form; //Formulaire contenant les infos de navigation plus des champs pour la recherche public $base_url; public $first_search_result; public $text_query; public $text_query_tri; //pour les tris texte de la requête d'origine modifié par la classe tri public $human_query; public $human_notice_query; public $human_aut_query; public $docnum; public $direct=0; public $rec_history=false; public $sort; public $current_search; //Constructeur public function __construct($base_url,$rec_history=false) { global $type,$etat,$aut_id,$page, $docnum_query,$auto_postage_query; $this->sort = new sort('notices','base'); $this->type=$type; $this->etat=$etat; $this->page=$page; $this->id=$aut_id; $this->base_url=$base_url; $this->rec_history=$rec_history; $this->docnum = ($docnum_query?1:0); $this->auto_postage_query = ($auto_postage_query?1:0); $this->run(); } public function make_store_form() { $this->store_form="
"; $this->store_form.="!!first_search_variables!!"; $this->store_form.="
"; } public function pager() { global $msg; if (!$this->nbresults) return; $etendue=10; $suivante = $this->page+1; $precedente = $this->page-1; if (!$this->page) $page_en_cours=0 ; else $page_en_cours=$this->page ; //Première $nav_bar = ''; if(($page_en_cours+1)-$etendue > 1) { $nav_bar .= "".$msg["; } // affichage du lien précédent si nécéssaire if($precedente >= 0) $nav_bar .= "[$msg[48]]"; $deb = $page_en_cours - 10 ; if ($deb<0) $deb=0; for($i = $deb; ($i < $this->nbepage) && ($i<$page_en_cours+10); $i++) { if($i==$page_en_cours) $nav_bar .= "".($i+1).""; else $nav_bar .= "".($i+1).""; if($i<$this->nbepage) $nav_bar .= " "; } if($suivante<$this->nbepage) $nav_bar .= "[$msg[49]]"; //Dernière if((($page_en_cours+1)+$etendue)<$this->nbepage){ $nav_bar .= "nbepage-1)."; document.store_search.submit(); return false;\">".$msg["; } // affichage de la barre de navigation print "
$nav_bar
"; } public function show_notice() { } public function run() { global $pmb_map_activate; if (!$this->etat) { $this->show_form(); } else { switch ($this->etat) { case "first_search": $r=$this->make_first_search(); //echo "req first:".$this->text_query."
"; $this->first_search_result=$r; switch ($r) { case AUT_LIST: $this->make_store_form(); $this->store_search(); $this->aut_list(); $this->pager(); break; case NOTICE_LIST: $this->make_store_form(); $this->store_search(); $this->sort_notices(); $this->notice_list(); $this->pager(); break; case AUT_SEARCH: $this->etat="aut_search"; $this->direct=1; $this->make_aut_search(); $this->make_store_form(); $this->aut_store_search(); $this->sort_notices(); $this->aut_notice_list(); $this->pager(); break; } if ($this->rec_history){ $this->rec_env(); if($pmb_map_activate){ $this->check_emprises(); } } break; case "aut_search": $this->make_aut_search(); $this->make_store_form(); $this->aut_store_search(); $this->sort_notices(); $this->aut_notice_list(); $this->pager(); if ($this->rec_history){ $this->rec_env(); if($pmb_map_activate){ $this->check_emprises(); } } break; } } } public function show_form() { //A surcharger par la fonction qui affiche le formulaire de recherche } public function make_first_search() { //A surcharger par la fonction qui fait la première recherche après la soumission du formulaire de recherche //La fonction renvoie AUT_LIST (le résultat de la recherche est une liste d'autorité) //ou NOTICE_LIST (le résultat de la recherche est une liste de notices) //La fonction doit mettre à jour le nombre de résultats dans $this->nbresults } public function make_aut_search() { //A surcharger par la fonction qui fait la recherche des notices à partir d'un numéro d'autorité (stoqué dans $this->id) //La fonction doit mettre à jour le nombre de résultats dans $this->nbresults } public function store_search() { //A surcharger par la fonction qui écrit les variables du formulaire "store_search" pour stoquer les champs de recherche //En liste de résultat de la première recherche. Il faut remplacer la chaine "!!first_search_variables!!" dans $this->store_form } public function aut_store_search() { //A surcharger par la fonction qui écrit les variables du formulaire "store_search" pour stoquer les champs de recherche //En liste de résultat de la première recherche. Il faut remplacer la chaine "!!first_search_variables!!" dans $this->store_form } public function aut_list() { //A surcharger par la fonction qui affiche la liste des autorités issues de la première recherche } protected function get_display_icon_sort() { global $msg; global $pmb_nb_max_tri; $display = ''; // on affiche l'icone de tri seulement si on a atteint un nb maxi de résultats if ($this->nbresults<=$pmb_nb_max_tri) { //affichage de l'icone de tri $display .= ""; $display .= ""; //si on a un tri actif on affiche sa description if ($_SESSION["tri"]) { $display .= $msg['tri_par']." ".$this->sort->descriptionTriParId($_SESSION["tri"]); } } return $display; } protected function get_display_icons($current, $from_mode=0) { global $msg; global $pmb_allow_external_search; $display = ''; $display .= ""; $display .= "\"".$msg["histo_add_to_cart"]."\""; $tri_id_info = $_SESSION["tri"] ? "&sort_id=".$_SESSION["tri"] : ""; $display .= ""; $display .= "\"".$msg["histo_print"]."\""; $display .= ""; $display .= "\"".$msg["docnum_download"]."\""; if ($pmb_allow_external_search) { $display .= ""; $display .= "\"".$msg["connecteurs_external_search_sources"]."\"/"; } $display .= $this->get_display_icon_sort(); $display .= self::get_quick_actions(); $display .= self::get_search_back_button($this->base_url); $display .= self::get_check_uncheck_all_buttons(); return $display; } public static function get_check_uncheck_all_buttons() { global $msg, $charset; $display = "
"; return $display; } public static function get_search_back_button($url, $type = 'NOTI') { global $msg; switch ($type) { case 'AUT': $form_variable = 'action'; break; case 'NOTI': case 'EXPL': default: $form_variable = 'etat'; break; } return "
"; } public static function get_quick_actions($type = 'NOTI') { global $msg; $actions_to_remove = array( 'transfert' => true, 'edit_cart' => true, 'supprpanier' => true ); switch ($type) { case 'AUT': $array_actions = authorities_caddie::get_array_actions("!!id_caddie!!", "AUT", $actions_to_remove); $module = "autorites"; break; case 'NOTI': case 'EXPL': default: $array_actions = caddie::get_array_actions("!!id_caddie!!", $type, $actions_to_remove); $module = "catalog"; break; } $lines = '
'.$msg["caddie_shortaction_tooltip_title"].' '.$msg["caddie_menu_action"].'
'; if(is_array($array_actions) && count($array_actions)){ foreach($array_actions as $item_action){ $lines .= '
'.$item_action['msg'].'
'; } } $lines .= '
'; return $lines; } protected function get_display_records_list() { $records = array(); while(($nz = pmb_mysql_fetch_object($this->t_query))) { $records[] = $nz->notice_id; } $elements_records_list_ui = new elements_records_list_ui($records, count($records), false); $elements_records_list_ui->add_context_parameter('in_search', '1'); return $elements_records_list_ui->get_elements_list(); } public function notice_list_common($title) { } public function notice_list() { //A surcharger par la fonction qui affiche la liste des notices issues de la première recherche } public function aut_notice_list() { //A surcharger par la fonction qui affiche la liste des notice sous l'autorité $this->id } public function rec_env() { //A surcharger pa la fonction qui enregistre } public static function convert_simple_multi($id_champ) { //A surcharger par la fonction qui convertit des recherches simples en multi-critères } public function sort_notices() { global $msg; global $pmb_nb_max_tri; if ($this->nbresults<=$pmb_nb_max_tri) { if ($_SESSION["tri"]) { //$this->text_query_tri = $this->text_query; //$this->text_query_tri = str_replace("limit ".$this->page*$this->nb_per_page.",".$this->nb_per_page, "limit 0,".$this->nbresults,$this->text_query_tri); //if ($this->nb_per_page) { //$this->sort->limit = "limit ".$this->page*$this->nb_per_page.",".$this->nb_per_page; //} //$this->text_query_tri = $this->sort->appliquer_tri($_SESSION["tri"],$this->text_query,"notice_id"); if ($this->nb_per_page) { $this->text_query_tri = $this->sort->appliquer_tri($_SESSION["tri"],$this->text_query,"notice_id", $this->page*$this->nb_per_page, $this->nb_per_page); //$this->text_query_tri .= " LIMIT ".$this->page*$this->nb_per_page.",".$this->nb_per_page; } else { $this->text_query_tri = $this->sort->appliquer_tri($_SESSION["tri"],$this->text_query,"notice_id",0,0); } // echo ($this->text_query_tri."
"); $this->t_query = @pmb_mysql_query($this->text_query_tri); if (!$this->t_query) { print pmb_mysql_error(); } } else { if (strpos($this->text_query,"limit")===false) { if ($this->nb_per_page) { $this->text_query .= "limit ".$this->page*$this->nb_per_page.",".$this->nb_per_page; } } else { if ($this->nb_per_page) { $this->text_query = str_replace("limit 0,".$this->nbresults,"limit ".$this->page*$this->nb_per_page.",".$this->nb_per_page,$this->text_query); } } $this->t_query=@pmb_mysql_query($this->text_query); } } else { if (strpos($this->text_query,"limit")===false) { if ($this->nb_per_page) { $this->text_query .= "limit ".$this->page*$this->nb_per_page.",".$this->nb_per_page; } } else { if ($this->nb_per_page) { $this->text_query = str_replace("limit 0,".$this->nbresults,"limit ".$this->page*$this->nb_per_page.",".$this->nb_per_page,$this->text_query); } } $this->t_query = @pmb_mysql_query($this->text_query); } } public function get_current_search_map($mode_search=0){ global $pmb_map_activate; global $page; global $aut_id; $map = ""; if($pmb_map_activate){ if(isset($_SESSION["MAP_CURRENT"])){ $this->current_search=$_SESSION["MAP_CURRENT"]; unset($_SESSION["MAP_CURRENT"]); }else{ if (isset($_SESSION['session_history'])) { $this->current_search=count($_SESSION['session_history']); switch($mode_search) { case 2 : case 3 : case 9 : $this->current_search--; } if($aut_id )$this->current_search--; if(isset($page)) $this->current_search--; } } if($this->current_search<=0) $this->current_search = 0; $map = "
"; } return $map; } public function check_emprises(){ global $pmb_map_activate; global $pmb_map_max_holds; global $pmb_map_size_search_result; $map = ""; $size=explode("*",$pmb_map_size_search_result); if(count($size)!=2) { $map_size="width:800px; height:480px;"; } else { if (is_numeric($size[0])) $size[0].= 'px'; if (is_numeric($size[1])) $size[1].= 'px'; $map_size= "width:".$size[0]."; height:".$size[1].";"; } $map_search_controler = new map_search_controler(null, $this->current_search, $pmb_map_max_holds,false); $json = $map_search_controler->get_json_informations(); //Obligatoire pour supprimer les {} $json = substr($json, 1, strlen($json)-2); if($map_search_controler->have_results()){ $map.= ""; }else{ $map.= ""; } print $map; } public function show_error($car,$input,$error_message) { global $browser_url; global $browser,$search_form_editeur; global $msg; $search_form_editeur=str_replace("!!base_url!!",$this->base_url,$search_form_editeur); print $search_form_editeur; error_message($msg["searcher_syntax_error"],sprintf($msg["searcher_syntax_error_desc"],$car,$input,$error_message)); $browser=str_replace("!!browser_url!!",$browser_url,$browser); print $browser; } } class searcher_title extends searcher { public $t_query; public $sorted_result; public function show_form() { global $msg; global $dbh; global $charset,$lang; global $NOTICE_author_query; global $all_query, $docnum_query, $pmb_indexation_docnum_allfields, $pmb_indexation_docnum; global $title_query; global $author_query, $author_query_id; global $categ_query, $categ_query_id, $thesaurus_auto_postage_search, $auto_postage_query; global $thesaurus_concepts_active, $concept_query, $concept_query_id; global $ex_query,$typdoc_query, $statut_query; global $date_parution_start_query, $date_parution_end_query, $date_parution_exact_query; global $thesaurus_concepts_autopostage, $concepts_autopostage_query; // on commence par créer le champ de sélection de document // récupération des types de documents utilisés. $query = "SELECT count(typdoc), typdoc "; $query .= "FROM notices where typdoc!='' GROUP BY typdoc"; $result = @pmb_mysql_query($query, $dbh); $toprint_typdocfield = " \n"; $doctype = new marc_list('doctype'); while (($rt = pmb_mysql_fetch_row($result))) { $obj[$rt[1]]=1; $qte[$rt[1]]=$rt[0]; } foreach ($doctype->table as $key=>$libelle){ if (isset($obj[$key]) && ($obj[$key]==1)){ $toprint_typdocfield .= " \n"; while ($obj = @pmb_mysql_fetch_row($result)) { $toprint_statutfield .= "