Beispiel #1
0
 function list_all($offset = 0, $limit = 100)
 {
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         foreach ($_POST as $key => $value) {
             if (substr($key, 0, 8) == "position") {
                 if (trim($this->input->post($key)) != "") {
                     $keylist = explode("_", $key);
                     $estateuserId = $keylist[1];
                     $estateuser = new estateuser($estateuserId);
                     $estateuser->position = $this->input->post($key);
                     $estateuser->save();
                     $estateuser->clear();
                 }
             }
         }
         flash_message('success', 'Cập nhật thành công.');
         redirect($this->admin . 'estateusers/list_all/');
     }
     $estateusers = new Estateuser();
     $estateusers->order_by('id', 'desc');
     $estateusers->get_paged($offset, $limit, TRUE);
     setPagination($this->admin . 'estateusers/list_all/', $estateusers->paged->total_rows, $limit, 4);
     $dis['estateusers'] = $estateusers;
     $dis['base_url'] = base_url();
     $dis['view'] = 'estateuser/list_all';
     $dis['menu_active'] = 'Thành viên';
     $dis['title'] = "Danh sách các Thành viên";
     $dis['title_table'] = "Trang hiện tại:" . $estateusers->paged->current_page . '/' . $estateusers->paged->total_pages;
     /*
             $dis['nav_menu']=array(
         			array(
         				"type"=>"add",
         				"text"=>"Thêm",
         				"link"=>"{$this->admin_url}estateusers/edit/",
         				"onclick"=>""		
         			)
     );
     */
     $this->viewadmin($dis);
 }
Beispiel #2
0
 function searchFree($params)
 {
     $this->load->library('pagination');
     parse_str(array_pop(explode('?', $_SERVER['REQUEST_URI'], 2)), $_GET);
     $limit = 50;
     $offset = $_GET['per_page'] == "" ? 0 : $_GET['per_page'];
     $estates = new Estate();
     $estates->where('isFree', 1);
     $estates->order_by('id', 'desc');
     if ($_GET['searchKey'] != "" && isset($_GET['searchKey'])) {
         $estates->like('code', $_GET['searchKey']);
     }
     if ($_GET['estatecatalogue_id'] != "" && isset($_GET['estatecatalogue_id'])) {
         $estates->where('estatecatalogue_id', $_GET['estatecatalogue_id']);
     }
     if ($_GET['estatetype_id'] != "" && isset($_GET['estatetype_id'])) {
         $estates->where('estatetype_id', $_GET['estatetype_id']);
     }
     if ($_GET['estateprice_id'] != "" && isset($_GET['estateprice_id'])) {
         $estates->where('estateprice_id', $_GET['estateprice_id']);
     }
     if ($_GET['estatearea_id'] != "" && isset($_GET['estatearea_id'])) {
         $estates->where('estatearea_id', $_GET['estatearea_id']);
     }
     if ($_GET['isReals'] != "" && isset($_GET['isReals'])) {
         if ($_GET['isReals'] != -1) {
             $estates->where('isReals', $_GET['isReals']);
         }
     }
     $estates->get_paged($offset, $limit, TRUE);
     // get all estate search
     $estatesAll = new Estate();
     $estatesAll->where('isFree', 1);
     $estatesAll->order_by('id', 'desc');
     if ($_GET['searchKey'] != "" && isset($_GET['searchKey'])) {
         $estatesAll->like('code', $_GET['searchKey']);
     }
     if ($_GET['estatecatalogue_id'] != "" && isset($_GET['estatecatalogue_id'])) {
         $estatesAll->where('estatecatalogue_id', $_GET['estatecatalogue_id']);
     }
     if ($_GET['estatetype_id'] != "" && isset($_GET['estatetype_id'])) {
         $estatesAll->where('estatetype_id', $_GET['estatetype_id']);
     }
     if ($_GET['estateprice_id'] != "" && isset($_GET['estateprice_id'])) {
         $estatesAll->where('estateprice_id', $_GET['estateprice_id']);
     }
     if ($_GET['estatearea_id'] != "" && isset($_GET['estatearea_id'])) {
         $estatesAll->where('estatearea_id', $_GET['estatearea_id']);
     }
     if ($_GET['isReals'] != "" && isset($_GET['isReals'])) {
         if ($_GET['isReals'] != -1) {
             $estatesAll->where('isReals', $_GET['isReals']);
         }
     }
     $estatesAll->get_iterated();
     $url = $_SERVER['REQUEST_URI'];
     $config['base_url'] = $url;
     $config['total_rows'] = $estatesAll->result_count();
     $config['per_page'] = $limit;
     $config['page_query_string'] = TRUE;
     $this->pagination->initialize($config);
     $estateareas = new Estatearea();
     $estateareas->order_by('position', 'asc');
     $estateareas->get_iterated();
     $dis['estateareas'] = $estateareas;
     $estateusers = new Estateuser();
     $estateusers->order_by('name', 'asc');
     $estateusers->get_iterated();
     $dis['estateusers'] = $estateusers;
     $dis['estates'] = $estates;
     $dis['page_i'] = $offset;
     $dis['base_url'] = base_url();
     $dis['view'] = 'estate/searchFree';
     $dis['menu_active'] = 'Tin bất động sản (miễn phí)';
     $dis['title'] = "Tìm kiếm bất động sản";
     $this->viewadmin($dis);
 }