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 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>"; }
} switch ($row->price_area_unit) { case "m2": $donvidat = "/m<sup>2</sup>"; break; case "Nguyên căn": $donvidat = ""; break; case "Tháng": $donvidat = "/tháng"; break; default: $donvidat = ""; break; } $ddgia = reFormatPrice($row->price, $row->price_unit); if ($row->price > 0) { $hientien = trim($ddgia . $donvitien) . $donvidat; } else { $hientien = "Thương lượng"; } echo $hientien; ?> </td> <?php // if($usergid > 24) // { //
function getListingByRealtorId($id) { // get basic info $sql = "SELECT p.id, p.ref, p.price, p.price_unit AS `price_unit`, p.address, \n \t\t\t\t\t\tp.price_area_unit AS `price_area_unit`, p.living_space, \n \t\t\t\t\t\ta.value AS `area`, t.value AS `town`, p.kind_id AS `kind_id` " . " FROM #__jea_properties p" . PHP_EOL . "LEFT JOIN #__jea_areas AS a ON a.id = p.area_id" . PHP_EOL . "LEFT JOIN #__jea_towns AS t ON t.id = p.town_id" . PHP_EOL . "LEFT JOIN #__jea_price_units AS pu ON pu.id = p.price_unit" . PHP_EOL . "LEFT JOIN #__jea_price_area_units AS pau ON pau.id = p.price_area_unit" . PHP_EOL . "WHERE p.realtor_id = " . $id . PHP_EOL . "AND p.published = 1 " . PHP_EOL . "ORDER BY p.ordering"; $this->_db->setQuery($sql); $rows = $this->_db->loadObjectList(); foreach ($rows as $row) { // TODO: refractor --- get Itemid $Itemid = 1; if ($row->kind_id == 1) { $row->itemid = '10'; } else { if ($row->kind_id == 2) { $row->itemid = '11'; } else { if ($row->kind_id == 3) { $row->itemid = '12'; } else { if ($row->kind_id == 4) { $row->itemid = '13'; } } } } // make link $row->link = "index.php?option=com_jea&view=properties&id=" . $row->id . "&Itemid=" . $row->itemid; // get images $images_info = ComJea::getImagesById($row->id); if (!empty($images_info['main_image']['min_url'])) { $row->image = $images_info['main_image']['min_url']; } else { $row->image = "images/noimage.jpg"; } $priceStr = reFormatPrice($row->price) . $row->price_unit . '/' . $row->price_area_unit; $row->full_price = $priceStr; // format price } return $rows; }