99, 'index' => 0, ); function __construct() { parent::__construct(); } function _remap($method) { //echo $method;exit; $this->check_right($this->rights, $method); switch($method) { case 'aaa': break; default: if(method_exists(__CLASS__, $method) == true) { $this->$method(); } else { redirect(''); } } } function index() { if ($this->input->post('frx1_what') !== FALSE || $this->input->post('what') !== FALSE) { $type = 'item'; $this->_care_item_search(); } else if ($this->input->post('frx2_username') !== FALSE) { $type = 'user'; $this->_care_user_search(); } else { show_404(); } // Meta $this->data['meta_title'] = $this->lang->line('search_meta_title').$this->data['meta_title']; $this->data['main_content'] = "search/{$type}_list"; $this->load->view('includes/template', $this->data); } private function _care_user_search() { $what = $this->input->post('frx2_username'); $this->data['what'] = $what; $this->_fill_form_fields(); $limit = SEARCH_USR_CNT; $offset = $this->uri->segment(2); $this->load->model('membership_model'); $usr = $this->membership_model->search_user($what, $limit, $offset); $total = $this->membership_model->search_user_cnt($what); $this->load->helper('item_helper'); $this->data['usr'] = create_user_list($usr, $total, 's'); // Pagination $this->load->helper('pagination_helper'); $this->load->library('pagination'); $config = pagination_config(); $config['base_url'] = base_url().$this->lang->line('url_search'); $config['total_rows'] = $total; $config['per_page'] = $limit; $config['uri_segment'] = 2; $this->pagination->initialize($config); $this->data['page_links'] = $this->pagination->create_links(); $this->_save_what($this->data['what'], 'user'); } private function _care_item_search() { $this->data['what'] = $this->input->post('frx1_what') !== FALSE ? $this->input->post('frx1_what') : $this->input->post('what'); $this->_fill_form_fields(); $this->load->model('item_model'); $limit = SEARCH_ITM_CNT; $offset = $this->uri->segment(2); $itms = $this->item_model->search_item(mysql_real_escape_string($this->data['what']), mysql_real_escape_string($this->search_form_field['frx1_seller']), $this->search_form_field['frx1_price_from'], $this->search_form_field['frx1_price_to'], $this->search_form_field['frx1_cat'], $this->search_form_field['frx1_color'], $this->search_form_field['frx1_status'], $limit, $offset ); $cnt = $this->item_model->search_item_cnt(mysql_real_escape_string($this->data['what']), mysql_real_escape_string($this->search_form_field['frx1_seller']), $this->search_form_field['frx1_price_from'], $this->search_form_field['frx1_price_to'], $this->search_form_field['frx1_cat'], $this->search_form_field['frx1_color'], $this->search_form_field['frx1_status'] ); $this->load->helper('item_helper'); $this->data['itms'] = create_item_list($itms, $cnt, 't'); // Pagination $this->load->helper('pagination_helper'); $this->load->library('pagination'); $config = pagination_config(); $config['base_url'] = base_url().$this->lang->line('url_search'); $config['total_rows'] = $cnt; $config['per_page'] = SEARCH_ITM_CNT; $config['uri_segment'] = 2; $this->pagination->initialize($config); $this->data['page_links'] = $this->pagination->create_links(); $this->_save_what($this->data['what'], 'item'); } private function _fill_form_fields() { if ($this->input->post('what') !== FALSE) { $_POST['frx1_what'] = $this->input->post('what'); } foreach($_POST as $key => $val) { if (isset($this->search_form_field[$key]) === TRUE) { $this->search_form_field[$key] = $this->input->post($key) == '' ? null : $this->input->post($key); } } $this->_care_search_fields(); } private function _save_what($what, $type) { $this->load->model('search_model'); $this->search_model->save_search($what, $type, $this->session->userdata('id')); } } /* End of file seller.php */ /* Location: ./system/application/controllers/seller.php */