function count_estate_by_type_and_city($city_id, $estatetype_id) { $CI =& get_instance(); $estates = new Estate(); $estates->where('estatecity_id', $city_id); $estates->where('estatetype_id', $estatetype_id); $estates->where(array('active' => 0, 'isFree' => 0)); $estates->get(); return $estates->result_count(); }
function tagsDangTin($url) { $title = geturlfromuri($this->uri->segment(2)); $tags = explode('-', $title); $title = implode(' ', $tags); $estates = new Estate(); $estates->order_by('created', 'desc'); $estates->group_start(); $estates->like('tag_search', '%' . $title . '%'); $estates->group_end(); $estates->get(); $dis['estates'] = $estates; // seo $this->page_title = $title . ' | ' . $this->page_title; $this->page_description = "Có " . $estates->result_count() . " kết quả tìm kiếm với từ khóa " . $title . ' | ' . $this->page_description; $this->page_keyword = $this->page_keyword; $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/tags'; $this->viewfront($dis); }
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); }
function postDetail($url) { $typeNameNone = $this->uri->segment(1, ""); $type = new Estatetype(); $type->where('name_none', $typeNameNone)->get(); if ($type->exists()) { show_404(); } $cate = new Estatecatalogue(); $cate->where('name_none', $this->uri->segment(1, ''))->get(); if (!$cate->exists()) { show_404(); } $dis['cate'] = $cate; $url = geturlfromuri($this->uri->segment(3)); $estate = new Estate(); $estate->where('title_none', $url); $estate->where_related_estatecatalogue('id', $cate->id); $estate->where('active', 0); $estate->get(); if (!$estate->exists()) { redirect(base_url() . $this->uri->segment(1, '') . '-' . $this->uri->segment(2, '')); die; } $dis['o'] = $estate; $photo = new Estate_photo(); $photo->where('estate_id', $estate->id); $photo->get_iterated(); $dis['photo'] = $photo; $tag = $estate->tag; $dis['tag'] = explode(',', $tag); $description = str_replace(array("\r", "\n"), '', strip_tags($estate->description)); $keyword = explode(' ', $estate->title); $this->page_title = $estate->title . ' | SotayNhadat.vn'; $this->page_description = cut_string($description, 180); $this->page_keyword = implode(', ', $keyword); /*Get estate related vip*/ $estates_vip = new Estate(); $estates_vip->where('id !=', $estate->id); $estates_vip->where('estatetype_id', $estate->estatetype_id); $estates_vip->where('estatecity_id', $estate->estatecity_id); $estates_vip->where('estateprice_id', $estate->estateprice_id); $estates_vip->where('isVip', 1); $estates_vip->where('active', 0); $estates_vip->order_by('created', 'desc'); $estates_vip->get(10); $count_vip = $estates_vip->result_count(); $dis['estates_vip'] = $estates_vip; /*Get estate related follow type, city and price*/ $estates_related_type_city_area = new Estate(); $estates_related_type_city_area->where('id !=', $estate->id); $estates_related_type_city_area->where('estatetype_id', $estate->estatetype_id); $estates_related_type_city_area->where('estatecity_id', $estate->estatecity_id); $estates_related_type_city_area->where('estateprice_id', $estate->estateprice_id); $estates_related_type_city_area->where('isVip', 0); $estates_related_type_city_area->where('active', 0); $estates_related_type_city_area->order_by('created', 'desc'); $estates_related_type_city_area->get(10 - $count_vip); $dis['estates_related_type_city_area'] = $estates_related_type_city_area; $count_type_city_area = $estates_related_type_city_area->result_count(); /*Get all id estate*/ $list_estates_id = array(0); foreach ($estates_related_type_city_area as $row) { array_push($list_estates_id, $row->id); } /*Get estate related follow type, city and area*/ if (10 - $count_vip - $count_type_city_area > 0) { /*If count more than 10*/ $estates_related_area_price = new Estate(); $estates_related_area_price->where('estatetype_id', $estate->estatetype_id); $estates_related_area_price->where('estatearea_id', $estate->estatearea_id); $estates_related_area_price->where('estatecity_id', $estate->estatecity_id); $estates_related_area_price->where_not_in('id', $list_estates_id); $estates_related_area_price->where('isVip', 0); $estates_related_area_price->where('active', 0); $estates_related_area_price->order_by('created', 'desc'); $estates_related_area_price->get(10 - $count_vip - $count_type_city_area); //$dis['estates_related_area_price'] = $estates_related_area_price; } //$limit_lv3 = $estates_related_area_price->result_count()==$limit_lv2?0:$limit_lv2-$estates_related_area_price->result_count(); foreach ($estates_related_area_price as $row) { array_push($list_estates_id, $row->id); } $estates_related_new = new Estate(); $estates_related_new->where('estatetype_id', $estate->estatetype_id); $estates_related_new->where('estatearea_id', $estate->estatearea_id); $estates_related_new->where('estatecity_id', $estate->estatecity_id); $estates_related_new->where('estateprice_id', $estate->estateprice_id); $estates_related_new->where_not_in('id', $list_estates_id); $estates_related_new->where('active', 0); $estates_related_new->order_by('created', 'desc'); $estates_related_new->get($limit_lv3); $dis['estates_related_new'] = $estates_related_new; $estates_related_price = new Estate(); $estates_related_price->where('estateprice_id', $estate->estateprice_id); $estates_related_price->where('estatecity_id', $estate->estatecity_id); $estates_related_price->where('id !=', $estate->id); $estates_related_price->where('active', 0); $estates_related_price->order_by('created', 'desc'); $estates_related_price->get(10); $dis['estates_related_price'] = $estates_related_price; $estatePrices = new Estateprice(); $estatePrices->where('estatecatalogue_id', $estate->estatecatalogue_id); $estatePrices->order_by('position', 'asc'); $estatePrices->get_iterated(); $dis['estatePrices'] = $estatePrices; $this->isRobotFollow = 3; $dis['base_url'] = base_url(); $dis['view'] = 'front/user/post-detail'; $this->viewfront($dis); }
function staticByPrices() { $url_type = $this->uri->segment(2); $cat_type = new Estatetype(); $cat_type->where('name_none', $url_type)->get(); $dis['cat_type'] = $cat_type; $url_district = $this->uri->segment(3); $cat_districts = new Estatedistrict(); $cat_districts->where('name_none', $url_district)->get(); $dis['cat_districts'] = $cat_districts; $url_price = $this->uri->segment(4); $cat_price = new Estateprice(); $cat_price->where('url', $url_price)->get(); $dis['cat_price'] = $cat_price; $level = 4; $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1); $dis['page'] = $page; $limit = 20; $offset = ($page - 1) * $limit; /*get page estate*/ $estates = new Estate(); $estates->order_by('isVip', 'desc'); $estates->order_by('created', 'desc'); $estates->where_related_estatetype('name_none', $url_type); $estates->where_related_estatedistrict('name_none', $url_district); $estates->where_related_estateprice('url', $url_price); $estates->get_paged($offset, $limit, TRUE); $dis['estates'] = $estates; /*get all estate*/ $estates = new Estate(); $estates->order_by('isVip', 'desc'); $estates->order_by('created', 'desc'); $estates->where_related_estatetype('name_none', $url_type); $estates->where_related_estatedistrict('name_none', $url_district); $estates->where_related_estateprice('url', $url_price); $estates->get(); $total = $estates->result_count(); /*Begin pagination for product*/ $url = 'thong-ke-theo-muc-gia/' . $url_type . '/' . $url_district . '/' . $url_price; $config['base_url'] = site_url($url); $config['total_rows'] = $total; $config['per_page'] = $limit; $config['use_page_numbers'] = TRUE; $config['uri_segment'] = 5; $config['num_links'] = 5; $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); /*End pagination for product*/ $this->page_title = $cat_type->name . ' tại ' . $cat_districts->name . ' giá từ ' . $cat_price->label . ' | ' . $cat_type->name . ' tại ' . $cat_districts->name; $this->page_description = $cat_type->name . ' tại ' . $cat_districts->name . ' giá từ ' . $cat_price->label . ' với đầy đủ hình ảnh, hướng, vị trí khác nhau... để bạn lựa chọn. ' . 'Thông tin ' . $cat_type->name . ' tại ' . $cat_districts->name . ' cập nhật nhất!'; $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/by-prices'; $this->viewfront($dis); }
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); }