function display($tpl = null) { // Request category $this->cat = JRequest::getVar('cat', $this->params->get('cat', 'all')); $id = JRequest::getInt('id', 0); if (JRequest::getVar('task') == 'compare') { $this->getCompare(); } else { if ($id) { if ($this->getLayout() == 'default') { $app =& JFactory::getApplication(); global $templatePath; $templatePath = JPATH_BASE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_jea' . DS . 'properties' . DS . 'tmpl' . DS; $this->_createFileName('', 'form'); $this->addTemplatePath($templatePath); // $tpl = 'item'; $tpl = 'form'; // $tpl = $this->_createFileName('', 'hoan'); // print_r($tpl); // exit(); } $this->getItemDetail($id); } else { $this->getItemsList(); } } JHTML::script('jea.js', 'media/com_jea/js/', false); //bat dau them if ($tpl == 'form') { //get params values $this->googlemap_display = $this->params->get('googlemap_display'); $this->googlemap_disable = $this->params->get('googlemap_disable'); $this->show_googlemap = $this->params->get('show_googlemap'); $this->bdslqmo = $this->params->get('bdslqmo'); $keyvnprice = ''; // get show ajax $GetShowBDSLQ = JeaViewProperties::GetShowBDSLQ($keyvnprice); $this->assignRef('ShowProperties', $GetShowBDSLQ); // get show ajax $getShowAjax = JeaViewProperties::getShowAjax(); $this->assignRef('ShowAjax', $getShowAjax); // hien thi cho trinh dien anh $ShowImageList = JeaViewProperties::getShowImageList(); $this->assignRef('ShowImageList', $ShowImageList); // hien thi cho trinh dien anh $ShowImage = JeaViewProperties::getShowImage(); $this->assignRef('ShowImage', $ShowImage); // hien thi layout chi tiet bds o fontend $this->Status = 0; // getlegal_statusList $legalstatusList = JeaViewProperties::getlegal_statusList($id); $this->assignRef('legalstatusList', $legalstatusList); // getAdvantageslist $Advantageslist = JeaViewProperties::getAdvantageslist(); $this->assignRef('Advantageslist', $Advantageslist); // // bat dong san lien quan //$SamPro = JeaViewProperties::GetBDSLienQuan(); //$this->assignRef('SamPro' , $SamPro ); } parent::display($tpl); }
function luot_xem() { $propertiesView = new JeaViewProperties(); $propertiesView->updateLuotXem(); $this->_setDefaultRedirect(); }
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(); }