Example #1
0
 $page->addJavascript("assets/js/jquery.validate.min.js");
 $page->addJavascript("assets/js/sweetalert/sweetalert.min.js");
 $page->startBody();
 $insert = null;
 $update = null;
 $delete = null;
 $page->startBody();
 $control = new Controls(Controls::Insert);
 //Chưa chọn loại sản phẩm;
 $Category = new Category(-1, "", new Brand(), new Device(), -1);
 if (isset($_POST["btnSave"])) {
     if (isset($_POST["txtControl"])) {
         $control->setValue($_POST["txtControl"]);
     }
     if (isset($_POST["txtCatProID"])) {
         $Category->setCatID($_POST["txtCatProID"]);
     }
     if (isset($_POST["txtCatName"])) {
         $Category->setCatName($_POST["txtCatName"]);
     }
     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;
Example #2
0
if (isset($_POST['page']) && !empty($_POST['page'])) {
    $curPage = $_POST['page'];
    //truyền thứ tự trang cần xem
}
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 = 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'];