Example #1
0
     }
     if (isset($_POST["cboDevice"])) {
         $oDevice = new Device($_POST["cboDevice"]);
         $Category->setDevice($oDevice);
     }
     if (isset($_POST["cboBrand"])) {
         $oBrand = new Brand($_POST["cboBrand"]);
         $Category->setBrand($oBrand);
     }
     if ($control == Controls::Insert) {
         $Category->insert();
         $insert = true;
     } else {
         if ($control == Controls::Update) {
             if (isset($_POST["chkStatus"])) {
                 $Category->setStatus($_POST["chkStatus"]);
             } else {
                 $Category->setStatus(0);
             }
             $Category->update();
             $update = true;
         }
     }
 } else {
     if (isset($_GET["CatProID"]) && isset($_GET["control"])) {
         $control->setValue($_GET["control"]);
         $Category = Category::getCat($_GET["CatProID"]);
         if ($Category != null) {
             if ($control == Controls::Update) {
                 echo "<script> \$(function () { \$(window).load(function(){ \$('#modalCat').modal( { backdrop: 'static', keyboard: false }, 'show');})});</script>";
             } else {
Example #2
0
// tính offset bắt đầu load
//filter
$SortName = "";
$SortType = true;
$filterCategory = new Category(-1, "", new Brand(), new Device(), -1);
if (isset($_POST['CatProID']) & !empty($_POST['CatProID'])) {
    $filterCategory->setCatID($_POST['CatProID']);
}
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 {