Example #1
0
if (isset($_POST['CatName']) & !empty($_POST['CatName'])) {
    $filterCategory->setCatName($_POST['CatName']);
}
if (isset($_POST['DeviceID']) & !empty($_POST['DeviceID'])) {
    $filterCategory->setDevice(new Device($_POST['DeviceID']));
}
if (isset($_POST['Status']) & !empty($_POST['Status'])) {
    $filterCategory->setStatus($_POST['Status']);
}
if (isset($_POST['SortName']) & !empty($_POST['SortName'])) {
    $SortName = $_POST['SortName'];
}
if (isset($_POST['SortType']) & !empty($_POST['SortType'])) {
    $SortType = $_POST['SortType'];
}
$numberOfRows = $filterCategory->countRecords();
// Số lượng dòng của bảng
$ListCategories = array();
if ($rowsPerPage == -1) {
    // nếu là chọn hiển thị là ALL
    $rowsPerPage = $numberOfRows;
    $ListCategories = $filterCategory->loadLimit($rowsPerPage, 0, $SortName, $SortType);
} else {
    $ListCategories = $filterCategory->loadLimit($rowsPerPage, $offset, $SortName, $SortType);
}
//tổng số trang cần hiển thị
$self = $_SERVER['PHP_SELF'];
// Lay dia chi truc tiep cua PHP dang mo
$pagination = new Pagination($curPage, $rowsPerPage, $offset, $numberOfRows, $self);
//end Paging
?>