public function postFree() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $o = new Estate(); $o->estatecity_id = $this->input->post('estatecity_id'); $o->estatedistrict_id = $this->input->post('estatedistrict_id'); $o->estatedirection_id = $this->input->post('estatedirection_id'); $o->estatecatalogue_id = $this->input->post('estatecatalogue_id'); $o->estatetype_id = $this->input->post('estatetype_id'); $o->estatearea_id = $this->input->post('estatearea_id'); $o->estateprice_id = $this->input->post('estateprice_id'); $o->estateward_id = $this->input->post('estateward_id'); $o->address = $this->input->post('address'); $o->isArea = $this->input->post('IsArea'); $o->area = $this->input->post('area'); $o->legally = $this->input->post('legally'); $o->isPrice = $this->input->post('IsPrice'); $o->price_text = $this->input->post('price_text'); $o->estatedirection_id = $this->input->post('estatedirection_id'); $o->estateuser_id = $this->session->userdata('userLoginId'); $o->title = ucfirst($this->input->post('title')); $o->description = $this->input->post('description'); $o->price_text = $this->input->post('price_text'); $o->area_text = $this->input->post('area_text'); if ($o->estatecatalogue_id == 1) { $o->price_type = $this->input->post('price_type'); } else { $o->price_type = $this->input->post('price_type_2'); } $o->name_contact = $this->input->post('name_contact'); $o->address_contact = $this->input->post('address_contact'); $o->phone_contact = $this->input->post('phone_contact'); $o->mobile_contact = $this->input->post('mobile_contact'); $o->email_contact = $this->input->post('email_contact'); $o->isFree = 1; $o->active = 1; $o->code = $this->add_code(7, $o->max_id() + 1, $o->estatecatalogue_id); $o->title_none = remove_vn($this->input->post('title')) . $o->code; if ($this->securimage->check($_POST['captcha_code']) == false) { $msg = '<div class="frm-error error-capcha">Vui lòng nhập đúng mã xác nhận !</div>'; $type = 0; } else { $folder = 'img/project/'; $dataupload = $this->file_lib->upload('image', $folder, $rename_file = true); if (!is_array($dataupload)) { $o->photo = ''; } else { $o->photo = $folder . $dataupload['file_name']; } if ($o->save()) { $msg = '<div class="frm-success">Cảm ơn Bạn! Tin của Bạn đã được gửi đến Chúng tôi thành công. Thông thường sau 30 phút, tin sẽ được kích hoạt<br /><br />Bạn chưa đăng ký thành viên nên Chúng tôi sẽ kiểm duyệt tin đăng của Bạn trước khi hiển thị. Bạn không thể sửa/xóa tin đăng này. Để thuận tiện hơn, Bạn có thể <a style="color: #018e07;font-weight: bolder;" href="' . base_url() . 'dang-ky' . '">đăng ký thành viên</a> - Tin đăng được hiển thị ngay và nhận nhiều hỗ trợ từ Chúng tôi! <br/><br/> Hoặc, Bạn có thể tiếp tục <a style="color: #018e07;font-weight: bolder;" href="' . base_url() . 'dang-tin-rao-vat-nha-dat-mien-phi' . '">đăng tin rao vặt miễn phí</a>!</div>'; $type = 1; /*Upload list images for estates*/ $numfile = $this->input->post('numfile'); foreach ($numfile as $row) { $dataupload = $this->file_lib->upload('image' . $row, $folder); if (is_array($dataupload)) { $estate_photos = new Estate_photo(); $estate_photos->estate_id = $o->id; $estate_photos->name = $folder . $dataupload['file_name']; $estate_photos->save(); $estate_photos->clear(); } } } } } $dis['msg'] = $msg; $dis['type'] = $type; $dis['o'] = $o; $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/post-free'; $this->page_title = "Đăng tin rao vặt nhà đất | rao vặt bất động sản | SotayNhadat.vn"; $this->page_description = "Đăng tin rao vặt nhà đất, căn hộ, đất nền, biệt thự...không cần đăng ký thành viên tại SotayNhadat.vn. Giúp Bạn giao dịch nhà đất đơn giản, nhanh chóng hơn!"; $this->viewfront($dis); }
function deletePhotoDefault($estateID) { $estate = new Estate($estateID); // remove image from folder. $pathImageDefault = $_SERVER['DOCUMENT_ROOT'] . '/' . $estate->photo; unlink($pathImageDefault); // set image to default. $estate->photo = ""; if ($estate->save()) { flash_message('success', 'Hình ảnh đại diện đã được xóa khỏi tin nhà đất'); redirect(base_url() . 'chinh-sua-tin/' . $estateID); } else { flash_message('error', 'Đã có lỗi xãy ra !'); redirect(base_url() . 'chinh-sua-tin/' . $estateID); } }
function deletePhotoDefault($estateID, $isFree = false) { $estate = new Estate($estateID); // remove image from folder. $pathImageDefault = $_SERVER['DOCUMENT_ROOT'] . '/' . $estate->photo; unlink($pathImageDefault); // set image to default. $estate->photo = ""; if ($estate->save()) { flash_message('success', 'Hình ảnh đại diện đã được xóa khỏi tin nhà đất'); if (!$isFree) { redirect($this->admin . 'estates/edit/' . $estateID); } else { redirect($this->admin . 'estates/editFree/' . $estateID); } } else { flash_message('error', 'Đã có lỗi xãy ra !'); if (!$isFree) { redirect($this->admin . 'estates/edit/' . $estateID); } else { redirect($this->admin . 'estates/editFree/' . $estateID); } } }