Example #1
0
 function index()
 {
     // about us
     $this->aboutus = new Article(351);
     $dis['news'] = $this->aboutus;
     // related_news
     $related_news = new Article();
     $related_news->order_by('id', 'asc');
     $related_news->where(array('recycle' => 0, 'newscatalogue_id' => $this->aboutus->newscatalogue_id));
     $related_news->where('id !=', $this->aboutus->id);
     $related_news->get_iterated();
     $dis['related_news'] = $related_news;
     // seo
     $this->page_title = $this->aboutus->{'title_' . $this->language};
     $this->page_description = $this->aboutus->{'short_' . $this->language};
     $this->page_keyword = $this->aboutus->tag;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/aboutus/aboutus-de';
     $this->viewfront($dis);
 }
Example #2
0
 function helpCenter()
 {
     $news = new Article();
     $news->where('newscatalogue_id', 65);
     $news->order_by('id', 'desc');
     $news->get_iterated();
     $dis['news'] = $news;
     $this->page_title = "Trợ giúp - " . $this->page_title;
     $dis['base_url'] = base_url();
     $dis['view'] = 'helpCenter';
     $this->viewfront($dis);
 }
Example #3
0
 function editPost($postId)
 {
     $postId = $this->uri->segment(2);
     $dis['postId'] = $postId;
     $o = new Estate($postId);
     if (!$o->exists()) {
         show_404();
     }
     $customer = new Estateuser($this->session->userdata('userLoginId'));
     if (!$customer->exists()) {
         show_404();
     }
     $dis['customer'] = $customer;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         try {
             $o->estatecity_id = $this->input->post('estatecity_id');
             $o->estatedistrict_id = $this->input->post('estatedistrict_id');
             $o->estatecatalogue_id = $this->input->post('estatecatalogue_id');
             $o->estatetype_id = $this->input->post('estatetype_id');
             $o->estatedirection_id = $this->input->post('estatedirection_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->area_text = $this->input->post('area_text');
             $o->estatedirection_id = $this->input->post('estatedirection_id');
             //$o->estateuser_id = $this->session->userdata('userLoginId');
             $o->title = ucfirst(mb_strtolower($this->input->post('title'), "utf-8"));
             $o->description = $this->input->post('description');
             if ($o->estatecatalogue_id == 1) {
                 $o->price_type = $this->input->post('price_type');
             } else {
                 $o->price_type = $this->input->post('price_type_2');
             }
             $o->article_id = $this->input->post('article_id');
             $o->created = date('Y-m-d H:i:s');
             $o->updateTime = date('Y-m-d H:i:s');
             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 {
                 // 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);
                         $o->photo = '';
                     } else {
                         $o->photo = $folder . $dataupload['file_name'];
                         $img = getimagesize($folder . $dataupload['file_name']);
                         if (!empty($img[2])) {
                             $typeImage = image_type_to_mime_type($img[2]);
                         }
                         $fileWatermark = 'img/watermark/chen-hinh-tin-rao.png';
                         $fileImage = $folder . $dataupload['file_name'];
                         $stamp = imagecreatefrompng($fileWatermark);
                         if ($typeImage == 'image/jpeg') {
                             $im = imagecreatefromjpeg($fileImage);
                         } else {
                             if ($typeImage == 'image/gif') {
                                 $im = imagecreatefromgif($fileImage);
                             } else {
                                 $im = imagecreatefrompng($fileImage);
                             }
                         }
                         // Get dimensions
                         $sx = imagesx($im);
                         $sy = imagesy($im);
                         $sx1 = imagesx($stamp);
                         $sy1 = imagesy($stamp);
                         // width to calculate positioning of the stamp.
                         imagecopy($im, $stamp, ($sx - $sx1) / 2, ($sy - $sy1) / 2, 0, 0, imagesx($stamp), imagesy($stamp));
                         // Output and free memory
                         header('Content-type: image/png');
                         imagejpeg($im, $fileImage, 100);
                     }
                 }
                 // Add thumbnail to slide
                 if ($_FILES['thumb1']['name'] != "") {
                     $folder = 'img/project/';
                     $numfile = $this->input->post('numfile');
                     foreach ($numfile as $row) {
                         $dataupload = $this->file_lib->upload('thumb' . $row, $folder, $rename_file = true);
                         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();
                             $img = getimagesize($folder . $dataupload['file_name']);
                             if (!empty($img[2])) {
                                 $typeImage = image_type_to_mime_type($img[2]);
                             }
                             $fileWatermark = 'img/watermark/chen-hinh-tin-rao.png';
                             $fileImage = $folder . $dataupload['file_name'];
                             $stamp = imagecreatefrompng($fileWatermark);
                             if ($typeImage == 'image/jpeg') {
                                 $im = imagecreatefromjpeg($fileImage);
                             } else {
                                 if ($typeImage == 'image/gif') {
                                     $im = imagecreatefromgif($fileImage);
                                 } else {
                                     $im = imagecreatefrompng($fileImage);
                                 }
                             }
                             // Get dimensions
                             $sx = imagesx($im);
                             $sy = imagesy($im);
                             $sx1 = imagesx($stamp);
                             $sy1 = imagesy($stamp);
                             // width to calculate positioning of the stamp.
                             imagecopy($im, $stamp, ($sx - $sx1) / 2, ($sy - $sy1) / 2, 0, 0, imagesx($stamp), imagesy($stamp));
                             // Output and free memory
                             header('Content-type: image/png');
                             imagejpeg($im, $fileImage, 100);
                         }
                     }
                 }
                 if ($o->save()) {
                     redirect(base_url() . 'chinh-sua-tin-da-dang');
                 }
             }
         } catch (Exception $e) {
             echo 'Caught exception: ', $e->getMessage(), "\n";
             die;
         }
     }
     $project = new Article();
     $project->where('estatecity_id', $o->estatecity_id);
     $project->get_iterated();
     $dis['project'] = $project;
     $photo = new Estate_photo();
     $photo->where('estate_id', $postId);
     $photo->get_iterated();
     $dis['photo'] = $photo;
     $this->page_title = "Đăng tin rao vặt bất động sản | Rao vặt nhà đất  | SotayNhadat.vn";
     $dis['o'] = $o;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/user/post-edit';
     $dis['msg'] = $msg;
     $dis['type'] = $type;
     $this->viewfront($dis);
 }
Example #4
0
 function searchProject()
 {
     $estatesType = $this->input->post('estatetype_id');
     $estatesCity = $this->input->post('estatecity_id');
     $estatesDictrict = $this->input->post('estatedistrict_id');
     $estates = new Article();
     $estates->where('recycle', 0);
     $estates->where('newscatalogue_id', $estatesType);
     /*if($this->input->post('estatetype_id') != ''){
           $estates->where('estatetype_id', $estatesType);
       }*/
     if ($this->input->post('estatecity_id') != '') {
         $estates->where('estatecity_id', $estatesCity);
     }
     if ($this->input->post('estatedistrict_id') != '') {
         $estates->where('estatedistrict_id', $estatesDictrict);
     }
     $estates->get_iterated();
     $dis['estates'] = $estates;
     $this->page_title = 'Tìm kiếm dự án - ' . $this->page_title;
     $this->page_description = 'Tìm kiếm dự án - ' . $this->page_description;
     $this->page_keyword = 'Tìm kiếm dự án - ' . $this->page_keyword;
     $this->isRobotFollow = 1;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/project/search';
     $this->viewfront($dis);
 }
Example #5
0
 function resetNewsViewMost()
 {
     try {
         $dateNow = new DateTime(date('Y-m-d'));
         $dateStart = new DateTime(getconfigkey('date_start_reset_news'));
         $interval = $dateNow->diff($dateStart);
         if ($interval->days % 7 == 0) {
             $cauhinh = new Cauhinh();
             $cauhinh->where('fieldname', 'date_reset_news')->get();
             if (getconfigkey('date_reset_news') == 0) {
                 $news = new Article();
                 $news->where('recycle', 0);
                 $news->where_in('newscatalogue_id', array(71, 73, 72, 74, 75, 77, 80, 81, 82, 78, 79));
                 $news->get_iterated();
                 foreach ($news as $row) {
                     $o = new Article($row->id);
                     $o->view_count = 0;
                     $o->save();
                     $o->clear();
                 }
                 $cauhinh->value = 1;
                 $cauhinh->save();
             }
         } else {
             if (getconfigkey('date_reset_news') != 0) {
                 $cauhinh = new Cauhinh();
                 $cauhinh->where('fieldname', 'date_reset_news')->get();
                 $cauhinh->value = 0;
                 $cauhinh->save();
             }
         }
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
 }
Example #6
0
 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);
 }