get_sel_header_template(); print $this->get_js_script(); if(!$this->user_input) { $this->user_input = '*'; } print $this->get_display_list(); print $this->get_sel_footer_template(); } protected function get_marc_list_instance() { if($this->search_field_id) { if(!isset($this->search)) { $this->search = new search($this->search_xml_file); } $p=explode('_', $this->search_field_id); if($p[0] == 'f') { return new marc_list($this->search->fixedfields[$p[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]); } } } protected function filter_from_search($marc_list_instance) { $p=explode('_', $this->search_field_id); if($p[0] == 'f') { $array_selector = $this->search->get_options_list_field($this->search->fixedfields[$p[1]]); $marc_list_instance->table = $array_selector; } return $marc_list_instance; } protected function get_display_list() { global $nb_per_page; global $page; global $letter; global $msg; $display_list = ''; if(!$page) { $debut = 0; } else { $debut = ($page-1)*$nb_per_page; } $marc_list_instance = $this->get_marc_list_instance(); if(isset($this->search)) { $marc_list_instance = $this->filter_from_search($marc_list_instance); } $amarc_list=$marc_list_instance->table; $special = false; $favorite = false; $alphabet = array(); //attention pour le tri aux valeurs accentuées + minuscules/majuscules $tmp=array(); $tmp=array_map("convert_diacrit",$amarc_list);//On enlève les accents $tmp=array_map("strtoupper",$tmp);//On met en majuscule asort($tmp);//Tri sur les valeurs en majuscule sans accent foreach ( $tmp as $key => $value ) { $tmp[$key]=$amarc_list[$key];//On reprend les bons couples clé / libellé } $amarc_list=$tmp; foreach($amarc_list as $key => $val) { if ($key>=900) { $special=true; } else { $alphabet[] = strtoupper(convert_diacrit(pmb_substr($val,0,1))); } if (isset($marc_list_instance->tablefav[$key])) $favorite=true; } $alphabet = array_unique($alphabet); if(!$letter) { if ($favorite) { $letter = "Fav"; } elseif ($special) { $letter="My"; } else { $letter = "a"; } } // affichage d'un sommaire par lettres $display_list .= "
"; if ($favorite) { if ($letter!='Fav') { $display_list .= "".$msg['favoris']." "; } else { $display_list .= "".$msg['favoris']." "; } } if ($special) { if ($letter!='My') $display_list .= "# "; else $display_list .= "# "; } foreach($alphabet as $dummykey=>$char) { //attention accents + maj/minuscules sur pmb_grep_preg $tmp=array(); $tmp=array_map("convert_diacrit",$amarc_list);//On enlève les accents $tmp=array_map("strtoupper",$tmp);//On met en majuscule $present = pmb_preg_grep("/^$char/i", $tmp); if (!empty($present) && strcasecmp($letter, $char)) { $display_list .= "$char "; } else if(!strcasecmp($letter, $char)) { $display_list .= "$char "; } } $display_list .= "

"; $display = array(); foreach($marc_list_instance->table as $index=>$value ) { if((preg_match("/^$letter/i", convert_diacrit($value))) ||(($letter=='My')&&($index>=900)) ||(($letter=='Fav')&&($marc_list_instance->tablefav[$index]))) { $display[] = $this->get_display_element($index, $value); } } $display_list .= "
"; foreach($display as $dummykey=>$link) { $display_list .= $link; } $display_list .= "
"; return $display_list; } protected function get_display_element($index='', $value='') { global $charset; global $caller; global $callback; $display = "
$value
$index
"; return $display; } public static function get_params_url() { global $search_xml_file, $search_field_id; $params_url = parent::get_params_url(); $params_url .= ($search_xml_file ? "&search_xml_file=".$search_xml_file : "").($search_field_id ? "&search_field_id=".$search_field_id : ""); return $params_url; } public function get_title() { $title = ""; if($this->search_field_id) { $this->search = new search($this->search_xml_file); $p=explode('_', $this->search_field_id); if($p[0] == 'f') { $title = $this->search->fixedfields[$p[1]]['TITLE']; } } return $title; } public function set_search_xml_file($search_xml_file) { $this->search_xml_file = $search_xml_file; } public function set_search_field_id($search_field_id) { $this->search_field_id = $search_field_id; } } ?>