Exemplo n.º 1
0
 function tagsDangTin($url)
 {
     $url = $this->uri->segment(2, "");
     $arrUrl = explode('.', $url);
     $title = $arrUrl[0];
     $query_string = explode($arrUrl[0] . '.html&', $this->uri->segment(2, ""));
     parse_str($query_string[1], $_GET);
     $this->load->library('pagination');
     $limit = 20;
     $page = $_GET['per_page'] == "" ? 1 : $_GET['per_page'];
     $offset = ($page - 1) * $limit;
     $tags = explode('-', $title);
     $title = implode(' ', $tags);
     $estates = new Estate();
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->group_start();
     $estates->like('tag_search', '%' . $title . '%');
     $estates->group_end();
     $estates->get_paged($offset, $limit, TRUE);
     $dis['estates'] = $estates;
     $estatesAll = new Estate();
     $estatesAll->order_by('isVip', 'desc');
     $estatesAll->order_by('created', 'desc');
     $estatesAll->group_start();
     $estatesAll->like('tag_search', '%' . $title . '%');
     $estatesAll->group_end();
     $estatesAll->get_iterated();
     $url = base_url() . $this->uri->segment(1) . '/' . $arrUrl[0] . '.html';
     $config['base_url'] = $url;
     $config['total_rows'] = $estatesAll->result_count();
     $config['per_page'] = $limit;
     $config['use_page_numbers'] = TRUE;
     $config['page_query_string'] = TRUE;
     $config['uri_segment'] = 2;
     $config['num_links'] = 2;
     $config['full_tag_open'] = '<div class="news-pagination">';
     $config['full_tag_close'] = "</div>";
     $config['first_link'] = FALSE;
     $config['first_tag_open'] = '';
     $config['first_tag_close'] = '';
     $config['last_link'] = FALSE;
     $config['last_tag_open'] = '';
     $config['last_tag_close'] = '';
     $config['next_link'] = '>';
     $config['next_tag_open'] = '';
     $config['next_tag_close'] = '';
     $config['prev_link'] = '<';
     $config['prev_tag_open'] = '';
     $config['prev_tag_close'] = '';
     $config['num_tag_open'] = '';
     $config['num_tag_close'] = '';
     $config['cur_tag_open'] = '<span class="active">';
     $config['cur_tag_close'] = '</span>';
     $this->pagination->initialize($config);
     // support seo
     $this->page_title = 'Thông tin ' . $title . ' mới nhất';
     $this->page_description = $title . ' với đầy đủ thông tin giá, hình ảnh, hướng, vị trí...cập nhật nhất';
     $keyword = explode(' ', $this->page_title);
     $this->page_keyword = implode(',', $keyword);
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/tags';
     $this->viewfront($dis);
 }
Exemplo n.º 2
0
 function getEstateByAddress()
 {
     $cityUrl = $this->uri->segment(2, '');
     $districtUrl = $this->uri->segment(3, '');
     $city = new Estatecity();
     $city->where('name_none', $cityUrl)->get();
     if (!$city->exists()) {
         show_404();
     }
     $district = new Estatedistrict();
     $district->where('name_none', $districtUrl)->get();
     if (!$district->exists()) {
         show_404();
     }
     $dis['district'] = $district;
     /*get estates by category and type*/
     $estates = new Estate();
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->where('estatedistrict_id', $district->id);
     $estates->where('isVip', 0);
     $estates->get_iterated();
     $dis['estates'] = $estates;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/by_address';
     $this->viewfront($dis);
 }
Exemplo n.º 3
0
 function listEstates($user_id)
 {
     $estateuser = new Estateuser($user_id);
     $estates = new Estate();
     $estates->where('estateuser_id', $user_id);
     $estates->order_by('created', 'desc');
     $estates->get_iterated();
     $dis['estates'] = $estates;
     $dis['estateuser'] = $estateuser;
     $dis['base_url'] = base_url();
     $dis['view'] = 'estateuser/list_by_user';
     $dis['menu_active'] = "Thành viên";
     $dis['title'] = 'Danh sách các Tin bất động sản của "' . $estateuser->firstname . ' ' . $estateuser->name . '"';
     $dis['title_table'] = "Trang hiện tại:" . $estates->paged->current_page . '/' . $estates->paged->total_pages;
     $this->viewadmin($dis);
 }
Exemplo n.º 4
0
 function searchView()
 {
     $this->isRobotFollow = false;
     $query_string = explode('tim-kiem-bat-dong-san/?', $_SERVER['REQUEST_URI']);
     parse_str($query_string[1], $_GET);
     $estatecatalogue_id = $_GET['danhmuc'];
     $estatetype_id = $_GET['loai'];
     $estatecity_id = $_GET['tinh'];
     $estatedistrict_id = $_GET['huyen'];
     $estatearea_id = $_GET['dientich'];
     $estateprice_id = $_GET['gia'];
     $estatedirection_id = $_GET['huong'];
     $dis['estatecatalogue_id'] = $estatecatalogue_id;
     $level = 1;
     $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1);
     $dis['page'] = $page;
     $page = $_GET['per_page'];
     $limit = 20;
     $offset = ($page - 1) * $limit;
     $estates = new Estate();
     if ($estatecatalogue_id != 0) {
         $estates->where('estatecatalogue_id', $estatecatalogue_id);
     }
     if ($estatetype_id != 0) {
         $estates->where('estatetype_id', $estatetype_id);
     }
     if ($estatecity_id != 0) {
         $estates->where('estatecity_id', $estatecity_id);
     }
     if ($estatedistrict_id != 0) {
         $estates->where('estatedistrict_id', $estatedistrict_id);
     }
     if ($estatearea_id != 0) {
         if ($estatearea_id == -1) {
             $estates->where('isArea', 1);
         } else {
             $estates->where('estatearea_id', $estatearea_id);
         }
     }
     if ($estateprice_id != 0) {
         if ($estateprice_id == -1) {
             $estates->where('isPrice', 1);
         } else {
             $estates->where('estateprice_id', $estateprice_id);
         }
     }
     if ($estatedirection_id != 0) {
         $estates->where('estatedirection_id', $estatedirection_id);
     }
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->get_paged($offset, $limit, TRUE);
     $estatesAll = new Estate();
     if ($estatecatalogue_id != 0) {
         $estatesAll->where('estatecatalogue_id', $estatecatalogue_id);
     }
     if ($estatetype_id != 0) {
         $estatesAll->where('estatetype_id', $estatetype_id);
     }
     if ($estatecity_id != 0) {
         $estatesAll->where('estatecity_id', $estatecity_id);
     }
     if ($estatedistrict_id != 0) {
         $estatesAll->where('estatedistrict_id', $estatedistrict_id);
     }
     if ($estatearea_id != 0) {
         if ($estatearea_id == -1) {
             $estatesAll->where('isArea', 1);
         } else {
             $estatesAll->where('estatearea_id', $estatearea_id);
         }
     }
     if ($estateprice_id != 0) {
         if ($estateprice_id == -1) {
             $estatesAll->where('isPrice', 1);
         } else {
             $estatesAll->where('estateprice_id', $estateprice_id);
         }
     }
     if ($estatedirection_id != 0) {
         $estatesAll->where('estatedirection_id', $estatedirection_id);
     }
     $estatesAll->order_by('isVip', 'desc');
     $estatesAll->order_by('created', 'desc');
     $estatesAll->get_iterated();
     $dis['estates'] = $estates;
     /*Begin pagination for product*/
     $url = $this->uri->segment(1) . '/?danhmuc=' . $_GET['danhmuc'] . '&loai=' . $_GET['get'] . '&tinh=' . $_GET['tinh'] . '&huyen=' . $_GET['huyen'] . '&dientich=' . $_GET['dientich'] . '&gia=' . $_GET['gia'] . '&huong=' . $_GET['huong'];
     $config['base_url'] = site_url($url);
     $config['total_rows'] = $estatesAll->result_count();
     $config['per_page'] = $limit;
     $config['use_page_numbers'] = TRUE;
     $config['page_query_string'] = TRUE;
     $config['uri_segment'] = 2;
     $config['num_links'] = 2;
     $config['full_tag_open'] = '<div class="news-pagination">';
     $config['full_tag_close'] = "</div>";
     $config['first_link'] = FALSE;
     $config['first_tag_open'] = '';
     $config['first_tag_close'] = '';
     $config['last_link'] = FALSE;
     $config['last_tag_open'] = '';
     $config['last_tag_close'] = '';
     $config['next_link'] = '>';
     $config['next_tag_open'] = '';
     $config['next_tag_close'] = '';
     $config['prev_link'] = '<';
     $config['prev_tag_open'] = '';
     $config['prev_tag_close'] = '';
     $config['num_tag_open'] = '';
     $config['num_tag_close'] = '';
     $config['cur_tag_open'] = '<span class="active">';
     $config['cur_tag_close'] = '</span>';
     $this->pagination->initialize($config);
     $this->page_title = "";
     if ($estatecatalogue_id != 0) {
         $estatetype = new Estatetype($estatetype_id);
         $this->page_title .= $estatetype->name;
     }
     if ($estatecity_id != 0) {
         $estatecity = new Estatecity($estatecity_id);
         $this->page_title = $this->page_title . ', ' . $estatecity->name;
     }
     if ($estatedistrict_id != 0) {
         $estatedistrict = new Estatedistrict($estatedistrict_id);
         $this->page_title = $this->page_title . ', ' . $estatedistrict->name;
     }
     if ($estatearea_id != 0) {
         $estatearea = new Estatearea($estatearea_id);
         $this->page_title = $this->page_title . ', ' . $estatearea->label;
     }
     if ($estateprice_id != 0) {
         $estateprice = new Estateprice($estateprice_id);
         $this->page_title = $this->page_title . ', ' . $estateprice->label;
     }
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/search';
     $this->viewfront($dis);
 }
Exemplo n.º 5
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);
 }