Exemplo n.º 1
0
         }
     }
 }
 $insert = null;
 $update = null;
 $delete = null;
 $control = new Controls(Controls::Insert);
 //Chưa chọn loại sản phẩm;
 $Brand = new Brand();
 // khi chọn loại sản phẩm
 if (isset($_POST["btnSave"])) {
     if (isset($_POST["txtControl"])) {
         $control->setValue($_POST["txtControl"]);
     }
     if (isset($_POST["txtBraID"])) {
         $Brand->setBraID($_POST["txtBraID"]);
     }
     if (isset($_POST["txtBraName"])) {
         $Brand->setBraName($_POST["txtBraName"]);
     }
     if ($control == Controls::Insert) {
         if ($Brand->insert() > 0) {
             addLogo($Brand);
             $insert = true;
         }
     } else {
         if ($control == Controls::Update) {
             if (isset($_POST["txtLogoURL_Old"])) {
                 $Brand->setLogoURL($_POST["txtLogoURL_Old"]);
             }
             if (isset($_POST["chkStatus"])) {
Exemplo n.º 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;
$filterBrand = new Brand();
if (isset($_POST['BraID']) & !empty($_POST['BraID'])) {
    $filterBrand->setBraID($_POST['BraID']);
}
if (isset($_POST['BraName']) & !empty($_POST['BraName'])) {
    $filterBrand->setBraName($_POST['BraName']);
}
if (isset($_POST['Status']) & !empty($_POST['Status'])) {
    $filterBrand->setStatus($_POST['Status']);
}
if (isset($_POST['SortName']) & !empty($_POST['SortName'])) {
    $SortName = $_POST['SortName'];
}
if (isset($_POST['SortType']) & !empty($_POST['SortType'])) {
    $SortType = $_POST['SortType'];
}
$numberOfRows = $filterBrand->countRecords();
// Số lượng dòng của bảng