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_display_query() { if(!$this->user_input) { return "SELECT id_groupe, libelle_groupe FROM groupe "; } else { return "SELECT id_groupe, libelle_groupe FROM groupe WHERE libelle_groupe like '".str_replace("*", "%", $this->user_input)."%' "; } } protected function get_display_element($index='', $value='') { global $charset; global $caller; global $callback; $display = "
".htmlentities($value,ENT_QUOTES, $charset)."
"; return $display; } protected function get_display_list() { global $nb_per_page; global $page; $display_list = ''; if(!$page) { $debut = 0; } else { $debut = ($page-1)*$nb_per_page; } $query = $this->get_display_query(); $result = pmb_mysql_query($query); if($result) { $list = array(); while ($row = pmb_mysql_fetch_array($result)) { $list[$row[0]] = $row[1]; } $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; } } ?>