search = new search($this->search_xml_file);
}
public function proceed() {
global $page;
print $this->get_sel_header_template();
print $this->get_search_form();
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_filter_result($list) {
foreach ($list as $key=>$value) {
if(!preg_match('`'.str_replace('*', '', addslashes($this->user_input)).'`i', $value)) {
unset($list[$key]);
}
}
return $list;
}
protected function get_display_list() {
global $nb_per_page;
global $page;
global $no_display;
$display_list = '';
if(!$page) {
$debut = 0;
} else {
$debut = ($page-1)*$nb_per_page;
}
$p=explode('_', $this->search_field_id);
if($p[0] == 'f') {
$query=$this->search->fixedfields[$p[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"];
if ($this->search->fixedfields[$p[1]]["INPUT_FILTERING"] == "yes") {
$this->search->access_rights();
$query = str_replace("!!acces_j!!", $this->search->tableau_access_rights["acces_j"], $query);
$query = str_replace("!!statut_j!!", $this->search->tableau_access_rights["statut_j"], $query);
$query = str_replace("!!statut_r!!", $this->search->tableau_access_rights["statut_r"], $query);
}
}
$result = pmb_mysql_query($query);
if($result) {
$list = array();
while ($row = pmb_mysql_fetch_array($result)) {
$list[$row[0]] = $row[1];
}
if($this->user_input && $this->user_input != '*') {
$list = $this->get_filter_result($list);
}
$this->nbr_lignes = count($list);
if($this->nbr_lignes) {
$list = array_slice($list, $debut, $nb_per_page, true);
foreach ($list as $key=>$element) {
$display_list .= $this->get_display_element($key, $element);
}
$display_list .= $this->get_pagination();
} else {
$display_list .= $this->get_message_not_found();
}
}
return $display_list;
}
protected function get_display_element($key='', $value='') {
global $msg, $charset;
global $caller;
global $callback;
$display = '';
$display .= pmb_bidi("".
htmlentities($value,ENT_QUOTES, $charset)."
");
return $display;
}
public function get_sel_search_form_template() {
global $msg, $charset;
$sel_search_form ="