function updatePosition() { $positionList = $this->input->post('positionList'); $idList = $this->input->post('idList'); $estateareas = new Estatearea(); for ($i = 0; $i < count($idList); $i++) { $estateareas->where("id", $idList[$i]); $estateareas->get(); $estateareas->position = $positionList[$i]; $estateareas->save(); $estateareas->clear(); } redirect("admin/estateareas/list_all"); }
public function staticByAreas() { $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_areas = $this->uri->segment(4); $cat_areas = new Estatearea(); $cat_areas->where('url', $url_areas)->get(); $dis['cat_areas'] = $cat_areas; $level = 4; $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1); $dis['page'] = $page; $limit = 10; $offset = ($page - 1) * $limit; $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_estatearea('url', $url_areas); $estates->get_paged($offset, $limit, TRUE); $dis['estates'] = $estates; $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_estatearea('url', $url_areas); $estates->get(); $total = $estates->result_count(); /*Begin pagination for product*/ $url = 'thong-ke-theo-dien-tich/' . $url_type . '/' . $url_district . '/' . $url_areas; $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 . ' ' . $cat_districts->name . ' diện tích ' . $cat_areas->label . ' | ' . $cat_type->name . ' tại ' . $cat_districts->name; $this->page_description = $cat_type->name . ' tại ' . $cat_districts->name . ' diện tích ' . $cat_areas->label . ' với nhiều mức giá, vị trí, hình ảnh, hướng... để bạn lựa chọn. ' . $cat_type->name . ' tại ' . $cat_districts->name . ''; $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/by-areas'; $this->viewfront($dis); }