Exemple #1
0
 //$limit = $_GET['limit'];
 $limit = 1000000000;
 $price[] = array();
 $price['price_min'] = 0;
 $price['price_max'] = 0;
 //$price['price_min']=$_GET['price_min'];
 //$price['price_max']=$_GET['price_max'];
 $returnField = $_GET['returnField'];
 if ($price['price_min'] != '' || $price['price_max'] != '') {
     $newcondition = $condition . ' AND';
     $newField = 'bds.' . $returnField;
     $newField = str_replace('ordering', 'bds.ordering', $newField);
     $ordering = str_replace('ordering', 'bds.ordering', $ordering);
     $dataAll = iland4_layDanhSachBDSTheoGia($dbConfig, $newField, $newcondition, $price['price_min'], $price['price_max'], $currentPage, $limit, $ordering, $language);
 } else {
     $dataAll = iland4_layDanhSachBDS($dbConfig, $returnField, $condition, $currentPage, $limit, $ordering, $language);
 }
 $templatePath = $_GET['templatePath'];
 $templateName = $_GET['templateName'];
 $tienTemplatePath = $_GET['tienTemplatePath'];
 $moduleId = $_GET['moduleId'];
 $data = ilandCommonUtils::boSungThongTinBDS($dataAll[3], $tienTemplatePath, $moduleId);
 // TODO: dua ra giai phap tot hon.
 $contentElementId = $_GET['idContentElement'];
 $url = ilandCommonUtils::getCurrentPageURL();
 $ajaxPagingTemplate = $_GET['ajaxPagingTemplate'];
 $totalPage = $dataAll[1];
 // include $templatePath . DS . $templateName . '.php';
 $conditionStr = $_GET['condition'];
 $conditionParam = explode('OR', $conditionStr);
 /*if ( strpos( $conditionParam[0], 'loai_giao_dich_id' ) )
 function ktMaSo($id, $ma_so = '0')
 {
     $language = 'vi';
     // ilandCommonUtils::getLanguage(); vanganh fix
     $DBConfig = ilandCommonUtils::getSiteDBConfig();
     $condition = "ma_so like '{$ma_so}'";
     if ($id != '') {
         $condition = "id!={$id} and " . $condition;
     }
     $value = iland4_layDanhSachBDS($DBConfig, 'id', $condition, 1, 10, '', $language);
     //return $value;
     if (count($value[3]) >= 1) {
         return 1;
     } else {
         return 0;
     }
 }
Exemple #3
0
 function layDanhSachBatDongSan($returnField, $page, $limit, $language, $orderby, $noContext = 0)
 {
     $DBConfig = ilandCommonUtils::getSiteDBConfig();
     $user =& JFactory::getUser();
     $result = array();
     $context = 'com_jea.projects';
     $mainframe =& JFactory::getApplication();
     if (!$noContext) {
         $bds_id = $mainframe->getUserStateFromRequest($context . 'loai_bds_id', 'loai_bds_id', 0, 'int');
     } else {
         $bds_id = JRequest::getVar('loai_bds_id', 0);
     }
     // $loai_giao_dich_id = $mainframe->getUserStateFromRequest( $context.'loai_giao_dich_id', 'loai_giao_dich_id', 0, 'int' );
     $town_id = $mainframe->getUserStateFromRequest($context . 'town_id', 'town_id', 0, 'int');
     $area_id = $mainframe->getUserStateFromRequest($context . 'area_id', 'area_id', 0, 'int');
     if (!$noContext) {
         $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     } else {
         $search = $_POST['search'];
     }
     if ($search == 'Từ khóa tìm kiếm') {
         $search = '';
     }
     if (!$noContext) {
         $published = $mainframe->getUserStateFromRequest($context . 'published', 'published', -1, 'int');
     } else {
         //$published = $_POST['published'];
         $published = JRequest::getVar('published', -1);
     }
     $emphasis = $mainframe->getUserStateFromRequest($context . 'emphasis', 'emphasis', -1, 'int');
     $spam = $mainframe->getUserStateFromRequest($context . 'spam', 'spam', -1, 'int');
     // $conditionParams =  '' ;
     // print_r('loai_giao_dich_id'.$loai_giao_dich_id);
     $_SESSION['cat'] = '';
     $cat = JFactory::getURI()->getVar("cat");
     if ($cat != NULL) {
         $_SESSION['cat'] = $cat;
     }
     $loaiBDS = $_SESSION['cat'];
     $Kindwhere = '';
     switch ($loaiBDS) {
         case 'selling':
             $Kindwhere = " loai_giao_dich_id=1";
             break;
         case 'renting':
             $Kindwhere = " loai_giao_dich_id=2";
             break;
         case 'needbuying':
             $Kindwhere = " loai_giao_dich_id=3";
             break;
         case 'needrenting':
             $Kindwhere = " loai_giao_dich_id=4";
             break;
             // default: $Kindwhere = " loai_bds_id =2";
             // break;
     }
     // print_r($loaiBDS);
     if ($Kindwhere) {
         $conditionParams = $Kindwhere;
     } else {
         $conditionParams = '1 ';
     }
     //$loai_du_an_id = JFactory::getURI()->getVar("loai_du_an_id");
     if ($user->usertype != 'Super Administrator') {
         $conditionParams .= ' AND ma_nguoi_dang = ' . $user->id;
     }
     if ($emphasis != -1) {
         $conditionParams .= ' AND noi_bat = ' . $emphasis;
     }
     if ($spam != -1) {
         $conditionParams .= ' AND bao_cao_sai_pham = ' . $spam;
     }
     if ($published != -1) {
         $conditionParams .= ' AND hien_thi_ra_ngoai = ' . $published;
     }
     if ($town_id != 0) {
         $conditionParams .= ' AND tinh_thanh_id = ' . $town_id;
     }
     if ($area_id != 0 && $town_id != 0) {
         $conditionParams .= ' AND quan_huyen_id = ' . $area_id;
     }
     //if ( $type_id!= 0 )  $conditionParams .= ' AND loai_du_an_id = '.$type_id;
     if ($search != NULL) {
         $conditionParams .= " AND (tieu_de LIKE '%" . $search . "%' OR id = '" . $search . "')";
     }
     //if( $loai_du_an_id ) $conditionParams .= ' AND loai_du_an_id = '.$loai_du_an_id;
     if ($bds_id != 0) {
         $conditionParams .= ' AND loai_bds_id = ' . $bds_id;
     }
     $result['search'] = $search;
     $result['town_id'] = $town_id;
     $result['area_id'] = $area_id;
     $result['published'] = $published;
     $result['emphasis'] = $emphasis;
     $result['spam'] = $spam;
     $result['loai_bds_id'] = $bds_id;
     $result['rows'] = iland4_layDanhSachBDS($DBConfig, $returnField, $conditionParams, $page, $limit, $orderby, $language);
     return $result;
 }