示例#1
0
function wap_output()
{
    global $EXT, $CFG;
    $data = ob_get_contents();
    ob_end_clean();
    if ($EXT['wap_charset'] == 'unicode') {
        $data = unicode($data);
    } else {
        if (strtolower($CFG['charset'] != 'utf-8')) {
            $data = convert($data, $CFG['charset'], 'utf-8');
        }
    }
    echo $data;
}
示例#2
0
 public function invoice()
 {
     $this->load->model('catalog/product');
     $this->load->model('checkout/order');
     $this->load->model('account/order');
     $this->load->model('tool/image');
     $this->language->load('error/not_found');
     $this->language->load('order/invoice');
     if (isset($this->request->get['order_id'])) {
         $order_id = (int) $this->encryption->decrypt($this->request->get['order_id']);
     } else {
         $order_id = 0;
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         $this->data['base'] = HTTPS_SERVER;
     } else {
         $this->data['base'] = HTTP_SERVER;
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $array_allow_status_id = array(5);
     $order_info = $this->model_checkout_order->getOrder($order_id);
     //        print_r(in_array($order_info['order_status_id'],$array_allow_status_id)); exit;
     if (isset($this->request->get['status']) && $this->request->get['status'] == 1) {
         $status = $this->request->get['status'];
     } elseif (in_array($order_info['order_status_id'], $array_allow_status_id)) {
         $status = in_array($order_info['order_status_id'], $array_allow_status_id);
     }
     if ($order_info && $status) {
         //Text
         $heading_title = $order_info['order_id'] . " - Khách hàng: " . $order_info['lastname'] . " " . $order_info['firstname'] . " | Viet Fun Travel";
         $heading_title_print = "Viet Fun Travel Đơn hàng " . $order_info['order_id'];
         $this->data['heading_title_print'] = unicode($heading_title_print);
         $this->data['heading_title_text'] = sprintf($this->language->get('heading_title_text'), $heading_title);
         $this->data['title'] = $this->language->get('title');
         $this->data['title_welcome'] = $this->language->get('title_welcome');
         $this->data['text_customer_info'] = $this->language->get('text_customer_info');
         $this->data['text_company_info'] = $this->language->get('text_company_info');
         $this->data['text_customer'] = $this->language->get('text_customer');
         $this->data['text_telephone'] = $this->language->get('text_telephone');
         $this->data['text_email'] = $this->language->get('text_email');
         $this->data['text_address'] = $this->language->get('text_address');
         $this->data['text_represent'] = $this->language->get('text_represent');
         $this->data['text_website'] = $this->language->get('text_website');
         $this->data['text_date'] = $this->language->get('text_date');
         $this->data['text_content'] = $this->language->get('text_content');
         $this->data['text_quality'] = $this->language->get('text_quality');
         $this->data['text_price'] = $this->language->get('text_price');
         $this->data['text_website_company'] = $this->language->get('text_website_company');
         $this->data['text_included'] = $this->language->get('text_included');
         $this->data['text_notincluded'] = $this->language->get('text_notincluded');
         $this->data['text_total'] = $this->language->get('text_total');
         $this->data['text_total_number'] = $this->language->get('text_total_number');
         $this->data['text_sub_total'] = $this->language->get('text_sub_total');
         $this->data['text_promotion_total'] = $this->language->get('text_promotion_total');
         $this->data['text_deposit'] = $this->language->get('text_deposit');
         $this->data['text_balance'] = $this->language->get('text_balance');
         $this->data['text_note'] = $this->language->get('text_note');
         $this->data['text_signature'] = $this->language->get('text_signature');
         $this->data['text_print'] = $this->language->get('text_print');
         $this->data['text_pdf'] = $this->language->get('text_pdf');
         $this->data['text_home'] = $this->language->get('text_home');
         //data
         $this->data['header'] = html_entity_decode($this->config->get('header_site'), ENT_QUOTES, 'UTF-8');
         $this->data['footer'] = html_entity_decode($this->config->get('footer_site'), ENT_QUOTES, 'UTF-8');
         $this->data['customer'] = array('customer_id' => $order_info['customer_id'], 'customer_name' => $order_info['lastname'] . ' ' . $order_info['firstname'], 'telephone' => $order_info['telephone'], 'email' => $order_info['email'], 'address' => $order_info['payment_address_1'] . ' - ' . $order_info['payment_zone'] . ' - ' . $order_info['payment_country']);
         $this->data['text_date_hcm'] = sprintf($this->language->get('text_date_hcm'), date('d', time()), date('m', time()), date('Y', time()));
         $this->data['payment_method'] = $order_info['payment_method'];
         $this->data['comment'] = $order_info['comment'];
         $this->data['products'] = array();
         $products = $this->model_account_order->getOrderProducts($order_id);
         foreach ($products as $product) {
             $option_data = array();
             $options = $this->model_account_order->getOrderOptions($order_id, $product['order_product_id']);
             foreach ($options as $option) {
                 if ($option['type'] != 'file') {
                     $value = $option['value'];
                 } else {
                     $value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
                 }
                 $option_data[] = array('name' => $option['name'], 'value' => utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value, 'type' => $option['type']);
             }
             $result = $this->model_catalog_product->getProduct($product['product_id']);
             if (isset($result['custom_link'])) {
                 $custom_link = '&path=' . $result['custom_link'];
             }
             $this->data['products'][] = array('name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'included' => $this->replace_tag(html_entity_decode($product['included'], ENT_QUOTES, 'UTF-8')), 'notincluded' => $this->replace_tag(html_entity_decode($product['notincluded'], ENT_QUOTES, 'UTF-8')), 'href' => $this->url->link('product/product', $custom_link . '&product_id=' . $product['product_id']), 'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']), 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? $product['tax'] * $product['quantity'] : 0), $order_info['currency_code'], $order_info['currency_value']));
         }
         //Total
         $promotion_total = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . $order_id . "'")->rows;
         $total_promo = $sub_total = 0;
         foreach ($promotion_total as $item) {
             if ($item['code'] == 'sub_person') {
                 $total_promo += $item['value'];
             }
             if ($item['code'] == 'sub_child') {
                 $total_promo += $item['value'];
             }
             if ($item['code'] == 'sub_total') {
                 $sub_total += $item['value'];
             }
         }
         $totalsaleoff = $this->model_account_order->getPriceOrderSaleOff($order_id);
         if ($totalsaleoff) {
             $this->data['promotion_total'] = $totalsaleoff['saleoff'];
             $this->data['format_promotion_total'] = $this->currency->format($totalsaleoff['saleoff']);
             $this->data['total'] = $this->currency->format($totalsaleoff['total_saleoff']);
             $this->data['total_text'] = floor($totalsaleoff['total_saleoff']);
         } else {
             $this->data['promotion_total'] = $total_promo;
             $this->data['format_promotion_total'] = $this->currency->format($total_promo);
             $this->data['total'] = $this->currency->format($order_info['total']);
             $this->data['total_text'] = floor($order_info['total']);
         }
         $this->data['sub_total'] = $this->currency->format($sub_total);
         //end
         $this->data['order_deposite'] = array();
         $order_deposite = $this->model_account_order->getOrderDeposit($order_id);
         if ($order_deposite) {
             $this->data['order_deposite'] = array('deposit' => $order_deposite['deposit'], 'format_deposit' => $this->currency->format($order_deposite['deposit']), 'balance' => $order_deposite['balance'], 'format_balance' => $this->currency->format($order_deposite['balance']), 'note' => $order_deposite['note']);
             $this->data['total_order_deposite_deposit'] = floor($order_deposite['deposit']);
             $this->data['total_order_deposite_balance'] = floor($order_deposite['balance']);
         }
         $username = '******';
         $not_get = array('admin', 'administrator');
         $order_log = $this->model_account_order->getOrderLogs($order_id);
         if ($order_log) {
             $order_log = array_shift($order_log);
             if (!in_array($order_log['user'], $not_get)) {
                 $username = $order_log['user'];
             }
         }
         $this->data['user'] = array();
         $user_info = $this->db->query("SELECT * FROM `" . DB_PREFIX . "user` WHERE username = '******'")->row;
         if ($user_info) {
             $this->data['user'] = array('id' => $user_info['user_id'], 'name' => $user_info['firstname'] . ' ' . $user_info['lastname'], 'email' => $user_info['email'], 'phone' => $user_info['phone'], 'image' => $this->model_tool_image->resize($user_info['image'], 170, 100));
         }
         $this->data['thumb_vf'] = $this->model_tool_image->resize('data/dulichvietvui.png', 170, 170);
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/order/invoice.tpl')) {
             $this->template = $this->config->get('config_template') . '/template/order/invoice.tpl';
         } else {
             $this->template = 'default/template/product/invoice.tpl';
         }
         $this->response->setOutput($this->render());
     } else {
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_error'), 'href' => $this->url->link('error/not_found'), 'separator' => $this->language->get('text_separator'));
         $this->document->setTitle($this->language->get('text_error'));
         $this->data['heading_title'] = $this->language->get('text_error');
         $this->data['text_error'] = $this->language->get('text_error');
         $this->data['button_continue'] = $this->language->get('button_continue');
         $this->data['continue'] = $this->url->link('common/home');
         $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found');
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
             $this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
         } else {
             $this->template = 'default/template/error/not_found.tpl';
         }
         $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
         $this->response->setOutput($this->render());
     }
 }
 function boSungThongTinBDS($propertyList, $templatePath, $moduleId, $tempalateName = NULL)
 {
     $propertyListCount = count($propertyList);
     for ($i = 0; $i < $propertyListCount; $i++) {
         // lay link va hinh anh thumbnail
         $tempImage = ilandCommonUtils::getPropertyThumbnail($propertyList[$i]['id']);
         $propertyList[$i]['image'] = $tempImage['min_url'];
         if (empty($propertyList[$i]['alias'])) {
             $propertyList[$i]['alias'] = unicode($propertyList[$i]['tieu_de']);
         }
         $propertyList[$i]['link'] = ilandCommonUtils::getPropertyLink($propertyList[$i]['alias'], $propertyList[$i]['id']);
         // lay template tien te
         $propertyList[$i]['tien_te_HTML'] = ilandCommonUtils::fetchCurrencyTemplate($propertyList[$i], $templatePath, $moduleId, $tempalateName);
         if (!empty($propertyList[$i]['ngay_dang'])) {
             $propertyList[$i]['ngay_dang'] = date('d-m-Y', $propertyList[$i]['ngay_dang']);
         }
         if (!empty($propertyList[$i]['ngay_chinh_sua'])) {
             $propertyList[$i]['ngay_chinh_sua'] = date('d-m-Y', $propertyList[$i]['ngay_chinh_sua']);
         }
         $propertyList[$i]['dia_chi'] = ilandCommonUtils::ketHopDiaChi($propertyList[$i]['so_nha'], $propertyList[$i]['duong_pho'], $propertyList[$i]['phuong_xa'], $propertyList[$i]['quan_huyen'], $propertyList[$i]['tinh_thanh']);
         $propertyList[$i]['gia_m2'] = ilandCommonUtils::reFormatPrice($propertyList[$i]['gia_m2']);
         $propertyList[$i]['gia_nguyen_can'] = ilandCommonUtils::reFormatPrice($propertyList[$i]['gia_nguyen_can']);
         /*									 
         			if($propertyList[$i]['don_vi_dien_tich_id']==1||$propertyList[$i]['don_vi_dien_tich_id']==3){
         				$propertyList[$i]['gia_nguyen_can'] =  ilandCommonUtils::layGiaNguyenCan( array('dien_tich_su_dung'=>$propertyList[$i]['dien_tich_su_dung'],
         											 									'gia'=>$propertyList[$i]['gia']) );
         			}
         			else if($propertyList[$i]['don_vi_dien_tich_id']==2||$propertyList[$i]['don_vi_dien_tich_id']==4){
         				$propertyList[$i]['gia_m2'] =  ilandCommonUtils::layGiaM2( array('dien_tich_su_dung'=>$propertyList[$i]['dien_tich_su_dung'], 
         											 									'gia'=>$propertyList[$i]['gia']) );
         			}
         			* 
         */
         $propertyList[$i]['gia'] = ilandCommonUtils::layGiaTien(array('don_vi_tien_id' => $propertyList[$i]['don_vi_tien_id'], 'don_vi_dien_tich_id' => $propertyList[$i]['don_vi_dien_tich_id'], 'gia' => $propertyList[$i]['gia']));
         //$propertyList[$i]['gia'] = ilandCommonUtils::reFormatPrice($propertyList[$i]['gia']);
         $propertyList[$i]['luot_xem'] = ilandCommonUtils::demLuotXemBDS($propertyList[$i]['id']);
     }
     return $propertyList;
 }
示例#4
0
 function save()
 {
     global $mainframe;
     if (isset($_POST['tks'])) {
         U_ReModelProperties::saveUser();
         $nguoidang = U_ReModelProperties::getIdUserByUserName(JRequest::getVar('email', '', 'POST', 'string'));
     } else {
         $nguoidang = JRequest::getVar('customer', '0', 'POST');
     }
     $id = JRequest::getInt('id', '');
     // lay gia
     // TODO: remove hardcode 8 7, 1000000, 1000000000
     $priceInt = JRequest::getVar('gia', '0', 'POST');
     $curprice = str_replace(",", "", $priceInt);
     if (JRequest::getInt('price_unit', 0, 'POST') == '8') {
         $price_unit = '1';
         $price = $curprice * 1000000;
         $donvitien = 'VND';
     } else {
         if (JRequest::getInt('price_unit', 0, 'POST') == '7') {
             $price_unit = '1';
             $price = $curprice * 1000000000;
             $donvitien = 'VND';
         } else {
             $price_unit = JRequest::getInt('price_unit', 0, 'POST');
             $price = str_replace(",", "", $priceInt);
             //   $price=JRequest::getFloat( 'gia', 0.0, 'POST' );
             $donvitien = JRequest::getVar('vi_don_vi_tien', 0, 'POST');
         }
     }
     $ngaydang = '' . time();
     $so_thu_tu = '' . ilandCommonUtils::layOrdering('bat_dong_san');
     $kind_name = U_ReModelProperties::getCustomFieldTabla(JRequest::getVar('kind_id', 0, 'POST'), 'ten', 'iland4_loai_giao_dich_vi');
     $type_name = U_ReModelProperties::getCustomFieldTabla(JRequest::getVar('type_id', 0, 'POST'), 'ten', 'iland4_loai_bds_vi');
     $tinh_name = U_ReModelProperties::getCustomFieldTabla(JRequest::getVar('town_id', 0, 'POST'), 'ten', 'iland4_tinh_thanh');
     $quan_name = U_ReModelProperties::getCustomFieldTabla(JRequest::getVar('area_id', 0, 'POST'), 'ten', 'iland4_quan_huyen');
     $duan = str_replace('Vui lòng chọn', '', JRequest::getVar('du_an_text_value', '', 'POST', 'string', JREQUEST_ALLOWRAW));
     if ($duan !== '') {
         $duan = " " . $duan;
     } else {
         $duan = '';
     }
     $tieude = $kind_name . " " . $type_name . $duan . ", " . $quan_name . ", " . $tinh_name;
     $alias = unicode($tieude);
     $datas_vi = array('ma_so' => JRequest::getVar('properties_key', 0, 'POST'), 'loai_bds_id' => JRequest::getVar('type_id', 0, 'POST'), 'loai_giao_dich_id' => JRequest::getVar('kind_id', 0, 'POST'), 'phap_ly' => JRequest::getVar('phap_ly', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'don_vi_dien_tich_id' => JRequest::getVar('price_area_unit', 0, 'POST'), 'moi_nhat' => JRequest::getVar('moi_nhat', '1', 'POST', 'string'), 'noi_bat' => JRequest::getVar('noi_bat', '0', 'POST', 'string'), 'da_ban' => JRequest::getVar('da_ban', '0', 'POST', 'string'), 'kinh_do' => JRequest::getVar('map_lat', '0', 'POST'), 'vi_do' => JRequest::getVar('map_lng', '0', 'POST'), 'hien_thi_ra_ngoai' => JRequest::getVar('hien_thi_ra_ngoai', '0', 'POST'), 'don_vi_tien_id' => '' . $price_unit, 'tinh_thanh_id' => JRequest::getVar('town_id', '0', 'POST'), 'quan_huyen_id' => JRequest::getVar('area_id', '0', 'POST'), 'huong_id' => '' . JRequest::getVar('direction_id', '0', 'POST'), 'huong' => '' . JRequest::getVar('vi_huong', '', 'POST'), 'gia' => '' . $price, 'loai_tin_id' => '' . JRequest::getVar('loai_tin_id', '1', 'POST'), 'truong' => JRequest::getVar('truong', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'benh_vien' => JRequest::getVar('benhvien', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'sieu_thi' => JRequest::getVar('sieuthi', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'chinh_chu' => str_replace('on', '0', JRequest::getVar('chinh_chu', '1', 'POST')), 'noi_that' => JRequest::getVar('noi_that', '0', 'POST', 'string', JREQUEST_ALLOWRAW), 'speak_english' => str_replace('on', '1', JRequest::getVar('speak_english', '0', 'POST')), 'dien_thoai_nguoi_lien_he' => JRequest::getVar('phone_vl', '', 'POST'), 'so_tang' => JRequest::getVar('so_tang', '0', 'POST'), 'dien_tich_khuon_vien' => JRequest::getVar('dien_tich_khuon_vien', '0', 'POST'), 'dien_tich_su_dung' => JRequest::getVar('dien_tich_su_dung', '0', 'POST'), 'dien_tich_khuon_vien_rong' => JRequest::getVar('dien_tich_khuon_vien_rong', '0', 'POST'), 'dien_tich_khuon_vien_dai' => JRequest::getVar('dien_tich_khuon_vien_dai', '0', 'POST'), 'dien_tich_xay_dung_dai' => JRequest::getVar('dien_tich_xay_dung_dai', '0', 'POST'), 'dien_tich_xay_dung_rong' => JRequest::getVar('dien_tich_xay_dung_rong', '0', 'POST'), 'tien_ich_id' => JRequest::getVar('advantagesGetValue', '0', 'POST'), 'ordering' => $so_thu_tu, 'phong_khach' => JRequest::getVar('phong_khach', '0', 'POST'), 'phong_ngu' => JRequest::getVar('phong_ngu', '0', 'POST'), 'phong_tam' => JRequest::getVar('phong_tam', '0', 'POST'), 'phong_khac' => JRequest::getVar('phong_khac', '0', 'POST'), 'tieu_de_trang' => JRequest::getVar('tieu_de_trang', '', 'POST'), 'tu_khoa_trang' => JRequest::getVar('tu_khoa_trang', '', 'POST'), 'mo_ta_trang' => JRequest::getVar('mo_ta_trang', '', 'POST'), 'alias' => $alias, 'tieu_de' => $tieude, 'dia_chi' => JRequest::getVar('vi_hidden_address', '', 'POST'), 'ma_nguoi_dang' => $nguoidang, 'ten_nguoi_lien_he' => JRequest::getVar('name_vl', '', 'POST'), 'email_nguoi_lien_he' => JRequest::getVar('email_vl', '', 'POST'), 'dia_chi_nguoi_lien_he' => JRequest::getVar('address_vl', '', 'POST'), 'ghi_chu_nguoi_lien_he' => JRequest::getVar('ghichu', '', 'POST'), 'mo_ta_chi_tiet' => JRequest::getVar('vi_hidden_description', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'loai_bds' => JRequest::getVar('vi_loai_giao_dich', '', 'POST'), 'loai_giao_dich' => JRequest::getVar('vi_loai_bds', '', 'POST'), 'don_vi_dien_tich' => JRequest::getVar('vi_don_vi_dien_tich', '0', 'POST'), 'don_vi_tien' => $donvitien, 'tinh_thanh' => JRequest::getVar('vi_tinh_thanh', '', 'POST'), 'quan_huyen' => JRequest::getVar('vi_quan_huyen', '', 'POST'), 'phuong_xa' => JRequest::getVar('phuong_xa', '', 'POST'), 'duong_pho' => JRequest::getVar('dia_chi', '', 'POST', 'string', JREQUEST_ALLOWRAW), 'so_nha' => JRequest::getVar('so_nha', '', 'POST'), 'thong_tin_tong_quan' => JRequest::getVar('vi_pro_total_info', '', 'POST'), 'du_an' => str_replace('Vui lòng chọn', '', JRequest::getVar('du_an_text_value', '', 'POST', 'string', JREQUEST_ALLOWRAW)), 'du_an_id' => JRequest::getVar('du_an_id', '', 'POST'));
     // set default sef
     if (empty($datas_vi['alias'])) {
         $datas_vi['alias'] = str_replace(' ', '-', $datas_vi['tieu_de']);
     }
     if (!empty($datas_vi['mo_ta_chi_tiet'])) {
         $datas_vi['mo_ta_chi_tiet'] = ilandCommonUtils::stripWordContent($datas_vi['mo_ta_chi_tiet']);
     }
     //vanganh them
     $datas_vi['tong_gia_tri'] = '0';
     if ($datas_vi['don_vi_dien_tich'] == 'm2') {
         if (is_numeric($datas_vi['gia']) && is_numeric($datas_vi['dien_tich_khuon_vien_rong']) && is_numeric($datas_vi['dien_tich_khuon_vien_dai'])) {
             $datas_vi['tong_gia_tri'] = '' . $datas_vi['gia'] * $datas_vi['dien_tich_khuon_vien_rong'] * $datas_vi['dien_tich_khuon_vien_dai'];
         }
     } else {
         $datas_vi['tong_gia_tri'] = $datas_vi['gia'];
     }
     //xử lý giá thêm 2 field giá m2 và giá nguyên căn Thông Thêm.
     if ($datas_vi['don_vi_dien_tich_id'] == 1 || $datas_vi['don_vi_dien_tich_id'] == 3) {
         $datas_vi['gia_m2'] = $datas_vi['gia'];
         $datas_vi['gia_nguyen_can'] = '' . round($datas_vi['gia'] * $datas_vi['dien_tich_su_dung'], -3);
     } else {
         $datas_vi['gia_nguyen_can'] = $datas_vi['gia'];
         if ($datas_vi['dien_tich_su_dung'] != 0) {
             $datas_vi['gia_m2'] = '' . round($datas_vi['gia'] / $datas_vi['dien_tich_su_dung'], -3);
         } else {
             $datas_vi['gia_m2'] = '0';
         }
     }
     // web vhl tat phuong xa di
     $ti = '-';
     if ($id) {
         //tieng viet
         if ($datas_vi['ma_so'] == '0' || $datas_vi['ma_so'] == '') {
             $datas_vi['ma_so'] = '' . $id;
         }
         $DataValue = array_values($datas_vi);
         $DataKey = array_keys($datas_vi);
         $i = 0;
         $Keyvalue = '';
         foreach ($DataKey as $data) {
             $Keyvalue .= ",";
             $Keyvalue .= $data;
             $Keyvalue .= " = ";
             $Keyvalue .= "'{$DataValue[$i]}'";
             $i++;
         }
         $paramvi = substr($Keyvalue, 1);
         U_ReModelProperties::getUpdateProperties($id, $paramvi, 'vi');
     } else {
         //	them bds
         // 'ngay_dang' => $ngaydang,
         // 'ngay_chinh_sua' => $ngaydang,
         // them ngay dang va ngay chinh sua
         $datas_vi['ngay_dang'] = $ngaydang;
         $datas_vi['ngay_chinh_sua'] = $ngaydang;
         if ($datas_vi['ma_so'] == '0' || $datas_vi['ma_so'] == '') {
             $datas_vi['ma_so'] = '' . ilandCommonUtils::layMaSo();
         }
         $DataKey = array_keys($datas_vi);
         $Keyvalue = '';
         foreach ($DataKey as $Datavalue) {
             $Keyvalue .= ',';
             $Keyvalue .= $Datavalue;
         }
         $paramvi = substr($Keyvalue, 1);
         $insertId = U_ReModelProperties::themBDS($paramvi, $datas_vi, 'vi');
         if ($insertId != 0) {
             $msg = "Tin của bạn đã được lưu thành công với mã số: <b>" . $insertId . "</b>";
         }
     }
     if ($id) {
         $insertId = $id;
     }
     if (!U_ReModelProperties::uploadImages($insertId)) {
         JError::raiseWarning(200, 'Image upload error');
         return false;
     }
     // echo"<script>alert('Đăng nhập thành công ');document.location.href='index.php'</script>";
     // tro link sau khi da dang tin bds
     switch ($datas_vi['loai_giao_dich_id']) {
         case 1:
             $l_loai_giao_dich = "selling";
             break;
         case 2:
             $l_loai_giao_dich = "renting";
             break;
         case 3:
             $l_loai_giao_dich = "needbuying";
             break;
         case 4:
             $l_loai_giao_dich = "needrenting";
             break;
         default:
             $l_loai_giao_dich = "selling";
             break;
     }
     $dd = JRequest::getVar('re_link', 0, 'POST');
     if ($dd) {
         if ($dd == 1) {
             if (isset($_POST['tkslogin']) || isset($_POST['tks'])) {
                 $credentials = array();
                 $options = null;
                 $credentials['username'] = JRequest::getVar('username', '', 'method', '');
                 $credentials['password'] = JRequest::getVar('password', '', 'post', JREQUEST_ALLOWRAW);
                 $mainframe->login($credentials, $options);
             }
             $ms = "<script>alert('Tin của bạn đã lưu thành công, nhưng phải đợi quản trị duyệt mới có thể hiển thị ra ngoài')</script>";
             $mainframe->redirect('index.php?option=com_u_re&task=viewDetail&view=properties&preview=1&Itemid=186&id=' . $insertId, $msg . $ms);
         } else {
             if ($dd == 2) {
                 // echo "<script>alert('Tin đã được lưu')</script>";
                 //$mainframe->redirect('index.php?option=com_u_re&view=manage&Itemid=8');
                 //$currentSession = JFactory::getSession();
                 $userdn = JRequest::getVar('username', '', 'method', 'username');
                 $emaildn = JRequest::getVar('email', '', 'method', '');
                 if ($userdn !== '') {
                     $username = $userdn;
                 } else {
                     $username = $emaildn;
                 }
                 if (isset($_POST['tkslogin']) || isset($_POST['tks'])) {
                     $credentials = array();
                     $options = null;
                     $credentials['username'] = $username;
                     $credentials['password'] = JRequest::getVar('password', '', 'post', JREQUEST_ALLOWRAW);
                     $mainframe->login($credentials, $options);
                 }
                 $user = JFactory::getUser();
                 if ($user->id != 0) {
                     $mainframe->redirect('index.php?option=com_u_re&view=manage&Itemid=8', $msg);
                 } else {
                     //if(isset($_POST['tkslogin'])){
                     //if($insertId != 0){
                     $ms = "<script>alert('Tin của bạn đã lưu thành công, nhưng phải đợi quản trị duyệt mới có thể hiển thị ra ngoài')</script>";
                     //}
                     $mainframe->redirect('index.php?option=com_u_re&view=manage&layout=form&task2=noregister&Itemid=226', $msg . $ms);
                     //}
                     //else{
                     //	$mainframe->redirect('index.php');
                 }
             } else {
                 $mainframe->redirect('index.php?option=com_jea&controller=properties');
             }
         }
     }
 }