예제 #1
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);
 }
예제 #2
0
 public function getEstateByTypeDistrict()
 {
     $typeUrl = $this->uri->segment(1, '');
     $districtUrl = $this->uri->segment(2, '');
     $cityUrl = $this->uri->segment(3, '');
     $type = new Estatetype();
     $type->where('name_none', $typeUrl)->get();
     if (!$type->exists()) {
         show_404();
     }
     $dis['type'] = $type;
     $city = new Estatecity();
     $city->where('name_none', $cityUrl)->get();
     if (!$city->exists()) {
         show_404();
     }
     $dis['city'] = $city;
     $district = new Estatedistrict();
     $district->where('name_none', $districtUrl)->get();
     if (!$district->exists()) {
         show_404();
     }
     $dis['district'] = $district;
     $level = 3;
     $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1);
     $dis['page'] = $page;
     $limit = 20;
     $offset = ($page - 1) * $limit;
     /*get estates by category and type*/
     $estates = new Estate();
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->where('estatecity_id', $city->id);
     $estates->where('estatetype_id', $type->id);
     $estates->where('estatedistrict_id', $district->id);
     $estates->where('active', 0);
     $estates->get_paged($offset, $limit, TRUE);
     $dis['estates'] = $estates;
     /*get estates by category and type*/
     $estatesAll = new Estate();
     $estatesAll->order_by('isVip', 'desc');
     $estatesAll->order_by('created', 'desc');
     $estatesAll->where('estatecity_id', $city->id);
     $estatesAll->where('estatetype_id', $type->id);
     $estatesAll->where('estatedistrict_id', $district->id);
     $estatesAll->where('active', 0);
     $estatesAll->get();
     $total = $estatesAll->result_count();
     /*Begin pagination for product*/
     $url = $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $this->uri->segment(3);
     $config['base_url'] = site_url($url);
     $config['total_rows'] = $total;
     $config['per_page'] = $limit;
     $config['use_page_numbers'] = TRUE;
     $config['uri_segment'] = 4;
     $config['num_links'] = 4;
     $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 = $type->name . ' ' . $district->name . ' | ' . $type->name . ' tại ' . $district->name . ', ' . $city->name;
     $this->page_description = $type->name . ' tại ' . $district->name . ', ' . $city->name . ' với nhiều mức giá, diện tích, hướng, vị trí khác nhau. ' . $type->name . ' ' . $district->name . ' 2015, 2016 mới nhất, cập nhật liên tục...';
     $keyword = explode(" ", $this->page_title);
     $this->page_keyword = str_replace('|,', '', implode(',', $keyword));
     $this->isRobotFollow = 3;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/by_type_address';
     $this->viewfront($dis);
 }