$ListPro = array(); $flag = false; $rowsPerPage = 9; // số lượng dòng được hiển thị 1 trang $curPage = 1; // Trang hiện tại $numberOfRows = 0; if (isset($_GET['page']) && !empty($_GET['page'])) { $curPage = $_GET['page']; //truyền thứ tự trang cần xem } $offset = ($curPage - 1) * $rowsPerPage; // tính offset bắt đầu load if (isset($_GET["btnSearch"])) { $Product = new Product(); $Product->setProName($_GET["txtProName"]); $Price = $_GET["txtPrice"]; $Price = explode(',', $Price); $Product->setPrice($Price); require_once './entities/Category.php'; require_once './entities/Brand.php'; require_once './entities/Device.php'; $CatPro = new Category(); $CatPro->setBrand(new Brand($_GET["cboBra"])); $CatPro->setDevice(new Device($_GET["cboDevice"])); $Product->setCatPro($CatPro); $ListPro = $Product->loadLimit($rowsPerPage, $offset, "ProName"); $numberOfRows = $Product->countRecords(); $flag = true; } ?>
} $insert = null; $update = null; $delete = null; $control = new Controls(Controls::Insert); $ListCategories = Category::loadAll(); $Product = new Product(); if (isset($_POST["btnSave"])) { if (isset($_POST["txtControl"])) { $control->setValue($_POST["txtControl"]); } if (isset($_POST["txtProID"])) { $Product->setProID($_POST["txtProID"]); } if (isset($_POST["txtProName"])) { $Product->setProName($_POST["txtProName"]); } if (isset($_POST["txtImageURL_Old"])) { $Product->setImageURL($_POST["txtImageURL_Old"]); } if (isset($_POST["txtProPrice"])) { $fProPrice = str_replace(',', '', $_POST["txtProPrice"]); $Product->setPrice($fProPrice); } if (isset($_POST["txtProQuantity"])) { $fProQuantity = str_replace(',', '', $_POST["txtProQuantity"]); $Product->setInStock($fProQuantity); } if (isset($_POST["txtProCreated"])) { $dProCreate = strtotime(str_replace('/', '-', $_POST["txtProCreated"])); //d-m-Y
} if (isset($_POST['show']) && !empty($_POST['show'])) { $rowsPerPage = $_POST['show']; //truyền số record cần hiển thịs } $offset = ($curPage - 1) * $rowsPerPage; // tính offset bắt đầu load //filter $SortName = ""; $SortType = "ASC"; $filterPro = new Product(); if (isset($_POST['ProID']) & !empty($_POST['ProID'])) { $filterPro->setProID($_POST['ProID']); } if (isset($_POST['ProName']) & !empty($_POST['ProName'])) { $filterPro->setProName($_POST['ProName']); } if (isset($_POST['Price']) & !empty($_POST['Price'])) { $filterPro->setPrice($_POST['Price']); } if (isset($_POST['InStock']) & !empty($_POST['InStock'])) { $filterPro->setInStock($_POST['InStock']); } if (isset($_POST['CatProID']) & !empty($_POST['CatProID'])) { $filterPro->setCatPro(new Category($_POST['CatProID'])); } if (isset($_POST['Status']) & !empty($_POST['Status'])) { $filterPro->setStatus($_POST['Status']); } if (isset($_POST['SortName']) & !empty($_POST['SortName'])) { $SortName = $_POST['SortName'];