예제 #1
0
function lay_du_lieu($table)
{
    $language = '';
    if ($language == NULL) {
        $language = ilandCommonUtils::getLanguage();
    }
    $propertyModel = new U_reModelProperties();
    $projectModel = new U_ReModelProjects();
    switch ($table) {
        case 'loai_giao_dich':
            return $propertyModel->layDanhSachLoaiGiaoDich($language);
        case 'huong':
            return $propertyModel->layDanhSachHuong($language);
        case 'loai_bds':
            return $propertyModel->layDanhSachLoaiBatDongSan($language);
        case 'tinh_thanh':
            return $propertyModel->layDanhSachTinhThanh($language);
        case 'quan_huyen':
            if (JRequest::getVar('tinh_thanh_id')) {
                $townId = JRequest::getVar('tinh_thanh_id');
            } else {
                // $townId = U_ReConfig::getValueByKey( 'COMMON', 'tinh_thanh_mac_dinh' );
                if (isset($_SESSION['tmp'])) {
                    $townId = $_SESSION['tmp']['tinh_thanh_id'];
                } else {
                    $townId = 0;
                }
            }
            return $propertyModel->layDanhSachQuanHuyen($townId, 'vi');
        case 'phuong_xa':
            if (JRequest::getVar('quan_huyen_id')) {
                $quanHuyenId = JRequest::getVar('quan_huyen_id');
            } else {
                $quanHuyenId = U_ReConfig::getValueByKey('COMMON', 'quan_huyen_mac_dinh');
            }
            return $propertyModel->layDanhSachPhuongXa($quanHuyenId);
        case 'duong_pho':
            if (JRequest::getVar('quan_huyen_id')) {
                $quanHuyenId = JRequest::getVar('quan_huyen_id');
            } else {
                $quanHuyenId = U_ReConfig::getValueByKey('COMMON', 'quan_huyen_mac_dinh');
            }
            return $propertyModel->layDanhSachDuongPho($quanHuyenId);
        case 'nhom_du_an':
            return $nhomduan = $projectModel->laynhomduan($language);
        case 'tien_ich':
            return $propertyModel->layDanhSachTienIch($language);
        case 'du_an':
            $ix_quan_huyen_id = JRequest::getVar('quan_huyen_id', 0);
            $ix_tinh_thanh_id = JRequest::getVar('tinh_thanh_id', 0);
            return $projectModel->laydanhsachduan($ix_quan_huyen_id, $ix_tinh_thanh_id);
    }
}
예제 #2
0
 function getSelectBox($table, $name, $title, $checked, $onchange = NULL, $townId = NULL, $style = NULL, $class = NULL, $language = NULL)
 {
     /*
     echo "<pre>";
     print_r( $name.'----'.$class );
     echo "</pre>";
     */
     if ($language == NULL) {
         $language = ilandCommonUtils::getLanguage();
     }
     // TODO: remove hardcode language
     //		$language = 'en';
     //		print_r($language);
     $propertyModel = new U_reModelProperties();
     $projectModel = new U_ReModelProjects();
     switch ($table) {
         case 'loai_giao_dich':
             $rows = $propertyModel->layDanhSachLoaiGiaoDich($language);
             //print_r($rows);
             //exit;
             break;
         case 'phap_ly':
             $rows = $propertyModel->layDanhSachPhapLy($language);
             break;
         case 'vi_tri':
             $rows = $propertyModel->layDanhSachTienIch('1', $language);
             //	print_r($rows);
             //	exit;
             break;
         case 'huong':
             $rows = $propertyModel->layDanhSachHuong($language);
             break;
         case 'don_vi_dien_tich':
             $temp = 1;
             if ($checked == 3 || $checked == 4) {
                 $temp = 2;
             }
             $rows = $propertyModel->layDanhSachDonViDienTich($language, $temp);
             break;
         case 'loai_bds':
             $rows = $propertyModel->layDanhSachLoaiBatDongSan($language);
             break;
         case 'tinh_thanh':
             $rows = $propertyModel->layDanhSachTinhThanh($language);
             break;
         case 'quan_huyen':
             $rows = $propertyModel->layDanhSachQuanHuyen($townId, $language);
             break;
         case 'loai_tien_ich':
             $DBConfig = ilandCommonUtils::getSiteDBConfig();
             $rows = iland4_layDanhSachLoaiTienIch($DBConfig, $language);
             break;
         case 'loai_du_an':
             //					$rows = $propertyModel->layDanhSachLoaiBatDongSan($language);
             $rows = $projectModel->laynhomduan($language);
             break;
         case 'nha_moi_gioi':
             //					$rows = $propertyModel->layDanhSachLoaiBatDongSan($language);
             $realtorData = $projectModel->laynhamoigioi($language);
             $rows = $realtorData[3];
             //	print_r($rows);
             // exit;
             break;
         case 'phuong_xa':
             // get quan huyen id
             $rows = $propertyModel->layDanhSachPhuongXa($townId);
             break;
         case 'duong_pho':
             $rows = $propertyModel->layDanhSachDuongPho($townId);
             break;
         case 'nhom_du_an':
             //	$rows =  $projectModel->laynhomduan($language);
             //	break;
             $nhomduan = $projectModel->laydanhsachduan();
             $rows = $nhomduan[3];
             break;
         case 'du_an':
             $rows = $projectModel->laydanhsachduan($townId);
             break;
     }
     /*
     	case 'jea_type' : $rows = getTypeList($language);
     	break;
     	case 'jea_town' : $rows = getTownList(U_ReUtils::getSiteConfig(), $language);
     	break;
     	case 'jea_area' : $rows = getAreaList(U_ReUtils::getSiteConfig(), $Town_id, $language);
     	break;
     	
     	case 'jea_project_type' : $rows = getProjectTypeList(U_ReUtils::getSiteConfig(), $language);
     	break;
     */
     if (empty($class)) {
         $class = "class='inputbox'";
     }
     $html = '';
     $html .= "<select name='" . $name . "' id='" . $name . "' onchange='" . $onchange . "' " . $class . $style . ">";
     if (!empty($title)) {
         $html .= "<option value='0'>{$title}</option>";
     }
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $selected = '';
             $selected = $row["id"] == $checked ? 'selected = selected' : '';
             $html .= "<option  value={$row['id']} {$selected} >{$row['ten']}</option>";
         }
     }
     $html .= "</select>";
     return $html;
 }