function GL() { // get all province $estateProvince = new Estatecity(); $estateProvince->order_by('position', 'asc'); $estateProvince->get_iterated(); $dis['estateProvince'] = $estateProvince; // get all Areas $estateAreas = new Estatearea(); $estateAreas->order_by('position', 'asc'); $estateAreas->get_iterated(); $dis['estateAreas'] = $estateAreas; // get all Prices $estatePrices = new Estateprice(); $estatePrices->order_by('position', 'asc'); $estatePrices->get_iterated(); $dis['estatePrices'] = $estatePrices; // get all Direction $estateDirection = new Estatedirection(); $estateDirection->order_by('position', 'asc'); $estateDirection->get_iterated(); $dis['estateDirection'] = $estateDirection; // get all District $estateDistrict = new Estatedistrict(); $estateDistrict->order_by('position', 'asc'); $estateDistrict->get_iterated(); $dis['estateDistrict'] = $estateDistrict; // get estates new $estatesNew = new Estate(); $estatesNew->order_by('created', 'desc'); $estatesNew->where('active', 0); $estatesNew->get(12); $dis['estatesNew'] = $estatesNew; // get estates vip $estatesVip = new Estate(); $estatesVip->order_by('created', 'desc'); $estatesVip->where('isVip', 1); $estatesVip->where('active', 0); $estatesVip->get_iterated(); $dis['estatesVip'] = $estatesVip; // get news view most $newViewMost = new Article(); $newViewMost->where('recycle', 0); $newViewMost->where_in('newscatalogue_id', $this->listAllCat); $newViewMost->order_by('view_count', 'desc'); $newViewMost->get(10); $dis['newViewMost'] = $newViewMost; //load view $this->isRobotFollow = 3; $dis['base_url'] = base_url(); $dis['view'] = 'front/includes/main_content'; $this->viewfront($dis); }
function GL() { // get all province $estateProvince = new Estatecity(); $estateProvince->order_by('position', 'asc'); $estateProvince->get_iterated(); $dis['estateProvince'] = $estateProvince; // get all Areas $estateAreas = new Estatearea(); $estateAreas->order_by('position', 'asc'); $estateAreas->get_iterated(); $dis['estateAreas'] = $estateAreas; // get all Prices $estatePrices = new Estateprice(); $estatePrices->order_by('position', 'asc'); $estatePrices->get_iterated(); $dis['estatePrices'] = $estatePrices; // get all Direction $estateDirection = new Estatedirection(); $estateDirection->order_by('position', 'asc'); $estateDirection->get_iterated(); $dis['estateDirection'] = $estateDirection; // get all District $estateDistrict = new Estatedistrict(); $estateDistrict->order_by('position', 'asc'); $estateDistrict->get_iterated(); $dis['estateDistrict'] = $estateDistrict; // get estates new $estatesNew = new Estate(); $estatesNew->order_by('created', 'desc'); $estatesNew->get(25); $dis['estatesNew'] = $estatesNew; // get estates vip $estatesVip = new Estate(); $estatesVip->order_by('id', 'desc'); $estatesVip->where('isVip', 1); $estatesVip->get(10); $dis['estatesVip'] = $estatesVip; //load view $dis['base_url'] = base_url(); $dis['view'] = 'front/includes/main_content'; $this->viewfront($dis); }
function list_by_parent($id, $offset = 0, $limit = 10) { 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); $object_id = $keylist[1]; $object = new Estatedistrict($object_id); $object->position = $this->input->post($key); $object->save(); $object->clear(); } } } $city_id = $this->input->post('city_id'); flash_message('success', 'Cập nhật thành công.'); redirect($this->admin . 'estatedistricts/list_by_parent/' . $city_id); } $city = new Estatecity($id); $districts = new Estatedistrict(); $districts->where('estatecity_id', $id); $districts->order_by('position', 'asc'); $districts->get_iterated(); //$districts->get_paged($offset,$limit,TRUE); //setPagination($this->admin.'estatedistricts/list_by_parent/'.$id.'/',$districts->paged->total_rows,$limit,5); $dis['districts'] = $districts; $dis['city'] = $city; $dis['base_url'] = base_url(); $dis['view'] = 'estatedistrict/list_by_parent'; $dis['menu_active'] = 'Thành phố/Tỉnh'; $dis['title'] = "Danh sách các Quận/Huyện thuộc <span style='color:#F00;'>" . $city->name . '</span>'; $dis['title_table'] = "Trang hiện tại:" . $districts->paged->current_page . '/' . $districts->paged->total_pages; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estatecitys/list_all/", "onclick" => ""), array("type" => "add", "text" => "Thêm", "link" => "{$this->admin_url}estatedistricts/edit_by_parent/" . $city->id, "onclick" => "")); $this->viewadmin($dis); }
function changeAccount() { if ($this->session->userdata('userLoginFlag') != 1) { redirect(base_url()); } $this->page_title = "Tài khoản thành viên " . base_url(); $customer = new Estateuser($this->session->userdata('userLoginId')); if (!$customer->exists()) { show_404(); } $msg = ""; if ($_SERVER['REQUEST_METHOD'] == "POST") { $customer->name = $this->input->post('name'); //$customer->username = $this->input->post('username'); //$customer->email = $this->input->post('email'); /*$customer->yahoo = $this->input->post('yahoo'); $customer->skype = $this->input->post('skype');*/ $customer->mobilePhone = $this->input->post('mobilePhone'); $customer->mobile = $this->input->post('mobile'); $customer->address = $this->input->post('address'); $customer->estatecity_id = $this->input->post('estatecity_id'); $customer->estatedistrict_id = $this->input->post('estatedistrict_id'); if ($customer->save()) { $msg = "Thông tin cá nhân đã được thay đổi"; $type = 2; } else { $msg = "Có lỗi trong quá trình cập nhật thông tin cá nhân. Vui lòng thử lại"; $type = 2; } } $district = new Estatedistrict(); $district->where('estatecity_id', $customer->estatecity_id); $district->get_iterated(); $dis['district'] = $district; $dis['customer'] = $customer; $dis['base_url'] = base_url(); $dis['view'] = 'front/user/change-account'; $dis['msg'] = $msg; $this->viewfront($dis); }
function editFree($id = 0) { $estate = new estate($id); if ($_SERVER['REQUEST_METHOD'] == "POST") { $this->load->helper('remove_vn_helper'); $this->load->library('file_lib'); $estate->estatecity_id = $this->input->post('estatecity_id'); $estate->estatedistrict_id = $this->input->post('estatedistrict_id'); $estate->estateward_id = $this->input->post('estateward_id'); $estate->estatedirection_id = $this->input->post('estatedirection_id'); $estate->estatecatalogue_id = $this->input->post('estatecatalogue_id'); $estate->estatetype_id = $this->input->post('estatetype_id'); $estate->estatearea_id = $this->input->post('estatearea_id'); $estate->estateprice_id = $this->input->post('estateprice_id'); $estate->address = $this->input->post('address'); $estate->isArea = $this->input->post('IsArea'); $estate->area = $this->input->post('area'); $estate->legally = $this->input->post('legally'); $estate->isPrice = $this->input->post('IsPrice'); $estate->price_text = $this->input->post('price_text'); $estate->estatedirection_id = $this->input->post('estatedirection_id'); $estate->title = $this->input->post('title'); $estate->description = $this->input->post('description'); $estate->price_text = $this->input->post('price_text'); $estate->area_text = $this->input->post('area_text'); $estate->article_id = $this->input->post('article_id'); $estate->price_type = $this->input->post('price_type'); if ($estate->isVip == 0) { $estate->updateTime = date('Y-m-d H:i:s'); } else { $estate->created = $estate->created; $estate->updated = $estate->updated; $estate->updateTime = date('Y-m-d H:i:s'); } $estate->name_contact = $this->input->post('name_contact'); $estate->address_contact = $this->input->post('address_contact'); $estate->phone_contact = $this->input->post('phone_contact'); $estate->mobile_contact = $this->input->post('mobile_contact'); $estate->email_contact = $this->input->post('email_contact'); $estate->tag = $this->input->post('tag'); $tags = remove_vn($this->input->post('tag') . ' ' . $this->input->post('title')); $tags = explode('-', $tags); $estate->tag_search = implode(' ', $tags); $estate->title_none = remove_vn($this->input->post('title')) . $estate->code; // Change images default if ($_FILES['image']['name'] != "") { $folder = 'img/project/'; $dataupload = $this->file_lib->upload('image', $folder, $rename_file = true); if (!is_array($dataupload)) { flash_message('error', $dataupload); $estate->photo = ''; } else { $estate->photo = $folder . $dataupload['file_name']; } } if ($estate->save()) { flash_message('success', 'Bản tin đã được thay đổi thành công.'); redirect($this->admin_url . 'estates/listFree/'); //redirect($this->admin_url.'estates/editFree/'.$estate->id); } else { flash_message('error', 'Đã có lỗi xãy ra !'); //redirect($this->admin_url.'estates/listFree/'); redirect($this->admin_url . 'estates/editFree/' . $estate->id); } } $estateCategory = new Estatecatalogue(); $estateCategory->get_iterated(); $dis['estateCategory'] = $estateCategory; $estateType = new Estatetype(); $estateType->order_by('id'); $estateType->where('estatecatalogue_id', $estate->estatecatalogue_id); $estateType->get_iterated(); $dis['estateType'] = $estateType; $estateAreas = new Estatearea(); $estateAreas->order_by('position'); $estateAreas->get_iterated(); $dis['estateAreas'] = $estateAreas; $estateDirection = new Estatedirection(); $estateDirection->order_by('id'); $estateDirection->get_iterated(); $dis['estateDirection'] = $estateDirection; $estatePrices = new Estateprice(); $estatePrices->where('estatecatalogue_id', $estate->estatecatalogue_id); $estatePrices->order_by('position', 'asc'); $estatePrices->get_iterated(); $dis['estatePrices'] = $estatePrices; $estateCities = new Estatecity(); $estateCities->order_by('id'); $estateCities->get_iterated(); $dis['estateCities'] = $estateCities; $estateDictricts = new Estatedistrict(); $estateDictricts->where('estatecity_id', $estate->estatecity_id); $estateDictricts->order_by('position', 'asc'); $estateDictricts->get_iterated(); $dis['estateDictricts'] = $estateDictricts; $estateWards = new Estateward(); $estateWards->where('estatedistrict_id', $estate->estatedistrict_id); $estateWards->order_by('position'); $estateWards->get_iterated(); $dis['estateWards'] = $estateWards; $project = new Article(); $project->where('recycle', 0); $project->where('estatecity_id', $estate->estatecity_id); $project->order_by('title_vietnamese', 'asc'); $project->get_iterated(); $dis['project'] = $project; $dis['object'] = $estate; $dis['base_url'] = base_url(); $dis['view'] = 'estate/edit_free'; $dis['menu_active'] = 'Tin bất động sản (miễn phí)'; $dis['title'] = "Thêm/Sửa Tin '" . $estate->title . "'"; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estates/listFree", "onclick" => "")); $this->viewadmin($dis); }