function getShowAjax() { $ajaxvalue = ''; $id = $this->row->id; $price = $this->row->price; $unit = $this->row->price_unit; $dvdat = $this->row->price_area_unit; $ps = $this->row->id; $liac1 = ''; $liac2 = ''; $liac3 = ''; switch ($unit) { case "USD": $donvitien = " USD"; $liac2 = "ac"; break; case "VND": $donvitien = ""; $liac1 = "ac"; break; case "SJC": $donvitien = " lượng"; $liac3 = "ac"; break; default: $donvitien = ""; break; } switch ($dvdat) { case "m2": $donvidat = "m<sup class='money_sup'>2</sup>"; break; case "Nguyên căn": $donvidat = ""; break; case "Tháng": $donvidat = "tháng"; break; default: $donvidat = ""; break; } $gia = reFormatPrice($this->row->price, $this->row->price_unit); if ($gia > 0) { if ($donvidat != "") { $dx = "/"; } else { $dx = ""; } $hientien = trim($gia . $donvitien) . $dx . $donvidat; } else { $hientien = "Thương lượng"; } $ajaxvalue .= "<div id='{$ps}' class=\"mon3\">"; $ajaxvalue .= $hientien; $ajaxvalue .= "</div>"; if ($gia > 0) { $db =& JFactory::getDBO(); $query = "SELECT * FROM #__jea_price_units ORDER BY ordering"; $db->setQuery($query); $result = $db->loadObjectList(); $i = 0; foreach ($result as $row) { if ($row->value == $unit) { $tigia = $row->rate; } $rate[$i] = $row->rate; $i++; } $tgvnd = $rate[0]; $tgusd = $rate[1]; $tgsjc = $rate[2]; global $keyvnprice; $keyvnprice = changePrice($price, $tigia, $tgvnd); $vnprice = trim(reFormatPrice(changePrice($price, $tigia, $tgvnd))); $usdprice = reFormatPrice(changePrice($price, $tigia, $tgusd)); $sjcprice = reFormatPrice(changePrice($price, $tigia, $tgsjc)); //$dvdatenti = htmlentities($donvidat, ENT_QUOTES); // echo '<input type="hidden" id="dvdat" value="' . $donvidat.' " />'; if ($dvdat == 'm2') { $donvidat = "m<sup>2</sup>"; } $ajaxvalue .= " <div class=\"tiente\"><a id=\"vnd_{$id}\" class='{$liac1}' href=\"javascript:GetChangePrice('1','{$vnprice}','{$usdprice}','{$sjcprice}','{$donvidat}','{$id}' ) \">VND</a></div>"; $ajaxvalue .= " <div class=\"tiente\"><a id=\"usd_{$id}\" class='{$liac2}' href=\"javascript:GetChangePrice('2','{$vnprice}','{$usdprice}','{$sjcprice}','{$donvidat}','{$id}') \">USD</a></div>"; $ajaxvalue .= " <div class=\"tiente\"><a id=\"sjc_{$id}\" class='{$liac3}' href=\"javascript:GetChangePrice('3','{$vnprice}','{$usdprice}','{$sjcprice}','{$donvidat}','{$id}') \">SJC</a></div>"; } return $ajaxvalue; }
function getSamLand($keytown_id = NULL, $keykind_id = NULL, $keytype_id = NULL, $tigia = NULL, $slht = NULL, $id = NULL, $khoanggia = NULL, $keyarea_id = NULL, $realtor = NULL, $price = NULL, $CurrenPage = NULL) { $db =& JFactory::getDBO(); $query = "SELECT * FROM #__jea_price_units ORDER BY ordering DESC"; $db->setQuery($query); $result = $db->loadObjectList(); foreach ($result as $row) { if ($row->id == $tigia) { $tigia = $row->rate; } $rate[0] = $row->rate; } /* chuyen doi ve tien viet */ $keyprice = changePrice($price, $tigia, $rate[0]); //print_r($keyprice); if ($keyprice > 0) { $keypricea = $keyprice; } else { $keypricea = 1; } if ($keytown_id || $keytype_id || $keykind_id || $khoanggia > 0) { $sql = "SELECT tp.ref,tp.kind_id,tp.price,tp.type_id, tp.id,tp.price_area_unit,tp.price_unit,\n\t\t\t\t\t\ttp.address, tp.living_space,tp.phuongxa AS phuongxa, tp.duongpho AS duongpho,\n\t\t\t\t\t\ttto.value AS `town`,area.value AS `area`\n\t\t\t\t\tFROM #__jea_properties AS tp\n\t\t\t\t\tLEFT JOIN #__jea_towns AS tto ON tto.id = tp.town_id\n\t\t\t\t\tLEFT JOIN #__jea_areas AS area ON area.id = tp.area_id\n\t\t\t\t\tLEFT JOIN #__jea_price_units AS pri ON pri.id=tp.price_unit\n\t\t\t\t\tWHERE tp.id <> {$id} AND tp.success = 0 AND tp.published=1 AND ( "; if ($keytown_id) { $sql .= " tp.town_id LIKE '%{$keytown_id}%'"; } if ($keykind_id) { if ($keytown_id) { $sql .= " OR "; } $sql .= " kind_id LIKE '%{$keykind_id}%'"; } if ($keytype_id) { if ($keykind_id || $keytown_id) { $sql .= " OR "; } $sql .= " type_id LIKE '%{$keytype_id}%'"; } if ($khoanggia > 0) { if ($keytype_id || $keykind_id || $keytown_id) { $sql .= " OR "; } $sql .= " ABS( {$keyprice} - IF( tp.price_unit=1,tp.price,tp.price*pri.rate )) < ( {$keypricea} * {$khoanggia} / 100 ) "; } $sql .= " ) "; if ($realtor) { $sql .= ' AND realtor_id = ' . $realtor; } $sql .= " GROUP BY tp.id"; $sql .= " ORDER BY IF( tp.price_unit=1,tp.price,tp.price*pri.rate )"; $result = array(); $db->setQuery($sql); $numrows = $db->loadObjectList(); $result['TotalPage'] = ceil(count($numrows) / $slht); if (isset($CurrenPage)) { $bd = $CurrenPage * $slht - $slht; $db->setQuery($sql, $bd, $slht); } else { $db->setQuery($sql, 0, $slht); } $result['rows'] = $db->loadObjectList(); //print_r($sql); return $result; } }
function getAjaxButton($price_unit, $area_unit, $money, $div_id) { $db =& JFactory::getDBO(); $query = "SELECT * FROM #__jea_price_units ORDER BY ordering"; $db->setQuery($query); $result = $db->loadObjectList(); $i = 0; global $PriceUnit; foreach ($result as $row) { if ($row->id == $PriceUnit) { $tigia = $row->rate; } $rate[$i] = $row->rate; $i++; } $tgvnd = $rate[0]; $tgusd = $rate[1]; $tgsjc = $rate[2]; $vnprice = trim(reFormatPrice(changePrice($money, $tigia, $tgvnd), $PriceUnit)); $usdprice = reFormatPrice(changePrice($money, $tigia, $tgusd), $PriceUnit); $sjcprice = reFormatPrice(changePrice($money, $tigia, $tgsjc), $PriceUnit); switch ($area_unit) { case 1: $donvidat = "m<sup>2</sup>"; break; case 2: $donvidat = ""; break; case 3: $donvidat = "tháng"; break; default: $donvidat = ""; break; } switch ($price_unit) { case 1: $liac1 = "ac"; break; case 2: $liac2 = "ac"; break; case 3: $liac3 = "ac"; break; } echo " <div class=\"tiente\"><a id=\"vnd_{$div_id}\" class='{$liac1}' href=\"javascript:GetChangePrice('1','{$vnprice}','{$usdprice}','{$sjcprice}','{$donvidat}','{$div_id}' ) \">VND</a></div>"; echo " <div class=\"tiente\"><a id=\"usd_{$div_id}\" class='{$liac2}' href=\"javascript:GetChangePrice('2','{$vnprice}','{$usdprice}','{$sjcprice}','{$donvidat}','{$div_id}') \">USD</a></div>"; echo " <div class=\"tiente\"><a id=\"sjc_{$div_id}\" class='{$liac3}' href=\"javascript:GetChangePrice('3','{$vnprice}','{$usdprice}','{$sjcprice}','{$donvidat}','{$div_id}') \">SJC</a></div>"; }
$vonJahr = $datumVAr[2]; $bisTag = $datumBAr[0]; $bisMonat = $datumBAr[1]; $bisJahr = $datumBAr[2]; if (isDatumEarlier($vonTag, $vonMonat, $vonJahr, $bisTag, $bisMonat, $bisJahr) == FALSE) { $fehler = true; $nachricht = "Das gewählte Datum ist nicht korrekt."; $nachricht = getUebersetzung($nachricht, $sprache, $link); include_once "./preis.php"; exit; } $datumVon = parseDateFormular($vonTag, $vonMonat, $vonJahr); $datumBis = parseDateFormular($bisTag, $bisMonat, $bisJahr); //wurde ein zimmer ausgewählt: if (!isset($_POST["zimmer_" . $preis_id]) || empty($_POST["zimmer_" . $preis_id]) || count($_POST["zimmer_" . $preis_id]) < 1) { $fehler = true; $nachricht = "Es muss mindestens ein Mietobjekt ausgewählt werden."; $nachricht = getUebersetzung($nachricht, $sprache, $link); include_once "./preis.php"; exit; } $zimmer_id_neu = $_POST["zimmer_" . $preis_id]; //preis speichern: changePrice($preis_id, $zimmer_id_neu, $datumVon, $datumBis, $preis, "Euro", false, $link); } //ende alle möglichen preise durchlaufen $nachricht = "Die Preise wurden erfolgreich geändert."; $nachricht = getUebersetzung($nachricht, $sprache, $link); include_once "./preis.php"; exit; }
include_once "./standardpreis.php"; exit; } $preis = $_POST["preis_" . $preis_id]; $preis = str_replace(",", ".", $preis); //prüfe ob preis ein float oder integer: if (!is_numeric($preis)) { $fehler = true; $nachricht = "Der Preis ist kein gültiger Wert."; $nachricht = getUebersetzung($nachricht, $sprache, $link); include_once "./standardpreis.php"; exit; } //wurde ein zimmer ausgewählt: if (!isset($_POST["zimmer_" . $preis_id]) || empty($_POST["zimmer_" . $preis_id]) || count($_POST["zimmer_" . $preis_id]) < 1) { $fehler = true; $nachricht = "Es muss mindestens ein Mietobjekt ausgewählt werden."; $nachricht = getUebersetzung($nachricht, $sprache, $link); include_once "./standardpreis.php"; exit; } $zimmer_id_neu = $_POST["zimmer_" . $preis_id]; //preis speichern: changePrice($preis_id, $zimmer_id_neu, null, null, $preis, "Euro", true, $link); } //ende alle möglichen preise durchlaufen $nachricht = "Die Preise wurden erfolgreich geändert."; $nachricht = getUebersetzung($nachricht, $sprache, $link); include_once "./standardpreis.php"; exit; }