예제 #1
0
 function displayPropertyDetail($id)
 {
     global $u_reGlobalConfig;
     $language = ilandCommonUtils::getLanguage();
     // get data
     $propertyModel = new U_ReModelProperties();
     $propertyData = $propertyModel->layChiTietBDS($id, $language);
     // get template
     $templateName = JFactory::getApplication()->getTemplate();
     $templatePath = JPATH_THEMES . DS . $templateName . DS . "html" . DS . "com_u_re" . DS . "properties";
     $this->addTemplatePath($templatePath);
     $hien_thi_luot_xem = 0;
     if (isset($propertyData['hien_thi_ra_ngoai']) && $propertyData['hien_thi_ra_ngoai'] != 0 || !empty($_GET['preview'])) {
         $ip = $_SERVER['REMOTE_ADDR'];
         $session = JFactory::getSession();
         $ipSession = $session->get('bds_' . $propertyData['id']);
         ilandCommonUtils::themLuotXemBDS($id, $propertyData['luot_xem']);
         if (empty($ipSession) || $ipSession != $ip) {
             $propertyData['luot_xem'] += 1;
         }
         //$propertyData['luot_xem'] += 1;
         //$propertyData['luot_xem'] = ilandCommonUtils::demLuotXemBDS($id, 0);
         if ($u_reGlobalConfig['COMMON']['luot_xem_bds'] == 1) {
             $hien_thi_luot_xem = 1;
         } else {
             $hien_thi_luot_xem = 0;
         }
         $this->setLayout($u_reGlobalConfig['PROPERTY']['detail_template']);
     } else {
         $this->setLayout($u_reGlobalConfig['PROPERTY']['detail_template'] . '_error');
         parent::display();
         return;
     }
     $this->assign('hien_thi_luot_xem', $hien_thi_luot_xem);
     // neu la loai can mua, can thue, hien thi template can mua can thue
     if ($propertyData['loai_giao_dich_id'] == '3' || $propertyData['loai_giao_dich_id'] == '4') {
         $this->assignRef('propertyData', $propertyData);
         $this->setLayout($u_reGlobalConfig['PROPERTY']['can_mua_template']);
         parent::display();
         return;
     }
     // status 0 => trang chi tiet bat dong san
     $this->assign('status', 0);
     $this->assign('googlemapDisplay', $u_reGlobalConfig['MAP']['property_map_function_on']);
     $this->assign('googlemapEnable', $u_reGlobalConfig['MAP']['property_map_function_enable']);
     // hien thi cho trinh dien anh
     $mainImage = ilandCommonUtils::getPropertyMainImage($id);
     //$this->assignRef('mainImage' , $mainImage );
     // hien thi cho trinh dien anh
     $subImages = ilandCommonUtils::getPropertySubImages($id);
     //$this->assignRef('secondariesImages' , $secondariesImages );
     $imageData = array();
     $imageData['mainImage'] = $mainImage;
     $imageData['subImages'] = $subImages;
     $imageData['status'] = 0;
     // chi tiet bds front end
     $imageData['id'] = $id;
     // chi tiet bds front end
     $imageTemplateName = 'image_block';
     $imageData['title'] = $propertyData['tieu_de'];
     $imageBlockHTML = ilandCommonUtils::fetchImageBlockTemplate($templatePath, $imageTemplateName, $imageData);
     $this->assignRef('imageBlockHTML', $imageBlockHTML);
     // Lấy chuỗi thông tin diện tích khuôn viên
     $areaInfoString = U_ReViewProperties::getAreaInfoString($propertyData['dien_tich_khuon_vien_rong'], $propertyData['dien_tich_khuon_vien_dai']);
     $this->assignRef('areaInfoString', $areaInfoString);
     // Lấy chuỗi thông tin diện tích sử dụng
     $usedAreaInfoString = U_ReViewProperties::getAreaInfoString($propertyData['dien_tich_su_dung_rong'], $propertyData['dien_tich_su_dung_dai']);
     $this->assignRef('usedAreaInfoString', $usedAreaInfoString);
     // Lấy chuỗi thông tin diện tích xay dung
     $construcAreaInfoString = U_ReViewProperties::getAreaInfoString($propertyData['dien_tich_xay_dung_rong'], $propertyData['dien_tich_xay_dung_dai']);
     $this->assignRef('construcAreaInfoString', $construcAreaInfoString);
     $livingSpaceString = U_ReViewProperties::getLivingSpaceString($propertyData['dien_tich_su_dung']);
     $this->assignRef('livingSpaceString', $livingSpaceString);
     // phong khach
     if (empty($propertyData['phong_khach'])) {
         $propertyData['phong_khach'] = '_';
     }
     // phong ngu
     if (empty($propertyData['phong_ngu'])) {
         $propertyData['phong_ngu'] = '_';
     }
     // phong tam
     if (empty($propertyData['phong_tam'])) {
         $propertyData['phong_tam'] = '_';
     }
     // cac phong khac
     if (empty($propertyData['phong_khac'])) {
         $propertyData['phong_khac'] = '_';
     }
     // huong
     if (empty($propertyData['huong'])) {
         $propertyData['huong'] = '_';
     }
     // dien tich xay dung
     if (empty($propertyData['dien_tich_xay_dung_dai'])) {
         $propertyData['dien_tich_xay_dung_dai'] = '_';
     }
     if (empty($propertyData['dien_tich_xay_dung_rong'])) {
         $propertyData['dien_tich_xay_dung_rong'] = '_';
     }
     // phap ly
     if (empty($propertyData['phap_ly'])) {
         $propertyData['phap_ly'] = '_';
     }
     if (empty($propertyData['dia_chi'])) {
         $propertyData['dia_chi'] = ilandCommonUtils::ketHopDiaChi($propertyData['so_nha'], $propertyData['duong_pho'], $propertyData['phuong_xa'], $propertyData['quan_huyen'], $propertyData['tinh_thanh']);
     }
     /*
      * Get same properties
      *  - Get id
      *  - Get current page
      */
     // mặc định là trang 1
     $currentPage = 1;
     // get data & fetch template
     $returnFieldList = U_ReConfig::getValueByKey('PROPERTY', 'bdslq_truong_du_lieu');
     $conditionStr = U_ReConfig::getValueByKey('PROPERTY', 'bdslq_dieu_kien');
     $sameProperties = $propertyModel->getSameProperties($language, $returnFieldList, $conditionStr, $propertyData, $currentPage);
     $sameProperties[3] = ilandCommonUtils::boSungThongTinBDS($sameProperties[3], $templatePath, 'bdslq');
     // get ajax paging
     $samePropertiesConditionParam = ilandCommonUtils::genBDSLQConditionParam($conditionStr, $propertyData);
     $samePropertiesTemplate = $u_reGlobalConfig['PROPERTY']['bdslq_template'];
     $url = JURI::base() . 'ajax_function.php?task=bdslq&page=' . $currentPage . '&id=' . $id . '&condition=' . $conditionStr . '&return_field=' . $returnFieldList . '&template_path=' . $templatePath . '&template_name=' . $samePropertiesTemplate . '&tienTemplatePath=tiente3&moduleId=tranga&id=' . $propertyData['id'] . '&idContentElement=tranga' . '&ajaxPagingTemplate=' . $u_reGlobalConfig['COMMON']['ajax_paging_template'];
     $conditionParam = explode(',', $conditionStr);
     foreach ($conditionParam as $param) {
         $url .= '&' . $param . '=' . $propertyData[$param];
     }
     $idContentElement = 'tranga';
     $totalPage = $sameProperties[1];
     $samePropertiesAjaxPagingTemplateName = $u_reGlobalConfig['COMMON']['ajax_paging_template'];
     $samePropertiesAjaxPagingHTML = ilandCommonUtils::getAjaxPagination($idContentElement, $url, $currentPage, $totalPage, $templatePath, $samePropertiesAjaxPagingTemplateName);
     if (!empty($sameProperties[3])) {
         $samePropertiesHTML = ilandCommonUtils::fetchPropertiesTemplate($templatePath, $samePropertiesTemplate, $sameProperties[3]);
     } else {
         $samePropertiesHTML = 0;
     }
     $this->assignRef('samePropertiesHTML', $samePropertiesHTML);
     $this->assignRef('samePropertiesAjaxPagingHTML', $samePropertiesAjaxPagingHTML);
     // getAdvantageslist
     //		$advantagesList =  $propertyModel->layDanhSachTienIch( $id );
     //	    $this->assignRef( 'advantagesList', $advantagesList );
     $tempalateName = 'tien_te3';
     // lay template gia tien
     $gia = array($propertyData['VND'], $propertyData['USD'], $propertyData['SJC']);
     $donViTien = array('VND', 'USD', 'SJC');
     $templateTien = $u_reGlobalConfig['PROPERTY']['tien_template'];
     $tienHTML = ilandCommonUtils::fetchCurrencyTemplate($propertyData, $templatePath, 'chitietBDS', $tempalateName);
     $this->assignRef('tienHTML', $tienHTML);
     $gia_nguyen_can = ilandCommonUtils::reFormatPrice($propertyData['gia_nguyen_can']);
     $gia_m2 = ilandCommonUtils::reFormatPrice($propertyData['gia_m2']);
     /*
     $giam2 =  ilandCommonUtils::layGiaM2( array('dien_tich_su_dung'=>$propertyData['dien_tich_su_dung'],'gia'=>$propertyData['gia']) );
     $gia1 =  ilandCommonUtils::layGiaTien( array('don_vi_tien_id'=>$propertyData['don_vi_tien_id'], 
     										'don_vi_dien_tich_id'=>$propertyData['don_vi_dien_tich_id'],
     									 									'gia'=>$propertyData['gia']) );
     */
     $this->assignRef('gia_nguyen_can', $gia_nguyen_can);
     $this->assignRef('gia_m2', $gia_m2);
     //$this->assignRef( 'gia', ilandCommonUtils::reFormatPrice($gia1 ));
     // get all flag & fetch tien ich template
     $tienIchAllFlag = $u_reGlobalConfig['PROPERTY']['tien_ich_all_flag'];
     $tienIchTemplate = $u_reGlobalConfig['PROPERTY']['tien_ich_template'];
     $tienIchHTML = $propertyModel->fetchTienIchTemplate($propertyData['tien_ich_id'], $templatePath, $tienIchTemplate, $tienIchAllFlag, $language);
     $this->assignRef('tienIchHTML', $tienIchHTML);
     // get map config
     $this->assignRef('mapZoom', $u_reGlobalConfig['MAP']['map_zoom']);
     // get comment
     $commentHTML = ilandCommonUtils::getComment($propertyData['id'], $propertyData['tieu_de'], 'bds');
     $this->assignRef('commentHTML', $commentHTML);
     /* thông tắt 2 mod 
     		// get module tim kiem bat dong san
     		$timKiemBDSHTML = ilandCommonUtils::getModuleTimKiemBDS( 'TÌM KIẾM BẤT ĐỘNG SẢN TRANG CHI TIẾT' );
     		$this->assignRef( 'timKiemBDSHTML', $timKiemBDSHTML );
     		
     		// get quang cao*/
     $moduleChiase = 'CHIA SE';
     $quangCaoHTML = ilandCommonUtils::getChiaSe($moduleChiase);
     $this->assignRef('chiase', $quangCaoHTML);
     $moduleQC = 'Banner Ad - Chi tiết tin';
     $QCHTML = $this->getModuleQC($moduleQC);
     $this->assignRef('quangcao', $QCHTML);
     // $propertyData['dien_tich_khuon_vien'] ='';
     $this->assignRef('propertyData', $propertyData);
     $document =& JFactory::getDocument();
     $subject = $this->propertyData['tieu_de'];
     $nguoinhan = $this->propertyData['email_nguoi_lien_he'];
     $tennguoinhan = $this->propertyData['ten_nguoi_lien_he'];
     $lienhe = $this->getModule('mod_jdcontact', 'mod_jdcontact', 'raw', $subject, $nguoinhan, $tennguoinhan);
     $this->assignRef('lienhe', $lienhe);
     // print_r( $u_reGlobalConfig['SEO']['mo_ta_trang_mac_dinh'] );
     if ($this->escape($propertyData['tieu_de_trang']) == NULL) {
         if ($propertyData['du_an'] == 'Vui lòng chọn') {
             $da = '';
         } else {
             $da = $propertyData['du_an'];
         }
         // $page_title = $propertyData['thong_tin_tong_quan'] ;
         $title = $propertyData['loai_giao_dich'] . " " . $propertyData['loai_bds'] . " " . $da . ", " . $propertyData['quan_huyen'] . ", " . $propertyData['tinh_thanh'];
         $page_title = $title;
     } else {
         $page_title = ucfirst($this->escape($propertyData['tieu_de_trang']));
     }
     if ($this->escape($propertyData['tu_khoa_trang']) == NULL) {
         $page_keywords = $u_reGlobalConfig['SEO']['tu_khoa_trang_mac_dinh'];
     } else {
         $page_keywords = ucfirst($this->escape($propertyData['tu_khoa_trang']));
     }
     $document->setMetaData('keywords', $page_keywords);
     if ($this->escape($propertyData['mo_ta_trang']) == NULL) {
         $page_description = $u_reGlobalConfig['SEO']['mo_ta_trang_mac_dinh'];
     } else {
         $page_description = ucfirst($this->escape($propertyData['mo_ta_trang']));
     }
     $document->setMetaData('description', $page_description);
     $mainframe =& JFactory::getApplication();
     $pathway =& $mainframe->getPathway();
     $pathway->addItem($page_title);
     $document->setTitle($page_title);
     parent::display();
 }
예제 #2
0
 function editItem()
 {
     global $u_reGlobalConfig;
     $backEndDetail = $u_reGlobalConfig['IFRAME']['backEndDetail'];
     if ($backEndDetail == 1) {
         // echo "<strong><a href='index.php?option=com_jea&controller=properties&task=add'>dang them </a></strong>";
         $templatePath = "../templates/mlbds/html/com_u_re/properties/";
         //$templatePath = "../templates/WebGH/html/com_u_re/properties/";
         $this->addTemplatePath($templatePath);
         $this->setLayout('admin_detail');
         parent::display();
         return;
     }
     $templatePath = "../templates/mlbds/html/com_u_re/properties/";
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     if ($idurl = JFactory::getURI()->getVar("id")) {
         $id = $idurl;
     } else {
         $id = $cid[0];
     }
     //	$id = 14;
     //echo "edit ";
     JRequest::setVar('hidemainmenu', 1);
     //$item = & $this->get('item');
     // lay du lieu
     // khoi tao cac gia tri mac dinh
     $published = 1;
     $this->newsestChecked = '';
     $this->emphasisChecked = '';
     $this->daBanChecked = '';
     $phapLyId = 0;
     $huongId = 0;
     $loaiBDSId = 0;
     $loaiGiaoDichId = 0;
     $duanId = 0;
     $tinhThanhId = $u_reGlobalConfig['COMMON']['tinh_thanh_mac_dinh'];
     $quanHuyenId = $u_reGlobalConfig['COMMON']['quan_huyen_mac_dinh'];
     $donViTien = 1;
     $donViDienTich = 1;
     $viTriId = 0;
     $nhaMoiGioiId = 0;
     $tieuDeBDS = JText::_('New');
     $this->mainImage = '';
     $this->secondariesImage = '';
     // add phuong xa, duong pho
     $phuongXaId = 0;
     $duongPhoId = 0;
     // TODO: remove hard code id
     // $id = 174;
     $this->propertyData['loai_tin_id'] = '';
     $this->propertyData['tieu_de_trang'] = '';
     $this->propertyData['tu_khoa_trang'] = '';
     $this->propertyData['mo_ta_trang'] = '';
     $this->propertyData['tieu_de'] = '';
     $this->propertyData['ma_so'] = '';
     $this->propertyData['dia_chi'] = '';
     $this->propertyData['gia'] = '';
     $this->propertyData['dien_tich_khuon_vien_rong'] = '';
     $this->propertyData['dien_tich_khuon_vien'] = '';
     $this->propertyData['dien_tich_khuon_vien_dai'] = '';
     $this->propertyData['phuong_xa'] = '';
     $this->propertyData['alias'] = '';
     /* */
     $this->propertyData['loai_bds'] = '';
     $this->propertyData['phap_ly'] = '';
     $this->propertyData['phong_ngu'] = '';
     $this->propertyData['phong_tam'] = '';
     $this->propertyData['phong_khac'] = '';
     //////
     $this->propertyData['dien_tich_su_dung'] = '';
     $this->propertyData['ghi_chu_nguoi_lien_he'] = '';
     $this->propertyData['mo_ta_chi_tiet'] = '';
     $this->propertyData['dien_tich_xay_dung_dai'] = '';
     $this->propertyData['dien_tich_xay_dung_rong'] = '';
     $this->propertyData['loai_bds_id'] = '';
     $this->propertyData['don_vi_tien'] = '';
     $this->propertyData['id'] = '';
     $this->propertyData['don_vi_tien_id'] = '';
     $propertyData['tien_ich_id'] = '';
     $propertyData['don_vi_dien_tich_id'] = '';
     $propertyData['phuong_xa'] = '';
     $this->propertyData['chinh_chu'] = '';
     $this->propertyData['speak_english'] = '';
     $this->propertyData['duong_pho'] = '';
     $this->propertyData['so_nha'] = '';
     $this->propertyData['phong_khach'] = '';
     $this->propertyData['ten_nguoi_lien_he'] = '';
     $this->propertyData['dia_chi_nguoi_lien_he'] = '';
     $this->propertyData['dien_thoai_nguoi_lien_he'] = '';
     $this->propertyDataen['tieu_de'] = '';
     $this->propertyDataen['dia_chi'] = '';
     $this->propertyDataen['mo_ta_chi_tiet'] = '';
     $this->propertyDataen['ten_nguoi_lien_he'] = '';
     $this->propertyDataen['dia_chi_nguoi_lien_he'] = '';
     $this->propertyDataen['ghi_chu_nguoi_lien_he'] = '';
     $this->propertyDataen['tieu_de_trang'] = '';
     $this->propertyDataen['tu_khoa_trang'] = '';
     $this->propertyDataen['mo_ta_trang'] = '';
     $this->propertyDataen['loai_bds'] = '';
     $this->propertyDataen['loai_giao_dich'] = '';
     $this->propertyDataen['phap_ly'] = '';
     $this->propertyDataen['don_en_dien_tich'] = '';
     $this->propertyDataen['don_en_tien'] = '';
     $this->propertyDataen['nha_moi_gioi_ten'] = '';
     $this->propertyDataen['tinh_thanh'] = '';
     $this->propertyDataen['quan_huyen'] = '';
     $this->propertyDataen['tien_ich'] = '';
     $this->propertyDataen['huong'] = '';
     $realtorId = '';
     $this->mainImage['isfile'] = '';
     $imageData = array();
     $mainImage = '';
     $subImages = '';
     $imageData['id'] = 0;
     $imageData['title'] = $this->propertyData['tieu_de'];
     $imageData['status'] = 2;
     $imageData['title'] = '';
     $imageTemplateName = 'image_block';
     if ($id) {
         $propertyData = U_reModelProperties::layChiTietBDS($id, 'vi');
         $propertyDataen = U_reModelProperties::layChiTietBDS($id, 'en');
         // print_r($propertyData);
         $this->assign('propertyData', $propertyData);
         $this->assign('propertyDataen', $propertyDataen);
         //print_r($this->propertyDataen);
         //exit;
         //get edit main image
         //$this->assignRef( 'mainImage', ilandCommonUtils::getPropertyMainImage( $id ) );
         $mainImage = ilandCommonUtils::getPropertyMainImage($id);
         //get edit sub image
         //$this->assignRef( 'secondariesImage', ilandCommonUtils::getPropertySubImages( $id ) );
         $subImages = ilandCommonUtils::getPropertySubImages($id);
         $imageData['mainImage'] = $mainImage;
         $imageData['subImages'] = $subImages;
         $imageData['id'] = $propertyData['id'];
         // chi tiet bds front end
         $this->assignRef('imageBlockHTML', $imageBlockHTML);
         $published = $propertyData['hien_thi_ra_ngoai'];
         // $this->newsestChecked = "checked";
         if ($propertyData['moi_nhat'] == 1) {
             $this->newsestChecked = "checked";
         }
         if ($propertyData['noi_bat'] == 1) {
             $this->emphasisChecked = "checked";
         }
         if ($propertyData['da_ban'] == 1) {
             $this->daBanChecked = "checked";
         }
         $phapLyId = $propertyData['phap_ly_id'];
         $quanHuyenId = $propertyData['quan_huyen_id'];
         $tinhThanhId = $propertyData['tinh_thanh_id'];
         $huongId = $propertyData['huong_id'];
         $loaiGiaoDichId = $propertyData['loai_giao_dich_id'];
         $loaiBDSId = $propertyData['loai_bds_id'];
         //$viTriId = $propertyData['vi_tri_id'];
         $viTriId = 1;
         $nhaMoiGioiId = $propertyData['nha_moi_gioi_id'];
         $tieuDeBDS = $propertyData['tieu_de'];
         // add phuong xa, duong pho
         $phuongXaId = $propertyData['phuong_xa_id'];
         $duongPhoId = $propertyData['duong_pho_id'];
     }
     //		get price insert value
     $InsertPrice = $this->propertyData['gia'];
     //$InsertPrice=JeaViewProperties::getInsertPrice( $this->propertyData['gia'],$this->propertyData['don_vi_tien_id'], '1');
     //get price unit value
     $PriceUnit = JeaViewProperties::getInsertPrice($this->propertyData['gia'], $this->propertyData['don_vi_tien_id']);
     $title = JeaViewProperties::getPageTitle($this->get('category'), $tieuDeBDS);
     $editor =& JFactory::getEditor();
     $this->assignRef('editor', $editor);
     $user =& JFactory::getUser();
     $usertype = $user->get('usertype');
     $this->assignRef('usertype', $usertype);
     //lay 2 ky tu cua ngon ngu hien tai
     //EX: Vi, En, Ja, Ch...
     $language =& JFactory::getLanguage();
     $lang = substr($language->getTag(), 0, 2);
     $this->assignRef('lang', $lang);
     //get params values
     // TODO: get from global config
     $this->googlemapDisplay = $u_reGlobalConfig['MAP']['property_map_function_on'];
     $this->googlemapEnable = $u_reGlobalConfig['MAP']['property_map_function_enable'];
     // lay list lua chon hien thi ra ngoai
     $publishedHTML = JHTML::_('select.booleanlist', 'hien_thi_ra_ngoai', 'class="inputbox"', $published);
     $this->assignRef('published', $publishedHTML);
     //  hien thi layout dang tin o backend
     $this->status = 2;
     $legal = ilandCommonUtils::getSelectBox('phap_ly', 'legal_status', JText::_('SELECT_LEGAL'), $phapLyId, "onchange=getonchangevalue('legal_status','divlegalstatus','',0)", '', '', 'class=opt');
     $this->assignRef('legalStatusList', $legal);
     //get direction
     $directions = ilandCommonUtils::getSelectBox('huong', 'direction_id', JText::_('Directions'), $huongId, '', '', '', 'class=opt');
     $this->assignRef('directions', $directions);
     //$propertyData['tien_ich_id'] = '-2-3-';
     $Advantage = ilandCommonUtils::getSelectAdvantage($lang, $propertyData['tien_ich_id']);
     $this->assignRef('Advantage', $Advantage);
     //get realtor
     //	$realtorId=1;
     $realtorbds = ilandCommonUtils::getSelectBox('nha_moi_gioi', 'realtor_id', JText::_('realtor'), $realtorId, '', '', "style='width:148px'");
     $this->assignRef('realtor_bds', $realtorbds);
     $this->assignRef('InsertPrice', $InsertPrice);
     $this->assignRef('PriceUnit', $PriceUnit);
     $this->assignRef('properties_key', $propertyData['ma_so']);
     // don vi
     //$getDonVi =  JeaViewProperties::getDonVi();
     $price_area_unit = ilandCommonUtils::getSelectBox('don_vi_dien_tich', 'price_area_unit', '', $propertyData['don_vi_dien_tich_id']);
     $this->assignRef('Unit', $price_area_unit);
     // towns
     //		$areas =  ilandCommonUtils:: getSelectBox('quan_huyen', 'area_id', '',
     //									$quanHuyenId,"", $tinhThanhId, "style='width:137px'");
     $areas = ilandCommonUtils::getSelectBox('quan_huyen', 'area_id', '', $quanHuyenId, 'layDanhSachDuAn(this.value,"vi","' . JURI::root() . '")', $tinhThanhId, "style='width:160px'");
     $this->assignRef('areas', $areas);
     $baseurl = $u_reGlobalConfig['COMMON']['root'];
     // towns
     $towns = ilandCommonUtils::getSelectBox('tinh_thanh', 'town_id', '', $tinhThanhId, 'layseachquanhuyen("area_id",this.value,"vi-VN","' . $baseurl . '","area_id")', '', "style='width:160px'");
     $this->assignRef('towns', $towns);
     // add phuong xa, duong pho
     $phuongXaListHTML = ilandCommonUtils::getSelectBox('phuong_xa', 'phuong_xa_id', 'Vui lòng chọn', $phuongXaId, "", $quanHuyenId, "style='width:160px'");
     $this->assignRef('phuongXaListHTML', $phuongXaListHTML);
     $duongPhoListHTML = ilandCommonUtils::getSelectBox('duong_pho', 'duong_pho_id', 'Vui lòng chọn', $duongPhoId, "", $quanHuyenId, "style='width:160px'");
     $this->assignRef('duongPhoListHTML', $duongPhoListHTML);
     $duAnHTML = ilandCommonUtils::getSelectBox('du_an', 'du_an_id', 'Vui lòng chọn', $duanId, '', $quanHuyenId, "style='width: 200px;padding: 2px;border: 1px solid #96A6C5;'");
     $this->assignRef('duAnHTML', $duAnHTML);
     $onchangedonvidientich = 'onchange=' . '"layDanhSachDienTich(' . "'price_area_unit',this.value,'vi-VN','" . $baseurl . "','price_area_unit')" . '"';
     $kinds = ilandCommonUtils::getSelectBox('loai_giao_dich', 'kind_id', '', $loaiGiaoDichId, $onchangedonvidientich, '', '', 'class=opt');
     $this->assignRef('kinds', $kinds);
     $types = ilandCommonUtils::getSelectBox('loai_bds', 'type_id', '', $loaiBDSId, 'onchange=getonchangevalue(\'type_id\',\'divtype\',\'\',0)', '', '', 'class=opt');
     $this->assignRef('types', $types);
     // print_r($this->types);
     // lay position
     $position = ilandCommonUtils::getSelectBox('vi_tri', 'position', '', $viTriId);
     $this->assignRef('position', $position);
     if (empty($this->propertyData['ten_nguoi_lien_he']) && empty($this->propertyData['dien_thoai_nguoi_lien_he']) && empty($this->propertyData['dia_chi_nguoi_lien_he'])) {
         // Chau add: get realtor info
         /*
         $realtor = $this->getRealtorById($nhaMoiGioiId);
         $this->propertyData['ten_nguoi_lien_he'] = $realtor->name;
         $this->propertyData['dien_thoai_nguoi_lien_he'] = $realtor->phone;
         $this->propertyData['dia_chi_nguoi_lien_he'] = $realtor->address;
         $row->realtor_link = array('profile' => $realtor->link['profile'],
         						   'listing' => $realtor->link['listing']);
         */
         if ($nhaMoiGioiId > 0) {
             $row->realtor_avatar = $realtor->image['image']['name'];
         }
     }
     //$templatePath = "../templates/WebGH/html/com_u_re/properties/";
     //$templatePath = "../templates/WebVHL/html/com_u_re/properties/";
     $tienIchTemplate = $u_reGlobalConfig['PROPERTY']['admin_tien_ich_template'];
     $tienIchHTML = U_ReModelProperties::fetchTienIchTemplate($propertyData['tien_ich_id'], $templatePath, $tienIchTemplate, true, $lang);
     $this->assignRef('tienIchHTML', $tienIchHTML);
     // image block
     $imageData['mainImage'] = $mainImage;
     $imageData['subImages'] = $subImages;
     $imageBlockHTML = ilandCommonUtils::fetchImageBlockTemplate($templatePath, $imageTemplateName, $imageData);
     $this->assignRef('imageBlockHTML', $imageBlockHTML);
     $this->addTemplatePath($templatePath);
     // $this->setLayout('admin_detail');
     $this->setLayout('detail');
     JToolBarHelper::title($title, 'jea.png');
     parent::display();
 }
예제 #3
0
 function editItem()
 {
     global $u_reGlobalConfig;
     if (isset($_SESSION['tmp']) && $_SESSION['tmp']['sess_tmp'] != 2) {
         unset($_SESSION['tmp']);
     }
     // check if exist info in session
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     if ($idurl = JFactory::getURI()->getVar("id")) {
         $id = $idurl;
     } else {
         $id = $cid[0];
     }
     // get template
     $currentTemplate = JFactory::getApplication()->getTemplate();
     $templatePath = JPATH_THEMES . DS . $currentTemplate . DS . "html" . DS . "com_u_re" . DS . "properties";
     JRequest::setVar('hidemainmenu', 1);
     // khoi tao cac gia tri mac dinh
     $published = 1;
     $this->newsestChecked = '';
     $this->emphasisChecked = '';
     $phapLyId = 0;
     $huongId = 0;
     $loaiBDSId = 0;
     $loaiGiaoDichId = 0;
     $duanId = 0;
     $tinhThanhId = $u_reGlobalConfig['COMMON']['tinh_thanh_mac_dinh'];
     $quanHuyenId = $u_reGlobalConfig['COMMON']['quan_huyen_mac_dinh'];
     $donViTien = 1;
     $donViDienTich = 1;
     $viTriId = 0;
     $nhaMoiGioiId = 0;
     $tieuDeBDS = JText::_('New');
     $this->mainImage = '';
     $this->secondariesImage = '';
     // add phuong xa, duong pho
     $phuongXaId = 0;
     $duongPhoId = 0;
     // TODO: remove hard code id
     // $id = 174;
     $this->propertyData['kinh_do'] = '10.7818082';
     $this->propertyData['vi_do'] = '106.68513600000006';
     $this->propertyData['loai_tin_id'] = 1;
     $this->propertyData['alias'] = '';
     $this->propertyData['tieu_de_trang'] = '';
     $this->propertyData['tu_khoa_trang'] = '';
     $this->propertyData['mo_ta_trang'] = '';
     $this->propertyData['tieu_de'] = '';
     $this->propertyData['ma_so'] = '';
     $this->propertyData['dia_chi'] = '';
     $this->propertyData['so_nha'] = '';
     //vanganh
     $this->propertyData['duong_pho'] = '';
     //vanganh
     $this->propertyData['gia'] = '';
     $this->propertyData['dien_tich_khuon_vien_rong'] = '';
     $this->propertyData['dien_tich_khuon_vien_rong_truoc'] = '';
     $this->propertyData['dien_tich_khuon_vien_dai'] = '';
     $this->propertyData['phuong_xa'] = '';
     $this->propertyData['du_an_id'] = '';
     /* */
     $this->propertyData['loai_bds'] = '';
     $this->propertyData['phap_ly'] = '';
     $this->propertyData['phong_ngu'] = '';
     $this->propertyData['phong_tam'] = '';
     $this->propertyData['phong_khac'] = '';
     $this->propertyData['dien_tich_khuon_vien'] = '';
     //////
     $this->propertyData['dien_tich_su_dung'] = '';
     $this->propertyData['ghi_chu_nguoi_lien_he'] = '';
     $this->propertyData['mo_ta_chi_tiet'] = '';
     $this->propertyData['dien_tich_xay_dung_dai'] = '';
     $this->propertyData['dien_tich_xay_dung_rong'] = '';
     $this->propertyData['loai_bds_id'] = '';
     $this->propertyData['don_vi_tien'] = '';
     $this->propertyData['id'] = '';
     $this->propertyData['don_vi_tien_id'] = '';
     $propertyData['tien_ich_id'] = '';
     $propertyData['don_vi_dien_tich_id'] = '';
     $this->propertyData['loai_giao_dich'] = '';
     $this->propertyData['ten_nguoi_lien_he'] = '';
     $this->propertyData['dia_chi_nguoi_lien_he'] = '';
     $this->propertyData['dien_thoai_nguoi_lien_he'] = '';
     $this->propertyDataen['tieu_de'] = '';
     $this->propertyDataen['dia_chi'] = '';
     $this->propertyDataen['mo_ta_chi_tiet'] = '';
     $this->propertyDataen['ten_nguoi_lien_he'] = '';
     $this->propertyDataen['dia_chi_nguoi_lien_he'] = '';
     $this->propertyDataen['ghi_chu_nguoi_lien_he'] = '';
     $this->propertyDataen['tieu_de_trang'] = '';
     $this->propertyDataen['tu_khoa_trang'] = '';
     $this->propertyDataen['mo_ta_trang'] = '';
     $this->propertyDataen['loai_bds'] = '';
     $this->propertyDataen['loai_giao_dich'] = '';
     $this->propertyDataen['phap_ly'] = '';
     $this->propertyDataen['don_vi_dien_tich'] = '';
     $this->propertyDataen['don_vi_tien'] = '';
     $this->propertyDataen['nha_moi_gioi_ten'] = '';
     $this->propertyDataen['tinh_thanh'] = '';
     $this->propertyDataen['quan_huyen'] = '';
     $this->propertyDataen['phuong_xa'] = '';
     //vanganh
     $this->propertyDataen['duong_pho'] = '';
     //vanganh
     $this->propertyDataen['tien_ich'] = '';
     //$this->propertyDataen['tien_ich_id'] = ''; //vanganh
     $this->propertyDataen['huong'] = '';
     $this->propertyData['phong_khach'] = 0;
     $realtorId = '';
     $this->mainImage['isfile'] = '';
     $imageData = array();
     $mainImage = '';
     $subImages = '';
     $imageData['id'] = 0;
     $imageData['status'] = 1;
     $imageData['title'] = '';
     $imageTemplateName = 'image_block';
     $this->propertyData['alias'] = '';
     if ($id) {
         $propertyData = U_reModelProperties::layChiTietBDS($id, 'vi');
         $propertyDataen = U_reModelProperties::layChiTietBDS($id, 'en');
         $this->assign('propertyData', $propertyData);
         $this->assign('propertyDataen', $propertyDataen);
         $mainImage = ilandCommonUtils::getPropertyMainImage($id);
         $subImages = ilandCommonUtils::getPropertySubImages($id);
         $imageData['id'] = $id;
         $published = $propertyData['hien_thi_ra_ngoai'];
         if ($propertyData['moi_nhat'] == 1) {
             $this->newsestChecked = "checked";
         }
         if ($propertyData['noi_bat'] == 1) {
             $this->emphasisChecked = "checked";
         }
         $phapLyId = $propertyData['phap_ly_id'];
         $quanHuyenId = $propertyData['quan_huyen_id'];
         $tinhThanhId = $propertyData['tinh_thanh_id'];
         $huongId = $propertyData['huong_id'];
         $loaiGiaoDichId = $propertyData['loai_giao_dich_id'];
         $loaiBDSId = $propertyData['loai_bds_id'];
         $nhaMoiGioiId = $propertyData['nha_moi_gioi_id'];
         $tieuDeBDS = $propertyData['tieu_de'];
         $duanId = $propertyData['du_an_id'];
         // add phuong xa, duong pho
         $phuongXaId = $propertyData['phuong_xa_id'];
         $duongPhoId = $propertyData['duong_pho_id'];
         $imageData['title'] = $propertyData['tieu_de'];
     }
     if (isset($_SESSION['tao_yeu_cau'])) {
         unset($_SESSION['tmp']);
         unset($_SESSION['tao_yeu_cau']);
     }
     $_SESSION['dang_tin'] = 'yes';
     if (isset($_SESSION['tmp'])) {
         $loaiGiaoDichId = $_SESSION['tmp']['kind_id'];
         $loaiBDSId = $_SESSION['tmp']['type_id'];
         $tinhThanhId = $_SESSION['tmp']['town_id'];
         $quanHuyenId = $_SESSION['tmp']['area_id'];
         $huongId = $_SESSION['tmp']['direction_id'];
         $duanId = $_SESSION['tmp']['du_an_id'];
         $propertyData['don_vi_dien_tich_id'] = $_SESSION['tmp']['price_area_unit'];
         if ($_SESSION['tmp']['tien_ich'] != '') {
             $propertyData['tien_ich_id'] = implode(",", $_SESSION['tmp']['tien_ich']);
         }
     }
     $InsertPrice = $this->propertyData['gia'];
     //$InsertPrice=$this->getInsertPrice( $this->propertyData['gia'], $this->propertyData['don_vi_tien_id'], '1');
     //get price unit value
     $PriceUnit = $this->getInsertPrice($this->propertyData['gia'], $this->propertyData['don_vi_tien_id']);
     $title = U_reViewmanage::getPageTitle($this->get('category'), $tieuDeBDS);
     $editor =& JFactory::getEditor();
     $this->assignRef('editor', $editor);
     $user =& JFactory::getUser();
     $usertype = $user->get('usertype');
     $this->assignRef('usertype', $usertype);
     //lay 2 ky tu cua ngon ngu hien tai
     //EX: Vi, En, Ja, Ch...
     $language =& JFactory::getLanguage();
     $lang = substr($language->getTag(), 0, 2);
     $this->assignRef('lang', $lang);
     //get params values
     // TODO: get from global config
     $this->googlemapDisplay = $u_reGlobalConfig['MAP']['property_map_function_on'];
     $this->googlemapEnable = $u_reGlobalConfig['MAP']['property_map_function_enable'];
     // lay list lua chon hien thi ra ngoai
     $publishedHTML = JHTML::_('select.booleanlist', 'hien_thi_ra_ngoai', 'class="inputbox"', $published);
     $this->assignRef('published', $publishedHTML);
     //  hien thi layout dang tin o backend
     $this->status = 1;
     $legal = ilandCommonUtils::getSelectBox('phap_ly', 'legal_status', JText::_('SELECT_LEGAL'), $phapLyId, '', '', '', 'class=opt');
     $this->assignRef('legalStatusList', $legal);
     $directions = ilandCommonUtils::getSelectBox('huong', 'direction_id', 'Vui lòng chọn', $huongId, '', '', '', '');
     $this->assignRef('directions', $directions);
     $tienIchTemplate = $u_reGlobalConfig['PROPERTY']['admin_tien_ich_template'];
     $tienIchHTML = U_ReModelProperties::fetchTienIchTemplate($propertyData['tien_ich_id'], $templatePath, $tienIchTemplate, true, $lang);
     $this->assignRef('tienIchHTML', $tienIchHTML);
     $realtorbds = ilandCommonUtils::getSelectBox('nha_moi_gioi', 'realtor_id', JText::_('realtor'), $realtorId, '', '', "style='width:148px'");
     $this->assignRef('realtor_bds', $realtorbds);
     $this->assignRef('InsertPrice', $InsertPrice);
     $this->assignRef('PriceUnit', $PriceUnit);
     // exit;
     $this->assignRef('properties_key', $propertyData['ma_so']);
     // don vi
     //$getDonVi =  U_reViewmanage::getDonVi();
     $price_area_unit = ilandCommonUtils::getSelectBox('don_vi_dien_tich', 'price_area_unit', '', $propertyData['don_vi_dien_tich_id'], '', '', '', 'class=dangtin_donvitien');
     $this->assignRef('Unit', $price_area_unit);
     // towns
     $areas = ilandCommonUtils::getSelectBox('quan_huyen', 'area_id', '', $quanHuyenId, 'layDanhSachDuAn(this.value,"vi","' . JURI::root() . '")', $tinhThanhId, "style='width:160px'");
     $this->assignRef('areas', $areas);
     // towns layseachquanhuyen
     $towns = ilandCommonUtils::getSelectBox('tinh_thanh', 'town_id', '', $tinhThanhId, 'layseachquanhuyen("area_id",this.value,"vi-VN","' . JURI::base() . '","quanhuyens") ', '', "style='width:160px'");
     $this->assignRef('towns', $towns);
     $kinds = ilandCommonUtils::getSelectBox('loai_giao_dich', 'kind_id', '', $loaiGiaoDichId, 'layDanhSachDienTich("price_area_unit",this.value,"vi-VN","' . JURI::base() . '","price_area_unit")', '', '', "class='opt'");
     $this->assignRef('kinds', $kinds);
     // onchange=getonchangevalue(\'type_id\',\'divtype\',\'\',0)
     //$onchangeType = "getonchangevalue(\"type_id\",\"divtype\",\"\",0)";
     $onchangeType = '';
     $types = ilandCommonUtils::getSelectBox('loai_bds', 'type_id', '', $loaiBDSId, $onchangeType, '', '', "class='opt'");
     $this->assignRef('types', $types);
     // add phuong xa, duong pho combo box
     $phuongXaListHTML = ilandCommonUtils::getSelectBox('phuong_xa', 'phuong_xa_id', 'Vui lòng chọn', $phuongXaId, "", $quanHuyenId, "style='width:160px'");
     $this->assignRef('phuongXaListHTML', $phuongXaListHTML);
     $duongPhoListHTML = ilandCommonUtils::getSelectBox('duong_pho', 'duong_pho_id', 'Vui lòng chọn', $duongPhoId, "", $quanHuyenId, "style='width:160px'");
     $this->assignRef('duongPhoListHTML', $duongPhoListHTML);
     $duAnHTML = ilandCommonUtils::getSelectBox('du_an', 'du_an_id', 'Vui lòng chọn', $duanId, '', $quanHuyenId, "style='width: 200px;padding: 2px;border: 1px solid #96A6C5;'");
     $this->assignRef('duAnHTML', $duAnHTML);
     $imageData['mainImage'] = $mainImage;
     $imageData['subImages'] = $subImages;
     $imageBlockHTML = ilandCommonUtils::fetchImageBlockTemplate($templatePath, $imageTemplateName, $imageData);
     $this->assignRef('imageBlockHTML', $imageBlockHTML);
     $this->addTemplatePath($templatePath);
     $this->setLayout($u_reGlobalConfig['PROPERTY']['detail_template']);
     // hoan dang lam
     parent::display();
 }
예제 #4
0
if (isset($user->approved) && $user->approved == "0") {
    $op = 1;
}
echo "<input type=\"button\" onclick=\"submitForm( {$op} ,'1', '{$lang}' )\" name=\"save_review\" class=\"button1\" value=\" " . JText::_('SAVE_REVIEW') . " \" />";
echo $strbreak;
// [47]
echo "<input type=\"button\" onclick=\"submitForm( {$op} ,'2', '{$lang}')\" name=\"save_published\" class=\"button1\" value=\" " . JText::_('SAVE_PUBLISHED') . " \" />";
echo $strbreak;
// [48]
echo "<input type=\"button\" onclick=\"submitForm( {$op} ,'3', '{$lang}' )\" name=\"save_draft\" class=\"button1\" value=\" " . JText::_('SAVE_DRAFT') . " \" />";
echo $strbreak;
// [49]
echo "<input type=\"button\" onclick=\"onChangeAddress()\" value=\" " . JText::_('UPDATE_MAP') . " \" />";
echo $strbreak;
// [50]
echo U_ReModelProperties::fetchTienIchTemplate($tienIchIds, $templatePath, $templateName, true, $lang);
echo $strbreak;
// [51]
echo JText::_('TINH_THANH');
echo $strbreak;
// [52]
echo JText::_('QUAN_HUYEN');
echo $strbreak;
// [53]
echo JText::_('LOAI_HINH_GIAO_DICH');
echo $strbreak;
// [54]
echo JText::_('LOAI_BDS');
echo $strbreak;
// [55]
echo JText::_('CHIEU_DAI');