public static function display($business)
 {
     $str = "";
     for ($i = 0; $i < count($business); $i++) {
         $loaidv = LoaiDichVuBUS::getById($business[$i]['loaidv']);
         $loainha = LoaiNhaBUS::getById($business[$i]['loainha']);
         $user = UsersBUS::GetUserByID($business[$i]['chusohuu']);
         $str .= '<tr>';
         $str .= '<td align="center">' . ($i + 1) . '</td>';
         $str .= '<td>' . $user['hoten'] . '</td>';
         $str .= '<td>' . $business[$i]['tieude'] . '<img src="images/vip.gif"></td>';
         $str .= '<td>' . $loainha['ten'];
         if ($business[$i]["rank"] == 1) {
             $str .= "&nbsp;&nbsp;<img src='images/hot.gif' />";
         }
         $str .= '</td>';
         $str .= '<td>' . $business[$i]['sonha'] . '/' . $business[$i]['duong'] . ', ' . $business[$i]['phuong'] . ', ' . $business[$i]['quan'] . ', ' . $business[$i]['tinh'] . '</td>';
         $str .= '<td align="center">' . $business[$i]['ngaydang'] . '</td>';
         $str .= '<td align="center">' . $business[$i]['thoihantin'] . '</td>';
         $str .= '<td align="center" style="color:green;">';
         switch ($business[$i]['status']) {
             case 0:
                 $str .= "Tin chờ duyệt";
                 break;
             case 1:
                 $str .= "Tin đã duyệt";
                 break;
             case 2:
                 $str .= "Tin đăng VIP";
                 break;
             case 3:
                 $str .= "Tin hết hạn";
                 break;
             default:
                 $str .= "Tin bị xóa";
                 break;
         }
         $str .= '</td>';
         $str .= '<td align="center">' . $loaidv['ten'] . '</td>';
         $str .= '</tr>';
     }
     return $str;
 }
    if (isset($_REQUEST['cbbServiceType']) && $_REQUEST['cbbServiceType'] == $loaidv[$i]['id']) {
        echo "<option value='" . $loaidv[$i]['id'] . "' selected>" . $loaidv[$i]['ten'] . "</option>";
    } else {
        echo "<option value='" . $loaidv[$i]['id'] . "'>" . $loaidv[$i]['ten'] . "</option>";
    }
}
?>
														</select>
													</td>
													<td>
														Danh muc<br>
														<select style="width: 150px;" name="cbbCategory">
															<option value="-1">tất cả</option>
															<?php 
include "../BUS/LoaiNhaBUS.php";
$rs = LoaiNhaBUS::GetAllLoaiNha();
for ($i = 0; $i < count($rs); $i++) {
    if (isset($_REQUEST['cbbCategory']) && $_REQUEST['cbbCategory'] == $rs[$i]['id']) {
        echo "<option value='" . ($i + 1) . "' selected>" . $rs[$i][1] . "</option>";
    } else {
        echo "<option value='" . ($i + 1) . "'>" . $rs[$i][1] . "</option>";
    }
}
?>
														</select>
													</td>
													<td>
														Địa phương<br>
														<select style="width: 120px;" name="cbbLocation">
															<option value="-1">tất cả</option>
															<?php 
include_once "../BUS/TinhBUS.php";
include_once "../BUS/QuanBUS.php";
include_once "../BUS/PhuongBUS.php";
include_once "../BUS/DonViTienBUS.php";
include_once "../BUS/LoaiNhaBUS.php";
include_once "../module/Utils/Utils.php";
include_once "../BUS/HuongNhaBUS.php";
include_once "../BUS/PhapLyBUS.php";
include_once "../BUS/HinhAnhBUS.php";
$objCanHo = DichVuBUS::select($_REQUEST["aid"]);
$loaidv = LoaiDVBUS::GetLoaiDVByID($objCanHo["loaidv"]);
$tinh = TinhBUS::getTinhById($objCanHo["tinh"]);
$quan = QuanBUS::getQuanById($objCanHo["quan"]);
$phuong = PhuongBUS::getPhuongById($objCanHo["phuong"]);
$donvitien = DonViTienBUS::selectId($objCanHo["donvitien"]);
$loainha = LoaiNhaBUS::getById($objCanHo["loainha"]);
$huongnha = HuongNhaBUS::GetHuongNhaById($objCanHo["huongnha"]);
$phaply = PhapLyBUS::GetPhapLyById($objCanHo["phaply"]);
$hinhanh = HinhAnhBUS::getAllHinhAnhByDichVuID($objCanHo['id']);
?>
<div style="margin:10px">
    <div class="tl"></div>
    <div class="tr"></div>
    <div class="tm"></div>
    <div class="mid">
	<script src="js/common.js" language="javascript"></script>
	<form action="index.php?view=article" method="post" name="frmRegister" id="frmRegister" >
		<div style="float:left;width:60%;">
			<table width="90%" align="center" border="0" cellpadding="0" cellspacing="0">
				<tr style="background:#F1F1F1;">
					<td width="100px"><b>Loại dịch vụ:</b></td>
    include_once "../BUS/DonviDichVuBUS.php";
    include_once "../BUS/DonViTienBUS.php";
    include_once "../BUS/TinhBUS.php";
    include_once "../BUS/QuanBUS.php";
    include_once "../BUS/PhuongBUS.php";
    include_once "Utils/Utils.php";
    include_once "../BUS/LoaiDVBUS.php";
    include_once "../BUS/LoaiNhaBUS.php";
    include_once "../BUS/PhapLyBUS.php";
    include_once "../BUS/HuongNhaBUS.php";
    $business = DichVuBUS::select($_REQUEST['iddichvu']);
    $quan = QuanBUS::getQuanById($business['quan']);
    $phuong = PhuongBUS::getPhuongById($business['phuong']);
    $tinh = TinhBUS::getTinhById($business['tinh']);
    $loaidichvu = LoaiDVBUS::GetLoaiDVByID($business['loaidv']);
    $loainha = LoaiNhaBUS::getById($business['loainha']);
    $phaply = PhapLyBUS::GetPhapLyById($business['phaply']);
    $huongnha = HuongNhaBUS::GetHuongNhaById($business['huongnha']);
    $donvitien = DonViTienBUS::selectId($business['donvitien']);
    $hinhanh = HinhAnhBUS::getAllHinhAnhByDichVuID($business['id']);
    // echo count($hinhanh);
    // echo "<br>aaaaaaaaa=".$hinhanh[0]['path'];
}
?>
							<div style="width: 686px; padding-top:20px;float:left;">
								<div style="margin-left: 10px; margin-top: 10px; font-family: tahoma; font-size: 18px;
									font-weight: bold; color:#890C29;">
									<?php 
echo $business['tieude'];
?>
 </div>
						<td align="center"><?php 
    echo $i + 1;
    ?>
</td>
						<td align="center"><input type="checkbox" name="cbTinDang" id="cbTinDang" value="<?php 
    echo $listTinDang[$i]["id"];
    ?>
" onclick="Check_Click(this)"></td>
						<td class="m_name"><?php 
    echo "<a href='index.php?view=article&do=edit&aid=" . $listTinDang[$i]["id"] . "'>" . $listTinDang[$i]["tieude"] . "</a>";
    ?>
</td>
						<?php 
    $loaidv = LoaiDVBUS::GetLoaiDVByID($listTinDang[$i]["loaidv"]);
    echo "<td align='center'>" . $loaidv[1] . "</td>";
    $loainha = LoaiNhaBUS::getById($listTinDang[$i]["loainha"]);
    echo "<td align='center'>" . $loainha[1];
    if ($listTinDang[$i]["rank"] == 1) {
        echo "&nbsp;&nbsp;<img src='images/hot.gif' />";
    }
    echo "</td>";
    $phuong = PhuongBUS::getPhuongById($listTinDang[$i]["phuong"]);
    $quan = QuanBUS::getQuanById($listTinDang[$i]["quan"]);
    echo "<td>" . $listTinDang[$i]["sonha"] . " " . $listTinDang[$i]["duong"] . ", " . $phuong[1] . ", " . $quan[1] . ", ";
    $tinh = TinhBUS::getTinhById($listTinDang[$i]["tinh"]);
    echo $tinh[1] . "</td>";
    $donviTien = DonViTienBUS::selectId($listTinDang[$i]["donvitien"]);
    echo "<td align='right'>" . number_format($listTinDang[$i]["giaban"]) . " {$donviTien['1']}</td>";
    if ($listTinDang[$i]["ngaydang"] != null) {
        $date = Utils::convertTimeDMY($listTinDang[$i]["ngaydang"]);
        echo "<td align='center'>" . $date . "</td>";
 public static function display($strLink, $business, $totalItems, $curPage, $maxPages, $maxItems)
 {
     $strResult = "";
     if (count($business) > 0) {
         for ($i = 0; $i < count($business); $i++) {
             $strResult .= "<tr bgcolor='#ffffff'>";
             $strResult .= "<td width='60' valign='middle' align='center' style='border-bottom:solid 1px #CCCCCC;'>";
             $strResult .= "<b>" . $business[$i][0] . "</b></td>";
             //id
             $strResult .= "<td valign='top' align='left' style='border-left: 1px solid rgb(204, 204, 204); border-bottom: 1px solid rgb(204, 204, 204);'>";
             if ($business[$i]['status'] == 0) {
                 $strResult .= "<div style='float:right;'><b style='color:#FF0000;'>Chờ duyệt</b></div><br>";
                 //loai tin
                 $strResult .= "<b>" . $business[$i][1] . "</b><br>";
                 //tên tiêu đề
             } else {
                 if ($business[$i]['status'] == 1) {
                     $strResult .= "<span style='color: rgb(255, 0, 0);'>Tin đã duyệt</span><div style='float:right;'><b style='color:#FF0000;'>Miễn Phí</b></div><br>";
                     //loai tin
                     $strResult .= "<b>" . $business[$i][1] . "</b><br>";
                     //tên tiêu đề
                 } else {
                     if ($business[$i]['status'] == 2) {
                         $strResult .= "<div style='float:right;'><b style='color:#FF0000;'>Tin VIP</b></div><br>";
                         //loai tin
                         $strResult .= "<b>" . $business[$i][1] . "</b><br>";
                         //tên tiêu đề
                     } else {
                         $strResult .= "<div style='float:right;'><b style='color:#FF0000;'>Hết hạn</b></div><br>";
                         //loai tin
                         $strResult .= "<b>" . $business[$i][1] . "</b><br>";
                         //tên tiêu đề
                     }
                 }
             }
             //load data
             $loaidv = LoaiDichVuBUS::getById($business[$i][19]);
             $huongnha = HuongNhaBUS::GetHuongNhaById($business[$i]['huongnha']);
             $donvitien = DonViTienBUS::selectId($business[$i]['donvitien']);
             $donvidv = DonViDichVuBUS::selectId($business[$i]['donvidv']);
             $loainha = LoaiNhaBUS::getById($business[$i]['loainha']);
             if ($business[$i]['ngaydang'] != null) {
                 $date = Utils::convertTimeDMY($business[$i]['ngaydang']);
                 $declinetime = Utils::convertDecline_Time($business[$i]['ngaydang']);
             } else {
                 $date = "00:00:00";
                 $declinetime = "00:00:00";
             }
             //endload
             $strResult .= "- <b style='color: #0D5DA8;font-weight:bold;font-size:11px;text-decoration: none;'\t>Loại nhà:" . $loainha['ten'] . " </b><br> - <a target='_blank' href='#'>" . $loaidv[1] . "</a>";
             //tên loại dv
             $strResult .= "- Hướng nhà:" . $huongnha[1] . "<br>";
             //Hướng nhà
             $strResult .= "- Giá: <b>" . number_format($business[$i]['giaban']) . "</b> " . $donvitien['ten'] . "/" . $donvidv['ten'] . "  - Kích thước: " . $business[$i]['dai'] . "x" . $business[$i]['rong'] . " m<sup>2</sup> </b><br>";
             //giá nhà và kt
             if ($business[$i]['status'] == 1) {
                 $strResult .= "<div style='float:left; padding:3px; font-weight: bold;'><a style='color:red;' href='nangcaptinvip.php?iddv=" . $business[$i]['id'] . "'><img align='left' src='../images/uprade.png'>Nâng cấp lên VIP 275.000 /tháng</a></div></td>";
                 //giá nhà và kt
             }
             $strResult .= "<td width='260' valign='top' style='border-left: 1px solid rgb(204, 204, 204); border-bottom: 1px solid rgb(204, 204, 204);'>";
             //column 3
             $strResult .= "<div style='margin-bottom: 5px; font-weight: normal; color: rgb(51, 51, 51);'>";
             //$strResult.="- 1 lượt xem tin <br>"; //so nguoi xem tin
             $strResult .= "- Ngày đăng: &nbsp;&nbsp;&nbsp;&nbsp;" . $date . "<br>";
             //ngay dang
             $strResult .= "- Ngày hết hạn: " . $declinetime . "<br>";
             //ngay het han
             $strResult .= "</div>";
             $strResult .= "<div style='padding: 3px; background-color: rgb(242, 245, 249); border: 1px solid rgb(204, 204, 204);font-weight: bold;'>";
             $strResult .= "<b title='23-06-2011' style='color: green;'>";
             $strResult .= "<img align='center' style='margin: 0px;position:relative;top:-4px;' src='../images/action_check2.png'>Đã cập nhật</b>&nbsp;&nbsp;";
             //update
             $strResult .= "<a href='dangtindichvu.php?update=" . $business[$i][0] . "&loaidvcandang=" . $business[$i]['loaidv'] . "&step=" . '1' . "' style='color: #0D5DA8;font-weight:bold;font-size:11px;text-decoration: none;'>";
             $strResult .= "<img align='center' style='margin: 0px;position:relative;top:-4px;' src='../images/edit.png'>Sửa tin</a>&nbsp;&nbsp;";
             //repare
             $strResult .= "<a onclick='return xoatindang(" . $business[$i][0] . ");' href='' style='color: #0D5DA8;font-weight:bold;font-size:11px;text-decoration: none;'>";
             $strResult .= "<img align='center' style='margin: 0px;position:relative;top:-4px;' src='../images/action_delete2.png' >Xóa tin</a></div>";
             //delete
             $strResult .= "</td></tr>";
         }
     } else {
         echo "<tr><td align='center' colspan='3'><h3 style='color: #336699; font-size: 14px;margin: 0;padding: 0;'>Chưa có tin đăng !</h3></td></tr>";
         echo "<tr><td></td></tr>";
     }
     $strResult .= "</table>";
     $strPaging = Utils::paging($strLink, $totalItems, $curPage, $maxPages, $maxItems);
     $strResult .= "<center>" . $strPaging;
     return $strResult;
 }